Browse Source

1.编号生成规则修改
2.费用请核,撤销请核逻辑修改
3.费用保存,费用模本导入增加代收客户逻辑
4.报表打印件数转英文bug修改

纪新园 4 months ago
parent
commit
913064b7a4
16 changed files with 832 additions and 229 deletions
  1. 6 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/billno/entity/BusinessBillNo.java
  2. 36 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/finance/fee/entity/FeeCenterUpdateRecord.java
  3. 6 1
      blade-service/blade-los/src/main/java/org/springblade/los/Util/BigDecimalUtils.java
  4. 6 1
      blade-service/blade-los/src/main/java/org/springblade/los/billno/service/impl/BusinessBillNoServiceImpl.java
  5. 408 212
      blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/ExpenseApplicationServiceImpl.java
  6. 4 1
      blade-service/blade-los/src/main/java/org/springblade/los/business/amends/service/impl/AmendsServiceImpl.java
  7. 8 6
      blade-service/blade-los/src/main/java/org/springblade/los/business/sea/service/impl/BillsServiceImpl.java
  8. 9 0
      blade-service/blade-los/src/main/java/org/springblade/los/check/service/impl/AuditProecessServiceImpl.java
  9. 166 8
      blade-service/blade-los/src/main/java/org/springblade/los/finance/fee/service/impl/FeeCenterServiceImpl.java
  10. 3 0
      blade-service/blade-los/src/main/java/org/springblade/los/finance/fee/service/impl/FinAccBillsServiceImpl.java
  11. 9 0
      blade-service/blade-los/src/main/java/org/springblade/los/finance/invoices/controller/FinInvoicesController.java
  12. 2 0
      blade-service/blade-los/src/main/java/org/springblade/los/finance/invoices/service/IFinInvoicesService.java
  13. 59 0
      blade-service/blade-los/src/main/java/org/springblade/los/finance/invoices/service/impl/FinInvoicesServiceImpl.java
  14. 9 0
      blade-service/blade-los/src/main/java/org/springblade/los/finance/stl/controller/FinStlBillsController.java
  15. 2 0
      blade-service/blade-los/src/main/java/org/springblade/los/finance/stl/service/IFinStlBillsService.java
  16. 99 0
      blade-service/blade-los/src/main/java/org/springblade/los/finance/stl/service/impl/FinStlBillsServiceImpl.java

+ 6 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/billno/entity/BusinessBillNo.java

@@ -169,5 +169,11 @@ public class BusinessBillNo implements Serializable {
 	@TableField(exist = false)
 	private List<BillNoSerial> billNoSerialList;
 
+	/**
+	 * 生成编号日期
+	 */
+	@TableField(exist = false)
+	private Date date;
+
 
 }

+ 36 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/finance/fee/entity/FeeCenterUpdateRecord.java

@@ -337,6 +337,42 @@ public class FeeCenterUpdateRecord implements Serializable {
 	@ApiModelProperty(value = "修改原因")
 	private String updateReason;
 
+	/**
+	 * 代收、付客户 id
+	 */
+	@ApiModelProperty(value = "代收、付客户 id")
+	private Long generationCorpId;
+
+	/**
+	 * 代收、付客户中文名称
+	 */
+	@ApiModelProperty(value = "代收、付客户中文名称")
+	private String generationCorpCnName;
+
+	/**
+	 * 代收、付客户英文名称
+	 */
+	@ApiModelProperty(value = "代收、付客户英文名称")
+	private String generationCorpEnName;
+
+	/**
+	 * 修改后代收、付客户 id
+	 */
+	@ApiModelProperty(value = "修改后代收、付客户 id")
+	private Long generationCorpIdUpdate;
+
+	/**
+	 * 修改后代收、付客户中文名称
+	 */
+	@ApiModelProperty(value = "修改后代收、付客户中文名称")
+	private String generationCorpCnNameUpdate;
+
+	/**
+	 * 修改后代收、付客户英文名称
+	 */
+	@ApiModelProperty(value = "修改后代收、付客户英文名称")
+	private String generationCorpEnNameUpdate;
+
 	//审核-跳转对应页面的路由
 	@TableField(exist = false)
 	private String url;

+ 6 - 1
blade-service/blade-los/src/main/java/org/springblade/los/Util/BigDecimalUtils.java

@@ -27,7 +27,12 @@ public class BigDecimalUtils {
 			return uppercaseInteger;
 		} else {
 			long integralPart = integerPart.longValue();
-			return convert(integralPart).trim();
+			String data = convert(integralPart).trim();
+			boolean isAtEnd = data.endsWith("AND");
+			if (isAtEnd){
+				data = data.substring(0,data.length()-3);
+			}
+			return data;
 		}
 	}
 

+ 6 - 1
blade-service/blade-los/src/main/java/org/springblade/los/billno/service/impl/BusinessBillNoServiceImpl.java

@@ -78,7 +78,12 @@ public class BusinessBillNoServiceImpl extends ServiceImpl<BusinessBillNoMapper,
 		if (detail == null) {
 			throw new RuntimeException("未找到可用生成编码规则");
 		}
-		Date date = new Date();
+		Date date;
+		if (ObjectUtils.isNull(businessBillNo.getDate())){
+			date = new Date();
+		}else{
+			date = businessBillNo.getDate();
+		}
 		//编码开头
 		String head = "";
 		//编码日期格式

+ 408 - 212
blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/ExpenseApplicationServiceImpl.java

@@ -24,7 +24,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.AllArgsConstructor;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.StringUtil;
 import org.springblade.los.Util.CurrencyUtils;
+import org.springblade.los.basic.business.entity.BusinessType;
+import org.springblade.los.basic.business.service.IBusinessTypeService;
+import org.springblade.los.billno.entity.BusinessBillNo;
+import org.springblade.los.billno.service.IBusinessBillNoService;
 import org.springblade.los.box.entity.ExpenseApplication;
 import org.springblade.los.box.entity.TradingBox;
 import org.springblade.los.box.mapper.ExpenseApplicationMapper;
@@ -46,6 +51,7 @@ import org.springblade.los.finance.fee.service.IFinAccBillsService;
 import org.springblade.system.feign.ISysClient;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
 import java.math.BigDecimal;
 import java.util.ArrayList;
@@ -82,6 +88,10 @@ public class ExpenseApplicationServiceImpl extends ServiceImpl<ExpenseApplicatio
 
 	private final ISysClient sysClient;
 
+	private final IBusinessTypeService bBusinessTypeService;
+
+	private final IBusinessBillNoService businessBillNoService;
+
 	@Override
 	public IPage<ExpenseApplicationVO> selectExpenseApplicationPage(IPage<ExpenseApplicationVO> page, ExpenseApplicationVO expenseApplication) {
 		return page.setRecords(baseMapper.selectExpenseApplicationPage(page, expenseApplication));
@@ -146,184 +156,336 @@ public class ExpenseApplicationServiceImpl extends ServiceImpl<ExpenseApplicatio
 		if (ObjectUtils.isNull(expenseApplication.getFeeCenterList()) || expenseApplication.getFeeCenterList().isEmpty()) {
 			throw new RuntimeException("请选择明细");
 		}
-		StringBuilder text = new StringBuilder();
-		for (FeeCenter item : expenseApplication.getFeeCenterList()) {
-			if (1 == item.getAccStatus()) {
-				text.append("费用:").append(item.getFeeCnName()).append("金额:").append(item.getAmount()).append("已生成账单,");
+		String status = sysClient.getParamService("expense.application");
+		if (status.equals("1")) {
+			StringBuilder text = new StringBuilder();
+			for (FeeCenter item : expenseApplication.getFeeCenterList()) {
+				if (1 == item.getAccStatus()) {
+					text.append("费用:").append(item.getFeeCnName()).append("金额:").append(item.getAmount()).append("已生成账单,");
+				}
+				if (item.getStlPid() != null) {
+					text.append("费用:").append(item.getFeeCnName()).append("金额:").append(item.getAmount()).append("已申请,");
+				}
 			}
-			if (item.getStlPid() != null) {
-				text.append("费用:").append(item.getFeeCnName()).append("金额:").append(item.getAmount()).append("已申请,");
+			if (ObjectUtils.isNotNull(text.toString())) {
+				throw new RuntimeException(text.toString());
 			}
-		}
-		if (ObjectUtils.isNotNull(text.toString())) {
-			throw new RuntimeException(text.toString());
-		}
-		if ("BUY,ZR,DL,OW-N,OW-F,XGFY,XGDX,CCSQ".contains(expenseApplication.getSrcType())) {
-			TradingBox tradingBox = tradingBoxService.getById(expenseApplication.getSrcId());
-			if (tradingBox == null) {
-				throw new RuntimeException("未查到单据信息");
+			if ("BUY,ZR,DL,OW-N,OW-F,XGFY,XGDX,CCSQ".contains(expenseApplication.getSrcType())) {
+				TradingBox tradingBox = tradingBoxService.getById(expenseApplication.getSrcId());
+				if (tradingBox == null) {
+					throw new RuntimeException("未查到单据信息");
+				}
+				expenseApplication.setCreateUser(AuthUtil.getUserId());
+				expenseApplication.setCreateTime(new Date());
+				expenseApplication.setCreateUserName(AuthUtil.getUserName());
+				expenseApplication.setSrcNo(tradingBox.getSysNo());
+				expenseApplication.setSrcMblno(tradingBox.getContractNo());
+				expenseApplication.setSrcContainerNumber(tradingBox.getContainerNumber());
+				expenseApplication.setSrcContractNo(tradingBox.getContractNo());
+				expenseApplication.setStatus("审核提交");
+				expenseApplication.setSrcBusDate(new Date());
+				expenseApplication.setCorpId(tradingBox.getPurchaseCompanyId());
+				expenseApplication.setCorpCnName(tradingBox.getPurchaseCompanyName());
+				expenseApplication.setCorpEnName(tradingBox.getPurchaseCompanyName());
+				expenseApplication.setBranchId(AuthUtil.getDeptId());
+				R<String> res = sysClient.getDeptName(Long.parseLong(AuthUtil.getDeptId()));
+				if (res.isSuccess() && ObjectUtils.isNotNull(res.getData())) {
+					expenseApplication.setBranchName(res.getData());
+				}
+			} else if ("HYJK,HYCK".contains(expenseApplication.getSrcType())) {
+				Bills bills = billsService.getById(expenseApplication.getSrcId());
+				if (bills == null) {
+					throw new RuntimeException("未查到单据信息");
+				}
+				expenseApplication.setCreateUser(AuthUtil.getUserId());
+				expenseApplication.setCreateTime(new Date());
+				expenseApplication.setCreateUserName(AuthUtil.getUserName());
+				expenseApplication.setSrcNo(bills.getBillNo());
+				expenseApplication.setSrcMblno(bills.getMblno());
+				expenseApplication.setSrcHblno(bills.getHblno());
+				expenseApplication.setSrcContainerNumber("");
+				expenseApplication.setSrcContractNo(bills.getBookingNo());
+				expenseApplication.setStatus("审核提交");
+				expenseApplication.setSrcBusDate(new Date());
+				expenseApplication.setCorpId(bills.getCorpId());
+				expenseApplication.setCorpCnName(bills.getCorpCnName());
+				expenseApplication.setCorpEnName(bills.getCorpEnName());
+				expenseApplication.setBranchId(bills.getBranchId());
+				expenseApplication.setBranchName(bills.getBranchName());
+			} else {
+				throw new RuntimeException("类型错误,未查到单据");
 			}
-			expenseApplication.setCreateUser(AuthUtil.getUserId());
-			expenseApplication.setCreateTime(new Date());
-			expenseApplication.setCreateUserName(AuthUtil.getUserName());
-			expenseApplication.setSrcNo(tradingBox.getSysNo());
-			expenseApplication.setSrcMblno(tradingBox.getContractNo());
-			expenseApplication.setSrcContainerNumber(tradingBox.getContainerNumber());
-			expenseApplication.setSrcContractNo(tradingBox.getContractNo());
-			expenseApplication.setStatus("审核提交");
-			expenseApplication.setSrcBusDate(new Date());
-			expenseApplication.setCorpId(tradingBox.getPurchaseCompanyId());
-			expenseApplication.setCorpCnName(tradingBox.getPurchaseCompanyName());
-			expenseApplication.setCorpEnName(tradingBox.getPurchaseCompanyName());
-			expenseApplication.setBranchId(AuthUtil.getDeptId());
-			R<String> res = sysClient.getDeptName(Long.parseLong(AuthUtil.getDeptId()));
-			if (res.isSuccess() && ObjectUtils.isNotNull(res.getData())) {
-				expenseApplication.setBranchName(res.getData());
+			baseMapper.insert(expenseApplication);
+			String exrateType = currencyUtils.standardCurrency(AuthUtil.getDeptId());
+			if (!expenseApplication.getFeeCenterList().isEmpty()) {
+				if (expenseApplication.getFeeCenterList().stream().filter(e -> !e.getCurCode().equals(exrateType))
+					.map(FeeCenter::getCurCode).distinct().count() > 1) {
+					throw new RuntimeException("请选择单一非本币币种");
+				}
+				for (FeeCenter item : expenseApplication.getFeeCenterList()) {
+					item.setUpdateTime(new Date());
+					item.setUpdateUser(AuthUtil.getUserId());
+					item.setUpdateUserName(AuthUtil.getUserName());
+					item.setStlPid(expenseApplication.getId());
+					item.setAuditStatus("1");
+					item.setApplyId(AuthUtil.getUserId());
+					item.setApplyName(AuthUtil.getUserName());
+					item.setApplyTime(new Date());
+				}
+				feeCenterService.updateBatchById(expenseApplication.getFeeCenterList());
 			}
-		} else if ("HYJK,HYCK".contains(expenseApplication.getSrcType())) {
-			Bills bills = billsService.getById(expenseApplication.getSrcId());
-			if (bills == null) {
-				throw new RuntimeException("未查到单据信息");
+			int actId;
+			String processType;
+			String checkType;
+			if ("C".equals(expenseApplication.getDc())) {
+				actId = 1132;
+				processType = "请核费用-付费";
+				checkType = "FYSQ-C";
+			} else {
+				actId = 1130;
+				processType = "请核费用";
+				checkType = "FYSQ";
 			}
-			expenseApplication.setCreateUser(AuthUtil.getUserId());
-			expenseApplication.setCreateTime(new Date());
-			expenseApplication.setCreateUserName(AuthUtil.getUserName());
-			expenseApplication.setSrcNo(bills.getBillNo());
-			expenseApplication.setSrcMblno(bills.getMblno());
-			expenseApplication.setSrcHblno(bills.getHblno());
-			expenseApplication.setSrcContainerNumber("");
-			expenseApplication.setSrcContractNo(bills.getBookingNo());
-			expenseApplication.setStatus("审核提交");
-			expenseApplication.setSrcBusDate(new Date());
-			expenseApplication.setCorpId(bills.getCorpId());
-			expenseApplication.setCorpCnName(bills.getCorpCnName());
-			expenseApplication.setCorpEnName(bills.getCorpEnName());
-			expenseApplication.setBranchId(bills.getBranchId());
-			expenseApplication.setBranchName(bills.getBranchName());
-		} else {
-			throw new RuntimeException("类型错误,未查到单据");
-		}
-		baseMapper.insert(expenseApplication);
-		String exrateType = currencyUtils.standardCurrency(AuthUtil.getDeptId());
-		if (!expenseApplication.getFeeCenterList().isEmpty()) {
-			if (expenseApplication.getFeeCenterList().stream().filter(e -> !e.getCurCode().equals(exrateType))
-				.map(FeeCenter::getCurCode).distinct().count() > 1) {
-				throw new RuntimeException("请选择单一非本币币种");
+			//审批数据
+			LosAuditProecessDTO auditProecessDTO = new LosAuditProecessDTO();
+			//获取审批级次
+			List<LosAuditPathsLevels> auditPathsLevels;
+			// 判断是否有审批流,如果审批流已开启就进入审批流,否则直接走申请通过
+			LosAuditPathsActs pathsActs;
+			//是否开启流程
+			LambdaQueryWrapper<LosAuditPathsActs> auditPathsActsLambdaQueryWrapper = new LambdaQueryWrapper<>();
+			auditPathsActsLambdaQueryWrapper
+				.eq(LosAuditPathsActs::getIsEnable, 1)
+				.eq(LosAuditPathsActs::getFidStatus, "status")
+				.eq(LosAuditPathsActs::getTenantId, AuthUtil.getTenantId())
+				.eq(LosAuditPathsActs::getSalesCompanyId, expenseApplication.getBranchId())
+				.eq(LosAuditPathsActs::getActId, actId);
+			pathsActs = auditPathsActsService.getOne(auditPathsActsLambdaQueryWrapper);
+			//获取审批信息
+			LosAuditPathsActs losAuditPathsActs = auditPathsActsService.getOne(new LambdaQueryWrapper<LosAuditPathsActs>()
+				.eq(LosAuditPathsActs::getActId, actId)
+				.eq(LosAuditPathsActs::getFidStatus, "status")
+				.eq(LosAuditPathsActs::getSalesCompanyId, expenseApplication.getBranchId())
+				.eq(LosAuditPathsActs::getTenantId, AuthUtil.getTenantId()));
+			Long pathId = losAuditPathsActs.getPathId();
+			auditPathsLevels = auditPathsLevelsService.list(new LambdaQueryWrapper<LosAuditPathsLevels>()
+				.eq(LosAuditPathsLevels::getTenantId, AuthUtil.getTenantId())
+				.eq(LosAuditPathsLevels::getPathId, pathId)
+				.eq(LosAuditPathsLevels::getSalesCompanyId, expenseApplication.getBranchId())
+			);
+			auditProecessDTO.setTimes(1);
+			auditProecessDTO.setProcessType(processType);
+			// 没开启审批流直接走 通过流程
+			if (pathsActs == null || pathsActs.getIsEnable() == 2) {
+				throw new SecurityException("当前租户未查询到审批流配置");
+			} else {
+				if (CollectionUtils.isEmpty(auditPathsLevels)) {
+					throw new SecurityException("开启审批失败:未查询到审批信息");
+				}
+				// 绑定审核类型
+				auditProecessDTO.setCheckType(checkType);
+				// 追加跳转路由url
+				auditProecessDTO.setUrl("/iosBasicData/feeApplication/index");
+				auditProecessDTO.setPageStatus("this.$store.getters.feeApproval");
+				auditProecessDTO.setPageLabel("费用申请(F)");
+				auditProecessDTO.setOrderRemark(expenseApplication.getRemarks());
+				List<LosAuditPathsLevels> pathsLevelsList = expenseApplication.getAuditPathsLevels();
+				if (ObjectUtils.isNotNull(pathsLevelsList) && !pathsLevelsList.isEmpty()) {
+					List<Long> idList = pathsLevelsList.stream().map(LosAuditPathsLevels::getId).collect(Collectors.toList());
+					List<LosAuditPathsLevels> levelsList = new ArrayList<>();
+					for (LosAuditPathsLevels item : auditPathsLevels) {
+						if (2 == item.getUserMold()) {
+							if (idList.contains(item.getId())) {
+								levelsList.add(item);
+							}
+						} else {
+							levelsList.add(item);
+						}
+					}
+					auditProecessDTO.setPathsLevelsList(levelsList);
+				} else {
+					auditProecessDTO.setPathsLevelsList(auditPathsLevels);
+				}
+				auditProecessDTO.setActId(1);
+				auditProecessDTO.setSrcBillId(expenseApplication.getId());
+				auditProecessDTO.setBillId(expenseApplication.getSrcId());
+				auditProecessDTO.setBillNo(expenseApplication.getSrcNo());
+				auditProecessDTO.setSendUserId(AuthUtil.getUserId());
+				auditProecessDTO.setSendName(AuthUtil.getUserName());
+				auditProecessDTO.setSendTime(new Date());
+				auditProecessDTO.setBillTime(expenseApplication.getCreateTime());
+				auditProecessDTO.setTenantId(AuthUtil.getTenantId());
+				auditProecessDTO.setCorpId(expenseApplication.getCorpId());
+				auditProecessDTO.setCorpsName(expenseApplication.getCorpCnName());
+				auditProecessDTO.setReferenceNumber(expenseApplication.getSrcContainerNumber());
+				auditProecessDTO.setMorderNo(expenseApplication.getSrcMblno());
+				auditProecessDTO.setSrcBusType(expenseApplication.getSrcType());
+				auditProecessDTO.setSalesCompanyId(Long.parseLong(expenseApplication.getBranchId()));
+				auditProecessDTO.setSalesCompanyName(expenseApplication.getBranchName());
+				auditProecessDTO.setMblno(expenseApplication.getSrcMblno());
+				auditProecessDTO.setHblno(expenseApplication.getSrcHblno());
+				BigDecimal salesPrice = expenseApplication.getFeeCenterList().stream().filter(e -> e.getDc().equals("D"))
+					.map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
+				BigDecimal costPrice = expenseApplication.getFeeCenterList().stream().filter(e -> e.getDc().equals("C"))
+					.map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
+				auditProecessDTO.setPayAmount(costPrice);
+				auditProecessDTO.setReceivableAmount(salesPrice);
+				auditProecessDTO.setGrossProfit(salesPrice.subtract(costPrice));
+				R financeProcess = auditProecessService.createFinanceProcess(auditProecessDTO);
+				if (!financeProcess.isSuccess()) {
+					throw new SecurityException("操作失败,请联系管理员");
+				}
 			}
-			for (FeeCenter item : expenseApplication.getFeeCenterList()) {
-				item.setUpdateTime(new Date());
-				item.setUpdateUser(AuthUtil.getUserId());
-				item.setUpdateUserName(AuthUtil.getUserName());
-				item.setStlPid(expenseApplication.getId());
-				item.setAuditStatus("1");
-				item.setApplyId(AuthUtil.getUserId());
-				item.setApplyName(AuthUtil.getUserName());
-				item.setApplyTime(new Date());
+		}else{
+			BusinessType businessType = bBusinessTypeService.getOne(new LambdaQueryWrapper<BusinessType>()
+				.eq(BusinessType::getTenantId, AuthUtil.getTenantId())
+				.eq(BusinessType::getIsDeleted, 0)
+				.eq(BusinessType::getStatus, 0)
+				.eq(BusinessType::getCode, "YWZD"));
+			if (businessType == null) {
+				throw new RuntimeException("未找到可用业务类型");
 			}
-			feeCenterService.updateBatchById(expenseApplication.getFeeCenterList());
-		}
-		int actId;
-		String processType;
-		String checkType;
-		if ("C".equals(expenseApplication.getDc())) {
-			actId = 1132;
-			processType = "请核费用-付费";
-			checkType = "FYSQ-C";
-		} else {
-			actId = 1130;
-			processType = "请核费用";
-			checkType = "FYSQ";
-		}
-		//审批数据
-		LosAuditProecessDTO auditProecessDTO = new LosAuditProecessDTO();
-		//获取审批级次
-		List<LosAuditPathsLevels> auditPathsLevels;
-		// 判断是否有审批流,如果审批流已开启就进入审批流,否则直接走申请通过
-		LosAuditPathsActs pathsActs;
-		//是否开启流程
-		LambdaQueryWrapper<LosAuditPathsActs> auditPathsActsLambdaQueryWrapper = new LambdaQueryWrapper<>();
-		auditPathsActsLambdaQueryWrapper
-			.eq(LosAuditPathsActs::getIsEnable, 1)
-			.eq(LosAuditPathsActs::getFidStatus, "status")
-			.eq(LosAuditPathsActs::getTenantId, AuthUtil.getTenantId())
-			.eq(LosAuditPathsActs::getSalesCompanyId, expenseApplication.getBranchId())
-			.eq(LosAuditPathsActs::getActId, actId);
-		pathsActs = auditPathsActsService.getOne(auditPathsActsLambdaQueryWrapper);
-		//获取审批信息
-		LosAuditPathsActs losAuditPathsActs = auditPathsActsService.getOne(new LambdaQueryWrapper<LosAuditPathsActs>()
-			.eq(LosAuditPathsActs::getActId, actId)
-			.eq(LosAuditPathsActs::getFidStatus, "status")
-			.eq(LosAuditPathsActs::getSalesCompanyId, expenseApplication.getBranchId())
-			.eq(LosAuditPathsActs::getTenantId, AuthUtil.getTenantId()));
-		Long pathId = losAuditPathsActs.getPathId();
-		auditPathsLevels = auditPathsLevelsService.list(new LambdaQueryWrapper<LosAuditPathsLevels>()
-			.eq(LosAuditPathsLevels::getTenantId, AuthUtil.getTenantId())
-			.eq(LosAuditPathsLevels::getPathId, pathId)
-			.eq(LosAuditPathsLevels::getSalesCompanyId, expenseApplication.getBranchId())
-		);
-		auditProecessDTO.setTimes(1);
-		auditProecessDTO.setProcessType(processType);
-		// 没开启审批流直接走 通过流程
-		if (pathsActs == null || pathsActs.getIsEnable() == 2) {
-			throw new SecurityException("当前租户未查询到审批流配置");
-		} else {
-			if (CollectionUtils.isEmpty(auditPathsLevels)) {
-				throw new SecurityException("开启审批失败:未查询到审批信息");
+			Bills bills = new Bills();
+			if ("HYJK,HYCK".contains(expenseApplication.getSrcType())) {
+				bills = billsService.getById(expenseApplication.getSrcId());
 			}
-			// 绑定审核类型
-			auditProecessDTO.setCheckType(checkType);
-			// 追加跳转路由url
-			auditProecessDTO.setUrl("/iosBasicData/feeApplication/index");
-			auditProecessDTO.setPageStatus("this.$store.getters.feeApproval");
-			auditProecessDTO.setPageLabel("费用申请(F)");
-			auditProecessDTO.setOrderRemark(expenseApplication.getRemarks());
-			List<LosAuditPathsLevels> pathsLevelsList = expenseApplication.getAuditPathsLevels();
-			if (ObjectUtils.isNotNull(pathsLevelsList) && !pathsLevelsList.isEmpty()) {
-				List<Long> idList = pathsLevelsList.stream().map(LosAuditPathsLevels::getId).collect(Collectors.toList());
-				List<LosAuditPathsLevels> levelsList = new ArrayList<>();
-				for (LosAuditPathsLevels item : auditPathsLevels) {
-					if (2 == item.getUserMold()) {
-						if (idList.contains(item.getId())) {
-							levelsList.add(item);
-						}
+			for (FeeCenter item : expenseApplication.getFeeCenterList()) {
+				if (1 == item.getAccStatus()) {
+					throw new RuntimeException("费用:" + item.getFeeCnName() + "已生成账单");
+				}
+				FinAccBills data = new FinAccBills();
+				data.setGenerationCorpId(item.getGenerationCorpId());
+				data.setGenerationCorpCnName(item.getGenerationCorpCnName());
+				data.setGenerationCorpEnName(item.getGenerationCorpEnName());
+				data.setCreateTime(new Date());
+				data.setCreateUser(AuthUtil.getUserId());
+				data.setCreateUserName(AuthUtil.getUserName());
+				if (ObjectUtils.isNull(item.getBranchId())) {
+					data.setCreateDept(AuthUtil.getDeptId());
+					R<String> res = sysClient.getDeptName(Long.parseLong(AuthUtil.getDeptId()));
+					if (res.isSuccess()) {
+						data.setCreateDeptName(res.getData());
+						data.setBranchName(res.getData());
+						data.setDeptName(res.getData());
+					}
+					data.setBranchId(item.getBranchId());
+					data.setDeptId(Long.parseLong(AuthUtil.getDeptId()));
+				} else {
+					data.setCreateDept(item.getBranchId());
+					data.setCreateDeptName(item.getBranchName());
+					data.setBranchId(item.getBranchId());
+					data.setBranchName(item.getBranchName());
+					data.setDeptId(Long.parseLong(item.getBranchId()));
+					data.setDeptName(item.getBranchName());
+				}
+				data.setBookingAgentId(item.getBookingAgentId());
+				data.setBookingAgentCnName(item.getBookingAgentCnName());
+				data.setBookingAgentEnName(item.getBookingAgentEnName());
+				data.setQuantityCntrDescr(item.getQuantityCntrDescr());
+				data.setTeu(item.getTeu());
+				BusinessBillNo businessBillNo = new BusinessBillNo();
+				businessBillNo.setBusinessTypeId(businessType.getId());
+				businessBillNo.setCode("YWZD");
+				businessBillNo.setBranchId(item.getBranchId());
+				R clientBillNo = businessBillNoService.getBillNoLos(businessBillNo);
+				if (!clientBillNo.isSuccess()) {
+					TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+					throw new RuntimeException("生成订单编号失败");
+				}
+				data.setWarehousingDate(item.getStorageDate());
+				data.setOutboundDate(item.getOutboundDate());
+				data.setBillNo((String) clientBillNo.getData());
+				data.setBillDate(new Date());
+				data.setAccountDc(item.getDc());
+				data.setAccountDate(item.getBillDate());
+				data.setBusinessType(item.getBusinessType());
+				data.setBusinessBillId(item.getPid());
+				data.setBusinessBillNo(item.getBillNo());
+				data.setBusinessDate(item.getBillDate());
+				data.setBillType(item.getBillType());
+				data.setSrcId(item.getSrcId());
+				data.setSrcCnName(item.getSrcCnName());
+				data.setSrcEnName(item.getSrcEnName());
+				data.setSrcType(item.getSrcType());
+				if (bills != null) {
+					data.setOperatorId(bills.getOperatorId());
+					data.setOperatorName(bills.getOperatorName());
+				} else {
+					data.setOperatorId(expenseApplication.getCreateUser());
+					data.setOperatorName(expenseApplication.getCreateUserName());
+				}
+				data.setPaymode(item.getPaymode());
+				data.setCorpId(item.getCorpId());
+				data.setCorpCnName(item.getCorpCnName());
+				data.setCorpEnName(item.getCorpEnName());
+				data.setBillCorpId(item.getBillCorpId());
+				data.setBillCorpCnName(item.getBillCorpCnName());
+				data.setBillCorpEnName(item.getBillCorpEnName());
+				data.setVesselId(item.getVesselId());
+				data.setVesselCnName(item.getVesselCnName());
+				data.setVesselEnName(item.getVesselEnName());
+				data.setVoyageNo(item.getVoyageNo());
+				data.setMblno(item.getMblno());
+				data.setHblno(item.getHblno());
+				data.setRefno(item.getRefno());
+				data.setBookingNo(item.getBookingNo());
+				data.setEtd(item.getEtd());
+				data.setEta(item.getEta());
+				data.setPolId(item.getPolId());
+				data.setPolCnName(item.getPolCnName());
+				data.setPolEnName(item.getPolEnName());
+				data.setPodId(item.getPodId());
+				data.setPodCnName(item.getPodCnName());
+				data.setPodCode(item.getPodCode());
+				data.setPodEnName(item.getPodEnName());
+				BigDecimal amountDrLoc = new BigDecimal("0.00");
+				BigDecimal amountCrLoc = new BigDecimal("0.00");
+				if ("CNY".equals(item.getCurCode())) {
+					if ("D".equals(item.getDc())) {
+						data.setAmountDr(item.getAmount());
+						data.setAmountCr(new BigDecimal("0.00"));
 					} else {
-						levelsList.add(item);
+						data.setAmountCr(item.getAmount());
+						data.setAmountDr(new BigDecimal("0.00"));
 					}
+					data.setAmountDrUsd(new BigDecimal("0.00"));
+					data.setAmountCrUsd(new BigDecimal("0.00"));
+				} else {
+					if ("D".equals(item.getDc())) {
+						data.setAmountDrUsd(item.getAmount());
+						data.setAmountCrUsd(new BigDecimal("0.00"));
+					} else {
+						data.setAmountDrUsd(new BigDecimal("0.00"));
+						data.setAmountCrUsd(item.getAmount());
+					}
+					data.setAmountDr(new BigDecimal("0.00"));
+					data.setAmountCr(new BigDecimal("0.00"));
 				}
-				auditProecessDTO.setPathsLevelsList(levelsList);
-			} else {
-				auditProecessDTO.setPathsLevelsList(auditPathsLevels);
-			}
-			auditProecessDTO.setActId(1);
-			auditProecessDTO.setSrcBillId(expenseApplication.getId());
-			auditProecessDTO.setBillId(expenseApplication.getSrcId());
-			auditProecessDTO.setBillNo(expenseApplication.getSrcNo());
-			auditProecessDTO.setSendUserId(AuthUtil.getUserId());
-			auditProecessDTO.setSendName(AuthUtil.getUserName());
-			auditProecessDTO.setSendTime(new Date());
-			auditProecessDTO.setBillTime(expenseApplication.getCreateTime());
-			auditProecessDTO.setTenantId(AuthUtil.getTenantId());
-			auditProecessDTO.setCorpId(expenseApplication.getCorpId());
-			auditProecessDTO.setCorpsName(expenseApplication.getCorpCnName());
-			auditProecessDTO.setReferenceNumber(expenseApplication.getSrcContainerNumber());
-			auditProecessDTO.setMorderNo(expenseApplication.getSrcMblno());
-			auditProecessDTO.setSrcBusType(expenseApplication.getSrcType());
-			auditProecessDTO.setSalesCompanyId(Long.parseLong(expenseApplication.getBranchId()));
-			auditProecessDTO.setSalesCompanyName(expenseApplication.getBranchName());
-			auditProecessDTO.setMblno(expenseApplication.getSrcMblno());
-			auditProecessDTO.setHblno(expenseApplication.getSrcHblno());
-			BigDecimal salesPrice = expenseApplication.getFeeCenterList().stream().filter(e -> e.getDc().equals("D"))
-				.map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
-			BigDecimal costPrice = expenseApplication.getFeeCenterList().stream().filter(e -> e.getDc().equals("C"))
-				.map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
-			auditProecessDTO.setPayAmount(costPrice);
-			auditProecessDTO.setReceivableAmount(salesPrice);
-			auditProecessDTO.setGrossProfit(salesPrice.subtract(costPrice));
-			R financeProcess = auditProecessService.createFinanceProcess(auditProecessDTO);
-			if (!financeProcess.isSuccess()) {
-				throw new SecurityException("操作失败,请联系管理员");
+				if (ObjectUtils.isNotNull(data.getAmountCrUsd()) && ObjectUtils.isNotNull(item.getExrate())) {
+					BigDecimal crCny = data.getAmountCrUsd().multiply(item.getExrate());
+					amountCrLoc = amountCrLoc.add(data.getAmountCr()).add(crCny);
+				}
+				if (ObjectUtils.isNotNull(data.getAmountDrUsd()) && ObjectUtils.isNotNull(item.getExrate())) {
+					BigDecimal drCny = data.getAmountDrUsd().multiply(item.getExrate());
+					amountDrLoc = amountDrLoc.add(data.getAmountDr()).add(drCny);
+				}
+				data.setAmountDrLoc(amountDrLoc);
+				data.setAmountCrLoc(amountCrLoc);
+				finAccBillsService.save(data);
+				item.setAccBillId(data.getId());
+				item.setAccBillNo(data.getBillNo());
+				item.setAccDate(data.getBillDate());
+				item.setAccAmount(amountDrLoc.add(amountCrLoc));
+				item.setAccStatus(1);
+				item.setAccById(AuthUtil.getUserId());
+				item.setAccByName(AuthUtil.getUserName());
+				item.setAuditStatus("4");
+				int version = StringUtil.isBlank(item.getVersion()) ? 1 : Integer.parseInt(item.getVersion());
+				item.setVersion(String.valueOf(version + 1));
 			}
+			feeCenterService.updateBatchById(expenseApplication.getFeeCenterList());
 		}
+
 		return R.data(expenseApplication);
 	}
 
@@ -465,13 +627,13 @@ public class ExpenseApplicationServiceImpl extends ServiceImpl<ExpenseApplicatio
 			.eq(LosAuditPathsActs::getActId, actId);
 		// 判断是否有审批流,如果审批流已开启就进入审批流,否则直接走申请通过
 		List<LosAuditPathsActs> pathsActsList = auditPathsActsService.list(auditPathsActsLambdaQueryWrapper);
-		if (pathsActsList.isEmpty()){
+		if (pathsActsList.isEmpty()) {
 			throw new RuntimeException("请先维护审批路径");
 		}
 		//获取审批级次
 		List<LosAuditPathsLevels> auditPathsLevels = auditPathsLevelsService.list(new LambdaQueryWrapper<LosAuditPathsLevels>()
 			.eq(LosAuditPathsLevels::getTenantId, AuthUtil.getTenantId()));
-		if (auditPathsLevels.isEmpty()){
+		if (auditPathsLevels.isEmpty()) {
 			throw new RuntimeException("请先维护审批人");
 		}
 		for (ExpenseApplication expenseApplication : expenseApplicationList) {
@@ -480,7 +642,7 @@ public class ExpenseApplicationServiceImpl extends ServiceImpl<ExpenseApplicatio
 			auditProecessDTO.setTimes(1);
 			auditProecessDTO.setProcessType(processType);
 			//获取审批信息
-			LosAuditPathsActs pathsActs = pathsActsList.stream().filter(e-> expenseApplication.getBranchId().equals(e.getSalesCompanyId()+""))
+			LosAuditPathsActs pathsActs = pathsActsList.stream().filter(e -> expenseApplication.getBranchId().equals(e.getSalesCompanyId() + ""))
 				.findFirst().orElse(null);
 			// 没开启审批流直接走 通过流程
 			if (pathsActs == null || pathsActs.getIsEnable() == 2) {
@@ -488,7 +650,7 @@ public class ExpenseApplicationServiceImpl extends ServiceImpl<ExpenseApplicatio
 			} else {
 				Long pathId = pathsActs.getPathId();
 				//获取审批级次
-				List<LosAuditPathsLevels> levelsList = auditPathsLevels.stream().filter(e-> e.getPathId().equals(pathId))
+				List<LosAuditPathsLevels> levelsList = auditPathsLevels.stream().filter(e -> e.getPathId().equals(pathId))
 					.collect(Collectors.toList());
 				if (CollectionUtils.isEmpty(levelsList)) {
 					throw new SecurityException("开启审批失败:未查询到审批信息");
@@ -543,53 +705,87 @@ public class ExpenseApplicationServiceImpl extends ServiceImpl<ExpenseApplicatio
 		if (ObjectUtils.isNull(expenseApplication.getFeeCenterList()) || expenseApplication.getFeeCenterList().isEmpty()) {
 			throw new RuntimeException("请选择明细");
 		}
-		List<Long> idList = expenseApplication.getFeeCenterList().stream().map(FeeCenter::getStlPid).filter(Objects::nonNull).distinct().collect(Collectors.toList());
-		if (idList.isEmpty()){
-			throw new RuntimeException("数据错误,请联系管理员");
-		}
-		List<FeeCenter> feeCenterListOld = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
-			.eq(FeeCenter::getIsDeleted, 0)
-			.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
-			.in(FeeCenter::getStlPid, idList));
-		StringBuilder text = new StringBuilder();
-		List<FeeCenter> feeCenterList = new ArrayList<>();
-		for (FeeCenter item : feeCenterListOld) {
-			if (item.getStlPid() == null) {
-				text.append("费用:").append(item.getFeeCnName()).append("金额:").append(item.getAmount()).append("未申请,");
+		String status = sysClient.getParamService("expense.application");
+		if (status.equals("1")){
+			List<Long> idList = expenseApplication.getFeeCenterList().stream().map(FeeCenter::getStlPid).filter(Objects::nonNull).distinct().collect(Collectors.toList());
+			if (idList.isEmpty()) {
+				throw new RuntimeException("数据错误,请联系管理员");
 			}
-			if (item.getStlTtlAmount().compareTo(BigDecimal.ZERO) != 0) {
-				text.append("费用:").append(item.getFeeCnName()).append("已结算");
+			List<FeeCenter> feeCenterListOld = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
+				.eq(FeeCenter::getIsDeleted, 0)
+				.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
+				.in(FeeCenter::getStlPid, idList));
+			StringBuilder text = new StringBuilder();
+			List<FeeCenter> feeCenterList = new ArrayList<>();
+			for (FeeCenter item : feeCenterListOld) {
+				if (item.getStlPid() == null) {
+					text.append("费用:").append(item.getFeeCnName()).append("金额:").append(item.getAmount()).append("未申请,");
+				}
+				if (item.getStlTtlAmount().compareTo(BigDecimal.ZERO) != 0) {
+					text.append("费用:").append(item.getFeeCnName()).append("已结算");
+				}
+				if (1 == item.getAccStatus()) {
+					feeCenterList.add(item);
+				}
 			}
-			if (1 == item.getAccStatus()) {
-				feeCenterList.add(item);
+			if (ObjectUtils.isNotNull(text.toString())) {
+				throw new RuntimeException(text.toString());
 			}
-		}
-		if (ObjectUtils.isNotNull(text.toString())) {
-			throw new RuntimeException(text.toString());
-		}
-		if (!feeCenterList.isEmpty()) {
-			FinAccBills finAccBills = new FinAccBills();
-			finAccBills.setFeeCenterList(feeCenterList);
-			finAccBillsService.revokeBill(finAccBills);
-		}
-		for (FeeCenter item : feeCenterListOld) {
-			item.setStlPid(null);
-			item.setAuditStatus("0");
-			item.setAccStatus(0);
-			item.setApplyId(0L);
-			item.setApplyName("");
-			item.setApplyTime(null);
-		}
-		feeCenterService.updateBatchById(feeCenterListOld);
-		if (idList.isEmpty()) {
-			throw new RuntimeException("未查到请核费用单据id");
-		}
-		this.removeByIds(idList);
-		for (Long item : idList) {
-			R financeProcess = auditProecessService.deteleBySrcBillId(item);
-			if (!financeProcess.isSuccess()) {
-				throw new SecurityException("操作失败,请联系管理员");
+			if (!feeCenterList.isEmpty()) {
+				FinAccBills finAccBills = new FinAccBills();
+				finAccBills.setFeeCenterList(feeCenterList);
+				finAccBillsService.revokeBill(finAccBills);
+			}
+			for (FeeCenter item : feeCenterListOld) {
+				item.setStlPid(null);
+				item.setAuditStatus("0");
+				item.setAccStatus(0);
+				item.setApplyId(0L);
+				item.setApplyName("");
+				item.setApplyTime(null);
+			}
+			feeCenterService.updateBatchById(feeCenterListOld);
+			if (idList.isEmpty()) {
+				throw new RuntimeException("未查到请核费用单据id");
+			}
+			this.removeByIds(idList);
+			for (Long item : idList) {
+				R financeProcess = auditProecessService.deteleBySrcBillId(item);
+				if (!financeProcess.isSuccess()) {
+					throw new SecurityException("操作失败,请联系管理员");
+				}
 			}
+		}else{
+			StringBuilder text = new StringBuilder();
+			List<FeeCenter> feeCenterList = new ArrayList<>();
+			for (FeeCenter item : expenseApplication.getFeeCenterList()) {
+				if (item.getStlPid() == null) {
+					text.append("费用:").append(item.getFeeCnName()).append("金额:").append(item.getAmount()).append("未申请,");
+				}
+				if (item.getStlTtlAmount().compareTo(BigDecimal.ZERO) != 0) {
+					text.append("费用:").append(item.getFeeCnName()).append("已结算");
+				}
+				if (1 == item.getAccStatus()) {
+					feeCenterList.add(item);
+				}
+			}
+			if (ObjectUtils.isNotNull(text.toString())) {
+				throw new RuntimeException(text.toString());
+			}
+			if (!feeCenterList.isEmpty()) {
+				FinAccBills finAccBills = new FinAccBills();
+				finAccBills.setFeeCenterList(feeCenterList);
+				finAccBillsService.revokeBill(finAccBills);
+			}
+			for (FeeCenter item : expenseApplication.getFeeCenterList()) {
+				item.setStlPid(null);
+				item.setAuditStatus("0");
+				item.setAccStatus(0);
+				item.setApplyId(0L);
+				item.setApplyName("");
+				item.setApplyTime(null);
+			}
+			feeCenterService.updateBatchById(expenseApplication.getFeeCenterList());
 		}
 		return R.data(expenseApplication);
 	}

+ 4 - 1
blade-service/blade-los/src/main/java/org/springblade/los/business/amends/service/impl/AmendsServiceImpl.java

@@ -145,13 +145,16 @@ public class AmendsServiceImpl extends ServiceImpl<AmendsMapper, Amends> impleme
 			businessBillNo.setBusinessTypeId(businessType.getId());
 			businessBillNo.setCode(amends.getBillNoFormat());
 			businessBillNo.setBranchId(branchId);
+			businessBillNo.setDate(amends.getEtd());
 			R clientBillNo = businessBillNoService.getBillNoLos(businessBillNo);
 			if (!clientBillNo.isSuccess()) {
 				TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
 				return R.fail(500, "生成订单编号失败");
 			}
 			amends.setBillNo((String) clientBillNo.getData());
-			amends.setCreateTime(new Date());
+			if (ObjectUtils.isNull(amends.getCreateTime())){
+				amends.setCreateTime(new Date());
+			}
 			amends.setCreateUser(AuthUtil.getUserId());
 			amends.setCreateUserName(AuthUtil.getUserName());
 			amends.setBranchId(branchId);

+ 8 - 6
blade-service/blade-los/src/main/java/org/springblade/los/business/sea/service/impl/BillsServiceImpl.java

@@ -243,6 +243,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 			businessBillNo.setBusinessTypeId(businessType.getId());
 			businessBillNo.setCode(bills.getBillNoFormat());
 			businessBillNo.setBranchId(bills.getBranchId());
+			businessBillNo.setDate(bills.getBillDate());
 			R clientBillNo = businessBillNoService.getBillNoLos(businessBillNo);
 			if (!clientBillNo.isSuccess()) {
 				TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
@@ -4825,6 +4826,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 			businessBillNo.setBusinessTypeId(businessType.getId());
 			businessBillNo.setCode(bills.getBillNoFormat());
 			businessBillNo.setBranchId(bills.getBranchId());
+			businessBillNo.setDate(bills.getEtd());
 			R clientBillNo = businessBillNoService.getBillNoLos(businessBillNo);
 			if (!clientBillNo.isSuccess()) {
 				TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
@@ -6158,17 +6160,17 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 			feeCenter.setShortName(bills.getShortName());
 			feeCenter.setPrice(items.getOceanFreight());
 		} else if ("2".equals(type)) {
-			BCorps bCorps = bCorpsService.getOne(new LambdaQueryWrapper<BCorps>()
+		/*	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.setCorpId(bills.getCarrierId());
+			feeCenter.setCorpCnName(bills.getCarrierCnName());
+			feeCenter.setCorpEnName(bills.getCarrierEnName());
+			feeCenter.setShortName(bills.getCarrierShortName());
 			feeCenter.setPrice(items.getCostPrice());
 		}
 		feeCenter.setAmount(feeCenter.getPrice().multiply(feeCenter.getQuantity()));

+ 9 - 0
blade-service/blade-los/src/main/java/org/springblade/los/check/service/impl/AuditProecessServiceImpl.java

@@ -2021,6 +2021,9 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
 			feeCenter.setCorpCnName(feeCenterUpdateRecord.getCorpCnNameUpdate());
 			feeCenter.setCorpEnName(feeCenterUpdateRecord.getCorpEnNameUpdate());
 			feeCenter.setShortName(feeCenterUpdateRecord.getShortNameUpdate());
+			feeCenter.setGenerationCorpId(feeCenterUpdateRecord.getGenerationCorpIdUpdate());
+			feeCenter.setGenerationCorpCnName(feeCenterUpdateRecord.getGenerationCorpCnNameUpdate());
+			feeCenter.setGenerationCorpEnName(feeCenterUpdateRecord.getGenerationCorpEnNameUpdate());
 			feeCenter.setCorpType(feeCenterUpdateRecord.getCorpTypeUpdate());
 			feeCenter.setFeeId(feeCenterUpdateRecord.getFeeIdUpdate());
 			feeCenter.setFeeCode(feeCenterUpdateRecord.getFeeCodeUpdate());
@@ -2067,6 +2070,9 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
 			finAccBills.setCorpId(feeCenterUpdateRecord.getCorpIdUpdate());
 			finAccBills.setCorpCnName(feeCenterUpdateRecord.getCorpCnNameUpdate());
 			finAccBills.setCorpEnName(feeCenterUpdateRecord.getCorpEnNameUpdate());
+			finAccBills.setGenerationCorpId(feeCenterUpdateRecord.getGenerationCorpIdUpdate());
+			finAccBills.setGenerationCorpCnName(feeCenterUpdateRecord.getGenerationCorpCnNameUpdate());
+			finAccBills.setGenerationCorpEnName(feeCenterUpdateRecord.getGenerationCorpEnNameUpdate());
 			finAccBillsService.updateById(finAccBills);
 		}
 		if ("HYJK,HYCK".contains(feeCenter.getBusinessType())) {
@@ -2114,6 +2120,9 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
 					throw new RuntimeException("费用:" + item.getFeeCnName() + "已生成账单");
 				}
 				FinAccBills data = new FinAccBills();
+				data.setGenerationCorpId(item.getGenerationCorpId());
+				data.setGenerationCorpCnName(item.getGenerationCorpCnName());
+				data.setGenerationCorpEnName(item.getGenerationCorpEnName());
 				data.setCreateTime(new Date());
 				data.setCreateUser(AuthUtil.getUserId());
 				data.setCreateUserName(AuthUtil.getUserName());

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

@@ -299,6 +299,11 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 					if (!corpsList.isEmpty()) {
 						bCorps = corpsList.stream().filter(e -> e.getId().equals(items.getCorpId())).findFirst().orElse(null);
 					}
+					if (bCorps != null) {
+						feeCenter.setGenerationCorpId(bCorps.getBookingAgentId());
+						feeCenter.setGenerationCorpCnName(bCorps.getBookingAgentCnName());
+						feeCenter.setGenerationCorpEnName(bCorps.getBookingAgentEnName());
+					}
 					feeCenter.setCorpId(items.getCorpId());
 					feeCenter.setCorpCnName(bCorps == null ? items.getCorpCnName() : bCorps.getCorpName());
 					feeCenter.setCorpEnName(items.getCorpEnName());
@@ -309,6 +314,15 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 						feeCenter.setCorpCnName(bills.getCorpCnName());
 						feeCenter.setCorpEnName(bills.getCorpEnName());
 						feeCenter.setShortName(bills.getShortName());
+						BCorps bCorps = null;
+						if (!corpsList.isEmpty()) {
+							bCorps = corpsList.stream().filter(e -> e.getId().equals(bills.getCorpId())).findFirst().orElse(null);
+						}
+						if (bCorps != null) {
+							feeCenter.setGenerationCorpId(bCorps.getBookingAgentId());
+							feeCenter.setGenerationCorpCnName(bCorps.getBookingAgentCnName());
+							feeCenter.setGenerationCorpEnName(bCorps.getBookingAgentEnName());
+						}
 					} else if ("国外同行及代理".contains(templateItems.getCorpType())) {
 						BCorps bCorps = null;
 						if (!corpsList.isEmpty()) {
@@ -319,17 +333,36 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 							feeCenter.setCorpCnName(bills.getForeignAgencyCnName());
 							feeCenter.setCorpEnName(bills.getForeignAgencyEnName());
 							feeCenter.setShortName(bills.getForeignAgencyCnName());
+							if (!corpsList.isEmpty()) {
+								BCorps foreignAgency = corpsList.stream().filter(e -> e.getId().equals(bills.getForeignAgencyId())).findFirst().orElse(null);
+								if (foreignAgency != null) {
+									feeCenter.setGenerationCorpId(foreignAgency.getBookingAgentId());
+									feeCenter.setGenerationCorpCnName(foreignAgency.getBookingAgentCnName());
+									feeCenter.setGenerationCorpEnName(foreignAgency.getBookingAgentEnName());
+								}
+							}
 						} else {
 							feeCenter.setCorpId(bCorps.getId());
 							feeCenter.setCorpCnName(bCorps.getCnName());
 							feeCenter.setCorpEnName(bCorps.getEnName());
 							feeCenter.setShortName(bCorps.getShortName());
+							feeCenter.setGenerationCorpId(bCorps.getBookingAgentId());
+							feeCenter.setGenerationCorpCnName(bCorps.getBookingAgentCnName());
+							feeCenter.setGenerationCorpEnName(bCorps.getBookingAgentEnName());
 						}
 					} else if ("船公司".contains(templateItems.getCorpType())) {
 						feeCenter.setCorpId(bills.getCarrierId());
 						feeCenter.setCorpCnName(bills.getCarrierCnName());
 						feeCenter.setCorpEnName(bills.getCarrierEnName());
 						feeCenter.setShortName(bills.getCarrierShortName());
+						if (!corpsList.isEmpty()) {
+							BCorps carrier = corpsList.stream().filter(e -> e.getId().equals(bills.getCarrierId())).findFirst().orElse(null);
+							if (carrier != null) {
+								feeCenter.setGenerationCorpId(carrier.getBookingAgentId());
+								feeCenter.setGenerationCorpCnName(carrier.getBookingAgentCnName());
+								feeCenter.setGenerationCorpEnName(carrier.getBookingAgentEnName());
+							}
+						}
 					} else if ("场站".contains(templateItems.getCorpType())) {
 						BCorps bCorps = null;
 						if (!corpsList.isEmpty()) {
@@ -339,6 +372,11 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 						feeCenter.setCorpCnName(bCorps == null ? bills.getCyCnName() : bCorps.getCorpName());
 						feeCenter.setCorpEnName(bills.getCyEnName());
 						feeCenter.setShortName(bCorps == null ? bills.getCyCnName() : bCorps.getShortName());
+						if (bCorps != null) {
+							feeCenter.setGenerationCorpId(bCorps.getBookingAgentId());
+							feeCenter.setGenerationCorpCnName(bCorps.getBookingAgentCnName());
+							feeCenter.setGenerationCorpEnName(bCorps.getBookingAgentEnName());
+						}
 					} else if ("船代".contains(templateItems.getCorpType())) {
 						BCorps bCorps = null;
 						if (!corpsList.isEmpty()) {
@@ -349,11 +387,22 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 							feeCenter.setCorpCnName(bills.getShippingAgencyCname());
 							feeCenter.setCorpEnName(bills.getShippingAgencyEname());
 							feeCenter.setShortName(bills.getShippingAgencyCname());
+							if (!corpsList.isEmpty()) {
+								BCorps shippingAgency = corpsList.stream().filter(e -> e.getId().equals(bills.getShippingAgencyId())).findFirst().orElse(null);
+								if (shippingAgency != null) {
+									feeCenter.setGenerationCorpId(shippingAgency.getBookingAgentId());
+									feeCenter.setGenerationCorpCnName(shippingAgency.getBookingAgentCnName());
+									feeCenter.setGenerationCorpEnName(shippingAgency.getBookingAgentEnName());
+								}
+							}
 						} else {
 							feeCenter.setCorpId(bCorps.getId());
 							feeCenter.setCorpCnName(bCorps.getCnName());
 							feeCenter.setCorpEnName(bCorps.getEnName());
 							feeCenter.setShortName(bCorps.getShortName());
+							feeCenter.setGenerationCorpId(bCorps.getBookingAgentId());
+							feeCenter.setGenerationCorpCnName(bCorps.getBookingAgentCnName());
+							feeCenter.setGenerationCorpEnName(bCorps.getBookingAgentEnName());
 						}
 					} else {
 						BCorps bCorps = null;
@@ -364,6 +413,11 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 						feeCenter.setCorpCnName(bCorps == null ? items.getCorpCnName() : bCorps.getCnName());
 						feeCenter.setCorpEnName(items.getCorpEnName());
 						feeCenter.setShortName(bCorps == null ? items.getCorpCnName() : bCorps.getShortName());
+						if (bCorps != null) {
+							feeCenter.setGenerationCorpId(bCorps.getBookingAgentId());
+							feeCenter.setGenerationCorpCnName(bCorps.getBookingAgentCnName());
+							feeCenter.setGenerationCorpEnName(bCorps.getBookingAgentEnName());
+						}
 					}
 				}
 
@@ -682,9 +736,21 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 				}
 			}
 			String exrateType = currencyUtils.standardCurrency(bills.getBranchId());
+			List<Long> corpList = list.stream().map(FeeCenter::getCorpId).distinct()
+				.filter(Objects::nonNull).collect(Collectors.toList());
+			if (ObjectUtils.isNull(corpList)) {
+				corpList = new ArrayList<>();
+			} else {
+				List<Long> billCorpList = list.stream().map(FeeCenter::getBillCorpId).distinct()
+					.filter(Objects::nonNull).collect(Collectors.toList());
+				if (!billCorpList.isEmpty()) {
+					corpList.addAll(billCorpList);
+				}
+			}
 			List<BCorps> bCorpsList = bCorpsService.list(new LambdaQueryWrapper<BCorps>()
 				.eq(BCorps::getTenantId, AuthUtil.getTenantId())
-				.eq(BCorps::getIsDeleted, 0));
+				.eq(BCorps::getIsDeleted, 0)
+				.in(BCorps::getId, corpList));
 			List<Long> idList = list.stream().map(FeeCenter::getId).filter(Objects::nonNull).collect(Collectors.toList());
 			List<FeeCenter> feeCenters = new ArrayList<>();
 			if (!idList.isEmpty()) {
@@ -702,11 +768,14 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 					BCorps bCorps = bCorpsList.stream().filter(e -> e.getId().equals(feeCenter.getCorpId())).findFirst().orElse(null);
 					if (bCorps != null) {
 						feeCenter.setShortName(bCorps.getShortName());
+						if (ObjectUtils.isNull(feeCenter.getGenerationCorpId()) || 0 == feeCenter.getGenerationCorpId()) {
+							feeCenter.setGenerationCorpId(bCorps.getBookingAgentId());
+							feeCenter.setGenerationCorpCnName(bCorps.getBookingAgentCnName());
+							feeCenter.setGenerationCorpEnName(bCorps.getBookingAgentEnName());
+						}
 					}
-					BCorps bCorps1 = bCorpsList.stream().filter(e -> e.getId().equals(feeCenter.getBillCorpId())).findFirst().orElse(null);
-					if (bCorps1 != null) {
-						feeCenter.setBillCorpEnName(bCorps1.getShortName());
-					}
+					bCorpsList.stream().filter(e -> e.getId().equals(feeCenter.getBillCorpId()))
+						.findFirst().ifPresent(bCorps1 -> feeCenter.setBillCorpEnName(bCorps1.getShortName()));
 				}
 				if (feeCenter.getId() == null) {
 					feeCenter.setCreateTime(new Date());
@@ -1005,9 +1074,6 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public R submitListBox(List<FeeCenter> list) {
-		List<BCorps> bCorpsList = bCorpsService.list(new LambdaQueryWrapper<BCorps>()
-			.eq(BCorps::getTenantId, AuthUtil.getTenantId())
-			.eq(BCorps::getIsDeleted, 0));
 		List<FeeCenter> feeCenterList = new ArrayList<>();
 		if (ObjectUtils.isNotNull(list) && !list.isEmpty()) {
 			TradingBox tradingBox = tradingBoxMapper.selectById(list.get(0).getPid());
@@ -1048,6 +1114,21 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 					deptName = res.getData();
 				}
 			}
+			List<Long> corpList = list.stream().map(FeeCenter::getCorpId).distinct()
+				.filter(Objects::nonNull).collect(Collectors.toList());
+			if (ObjectUtils.isNull(corpList)) {
+				corpList = new ArrayList<>();
+			} else {
+				List<Long> billCorpList = list.stream().map(FeeCenter::getBillCorpId).distinct()
+					.filter(Objects::nonNull).collect(Collectors.toList());
+				if (!billCorpList.isEmpty()) {
+					corpList.addAll(billCorpList);
+				}
+			}
+			List<BCorps> bCorpsList = bCorpsService.list(new LambdaQueryWrapper<BCorps>()
+				.eq(BCorps::getTenantId, AuthUtil.getTenantId())
+				.eq(BCorps::getIsDeleted, 0)
+				.in(BCorps::getId, corpList));
 			String exrateType = currencyUtils.standardCurrency(branchId);
 			List<Long> idList = list.stream().map(FeeCenter::getId).filter(Objects::nonNull).collect(Collectors.toList());
 			List<FeeCenter> feeCenterList1 = new ArrayList<>();
@@ -1098,6 +1179,11 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 					BCorps bCorps = bCorpsList.stream().filter(e -> e.getId().equals(feeCenter.getCorpId())).findFirst().orElse(null);
 					if (bCorps != null) {
 						feeCenter.setShortName(bCorps.getShortName());
+						if (ObjectUtils.isNull(feeCenter.getGenerationCorpId()) || 0 == feeCenter.getGenerationCorpId()) {
+							feeCenter.setGenerationCorpId(bCorps.getBookingAgentId());
+							feeCenter.setGenerationCorpCnName(bCorps.getBookingAgentCnName());
+							feeCenter.setGenerationCorpEnName(bCorps.getBookingAgentEnName());
+						}
 					}
 					BCorps bCorps1 = bCorpsList.stream().filter(e -> e.getId().equals(feeCenter.getBillCorpId())).findFirst().orElse(null);
 					if (bCorps1 != null) {
@@ -1301,6 +1387,11 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 					if (!corpsList.isEmpty()) {
 						bCorps = corpsList.stream().filter(e -> e.getId().equals(items.getCorpId())).findFirst().orElse(null);
 					}
+					if (bCorps != null) {
+						feeCenter.setGenerationCorpId(bCorps.getBookingAgentId());
+						feeCenter.setGenerationCorpCnName(bCorps.getBookingAgentCnName());
+						feeCenter.setGenerationCorpEnName(bCorps.getBookingAgentEnName());
+					}
 					feeCenter.setCorpId(items.getCorpId());
 					feeCenter.setCorpCnName(bCorps == null ? items.getCorpCnName() : bCorps.getCnName());
 					feeCenter.setCorpEnName(items.getCorpEnName());
@@ -1311,6 +1402,15 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 						feeCenter.setCorpCnName(bills.getShortName());
 						feeCenter.setCorpEnName(bills.getCorpEnName());
 						feeCenter.setShortName(bills.getShortName());
+						BCorps bCorps = null;
+						if (!corpsList.isEmpty()) {
+							bCorps = corpsList.stream().filter(e -> e.getId().equals(bills.getCorpId())).findFirst().orElse(null);
+						}
+						if (bCorps != null) {
+							feeCenter.setGenerationCorpId(bCorps.getBookingAgentId());
+							feeCenter.setGenerationCorpCnName(bCorps.getBookingAgentCnName());
+							feeCenter.setGenerationCorpEnName(bCorps.getBookingAgentEnName());
+						}
 					} else if ("国外同行及代理".contains(templateItems.getCorpType())) {
 						BCorps bCorps = null;
 						if (!corpsList.isEmpty()) {
@@ -1321,17 +1421,36 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 							feeCenter.setCorpCnName(bills.getForeignAgencyCnName());
 							feeCenter.setCorpEnName(bills.getForeignAgencyEnName());
 							feeCenter.setShortName(bills.getForeignAgencyCnName());
+							if (!corpsList.isEmpty()) {
+								BCorps foreignAgency = corpsList.stream().filter(e -> e.getId().equals(bills.getForeignAgencyId())).findFirst().orElse(null);
+								if (foreignAgency != null) {
+									feeCenter.setGenerationCorpId(foreignAgency.getBookingAgentId());
+									feeCenter.setGenerationCorpCnName(foreignAgency.getBookingAgentCnName());
+									feeCenter.setGenerationCorpEnName(foreignAgency.getBookingAgentEnName());
+								}
+							}
 						} else {
 							feeCenter.setCorpId(bCorps.getId());
 							feeCenter.setCorpCnName(bCorps.getCnName());
 							feeCenter.setCorpEnName(bCorps.getEnName());
 							feeCenter.setShortName(bCorps.getShortName());
+							feeCenter.setGenerationCorpId(bCorps.getBookingAgentId());
+							feeCenter.setGenerationCorpCnName(bCorps.getBookingAgentCnName());
+							feeCenter.setGenerationCorpEnName(bCorps.getBookingAgentEnName());
 						}
 					} else if ("船公司".contains(templateItems.getCorpType())) {
 						feeCenter.setCorpId(bills.getCarrierId());
 						feeCenter.setCorpCnName(bills.getCarrierCnName());
 						feeCenter.setCorpEnName(bills.getCarrierEnName());
 						feeCenter.setShortName(bills.getCarrierShortName());
+						if (!corpsList.isEmpty()) {
+							BCorps carrier = corpsList.stream().filter(e -> e.getId().equals(bills.getCarrierId())).findFirst().orElse(null);
+							if (carrier != null) {
+								feeCenter.setGenerationCorpId(carrier.getBookingAgentId());
+								feeCenter.setGenerationCorpCnName(carrier.getBookingAgentCnName());
+								feeCenter.setGenerationCorpEnName(carrier.getBookingAgentEnName());
+							}
+						}
 					} else if ("场站".contains(templateItems.getCorpType())) {
 						BCorps bCorps = null;
 						if (!corpsList.isEmpty()) {
@@ -1341,6 +1460,11 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 						feeCenter.setCorpCnName(bCorps == null ? bills.getCyCnName() : bCorps.getCnName());
 						feeCenter.setCorpEnName(bills.getCyEnName());
 						feeCenter.setShortName(bCorps == null ? bills.getCyCnName() : bCorps.getShortName());
+						if (bCorps != null) {
+							feeCenter.setGenerationCorpId(bCorps.getBookingAgentId());
+							feeCenter.setGenerationCorpCnName(bCorps.getBookingAgentCnName());
+							feeCenter.setGenerationCorpEnName(bCorps.getBookingAgentEnName());
+						}
 					} else if ("船代".contains(templateItems.getCorpType())) {
 						BCorps bCorps = null;
 						if (!corpsList.isEmpty()) {
@@ -1351,11 +1475,22 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 							feeCenter.setCorpCnName(bills.getShippingAgencyCname());
 							feeCenter.setCorpEnName(bills.getShippingAgencyEname());
 							feeCenter.setShortName(bills.getShippingAgencyCname());
+							if (!corpsList.isEmpty()) {
+								BCorps shippingAgency = corpsList.stream().filter(e -> e.getId().equals(bills.getShippingAgencyId())).findFirst().orElse(null);
+								if (shippingAgency != null) {
+									feeCenter.setGenerationCorpId(shippingAgency.getBookingAgentId());
+									feeCenter.setGenerationCorpCnName(shippingAgency.getBookingAgentCnName());
+									feeCenter.setGenerationCorpEnName(shippingAgency.getBookingAgentEnName());
+								}
+							}
 						} else {
 							feeCenter.setCorpId(bCorps.getId());
 							feeCenter.setCorpCnName(bCorps.getCnName());
 							feeCenter.setCorpEnName(bCorps.getEnName());
 							feeCenter.setShortName(bCorps.getShortName());
+							feeCenter.setGenerationCorpId(bCorps.getBookingAgentId());
+							feeCenter.setGenerationCorpCnName(bCorps.getBookingAgentCnName());
+							feeCenter.setGenerationCorpEnName(bCorps.getBookingAgentEnName());
 						}
 					} else {
 						BCorps bCorps = null;
@@ -1366,6 +1501,11 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 						feeCenter.setCorpCnName(bCorps == null ? items.getCorpCnName() : bCorps.getCnName());
 						feeCenter.setCorpEnName(items.getCorpEnName());
 						feeCenter.setShortName(bCorps == null ? items.getCorpCnName() : bCorps.getShortName());
+						if (bCorps != null) {
+							feeCenter.setGenerationCorpId(bCorps.getBookingAgentId());
+							feeCenter.setGenerationCorpCnName(bCorps.getBookingAgentCnName());
+							feeCenter.setGenerationCorpEnName(bCorps.getBookingAgentEnName());
+						}
 					}
 				}
 				feeCenter.setFeeId(items.getFeeId());
@@ -1698,6 +1838,9 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 								feeCenterC.setCorpCnName(bCorps.getCnName());
 								feeCenterC.setCorpEnName(bCorps.getEnName());
 								feeCenterC.setShortName(bCorps.getShortName());
+								feeCenterC.setGenerationCorpId(bCorps.getBookingAgentId());
+								feeCenterC.setGenerationCorpCnName(bCorps.getBookingAgentCnName());
+								feeCenterC.setGenerationCorpEnName(bCorps.getBookingAgentEnName());
 								feeCenterC.setQuantity(feeCenter.getQuantity());
 								if ("按收入".equals(agencyFeeCountWay)) {
 									feeCenterC.setPrice(feeCenter.getPrice().subtract(feeCenter.getPrice().multiply(new BigDecimal(agencyFee))
@@ -1801,6 +1944,9 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 							feeCenterD.setCorpCnName(corps.getCnName());
 							feeCenterD.setCorpEnName(corps.getEnName());
 							feeCenterD.setShortName(corps.getShortName());
+							feeCenterD.setGenerationCorpId(corps.getBookingAgentId());
+							feeCenterD.setGenerationCorpCnName(corps.getBookingAgentCnName());
+							feeCenterD.setGenerationCorpEnName(corps.getBookingAgentEnName());
 							feeCenterD.setQuantity(new BigDecimal("1"));
 							feeCenterD.setPrice(amount);
 							feeCenterD.setAmount(amount);
@@ -2289,6 +2435,12 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 				return null;
 			}
 		}
+		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"));
@@ -2427,6 +2579,12 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 			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"));

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

@@ -172,6 +172,9 @@ public class FinAccBillsServiceImpl extends ServiceImpl<FinAccBillsMapper, FinAc
 					&& !exrateType.equals(e.getCurCode()))
 				.map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
 			FinAccBills data = new FinAccBills();
+			data.setGenerationCorpId(item.getGenerationCorpId());
+			data.setGenerationCorpCnName(item.getGenerationCorpCnName());
+			data.setGenerationCorpEnName(item.getGenerationCorpEnName());
 			data.setCreateTime(new Date());
 			data.setCreateUser(AuthUtil.getUserId());
 			data.setCreateUserName(AuthUtil.getUserName());

+ 9 - 0
blade-service/blade-los/src/main/java/org/springblade/los/finance/invoices/controller/FinInvoicesController.java

@@ -155,6 +155,15 @@ public class FinInvoicesController extends BladeController {
 		return finInvoicesService.submit(finInvoices);
 	}
 
+	/**
+	 * 新增或修改 业务-发票主表
+	 */
+	@PostMapping("/add")
+	@RepeatSubmit
+	public R add(@Valid @RequestBody FinInvoices finInvoices) {
+		return finInvoicesService.add(finInvoices);
+	}
+
 
 	/**
 	 * 删除 业务-发票主表

+ 2 - 0
blade-service/blade-los/src/main/java/org/springblade/los/finance/invoices/service/IFinInvoicesService.java

@@ -133,4 +133,6 @@ public interface IFinInvoicesService extends IService<FinInvoices> {
 	R generateFinStlBillsV1(String billId, Date date);
 
 	R revokeGenerateFinStlBillsV1(String billId);
+
+	R add(FinInvoices finInvoices);
 }

+ 59 - 0
blade-service/blade-los/src/main/java/org/springblade/los/finance/invoices/service/impl/FinInvoicesServiceImpl.java

@@ -144,6 +144,7 @@ public class FinInvoicesServiceImpl extends ServiceImpl<FinInvoicesMapper, FinIn
 			businessBillNo.setBusinessTypeId(businessType.getId());
 			businessBillNo.setCode(finInvoices.getBillNoFormat());
 			businessBillNo.setBranchId(branchId);
+			businessBillNo.setDate(finInvoices.getInvoiceDate());
 			R clientBillNo = businessBillNoService.getBillNoLos(businessBillNo);
 			if (!clientBillNo.isSuccess()) {
 				TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
@@ -2299,6 +2300,8 @@ public class FinInvoicesServiceImpl extends ServiceImpl<FinInvoicesMapper, FinIn
 				finStlBillsItems.setUpdateUser(null);
 				finStlBillsItems.setUpdateTime(null);
 				finStlBillsItems.setUpdateUserName(null);
+				finStlBillsItems.setCurCode(item.getCurCode());
+				finStlBillsItems.setCurrentStlCurCode(item.getCurCode());
 				finStlBillsItems.setCurrentStlAmountNet(item.getCurrentAmountNet());
 				finStlBillsItems.setCurrentStlAmount(item.getCurrentAmount());
 				finStlBillsItems.setCurrentStlAmountLoc(item.getCurrentAmount().multiply(item.getExrate()).setScale(2, RoundingMode.HALF_UP));
@@ -2679,6 +2682,62 @@ public class FinInvoicesServiceImpl extends ServiceImpl<FinInvoicesMapper, FinIn
 		return R.data(finStlBills);
 	}
 
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public R add(FinInvoices finInvoices) {
+		String deptId;
+		String branchId;
+		String deptName = "";
+		if (ObjectUtils.isNull(finInvoices.getBranchId())) {
+			deptId = AuthUtil.getDeptId();
+			branchId = AuthUtil.getDeptId();
+		} else {
+			deptId = finInvoices.getBranchId();
+			branchId = finInvoices.getBranchId();
+		}
+		String exrateType = currencyUtils.standardCurrency(branchId);
+		//获取部门ids对应中文名
+		R<String> res = sysClient.getDeptName(Long.parseLong(branchId));
+		if (res.isSuccess() && ObjectUtils.isNotNull(res.getData())) {
+			deptName = res.getData();
+		}
+		if (finInvoices.getId() == null) {
+			BusinessType businessType = bBusinessTypeService.getOne(new LambdaQueryWrapper<BusinessType>()
+				.eq(BusinessType::getTenantId, AuthUtil.getTenantId())
+				.eq(BusinessType::getIsDeleted, 0)
+				.eq(BusinessType::getStatus, 0)
+				.eq(BusinessType::getCode, finInvoices.getBusinessTypeCode()));
+			if (businessType == null) {
+				throw new RuntimeException("未找到可用业务类型");
+			}
+			BusinessBillNo businessBillNo = new BusinessBillNo();
+			businessBillNo.setBusinessTypeId(businessType.getId());
+			businessBillNo.setCode(finInvoices.getBillNoFormat());
+			businessBillNo.setBranchId(branchId);
+			businessBillNo.setDate(finInvoices.getInvoiceDate());
+			R clientBillNo = businessBillNoService.getBillNoLos(businessBillNo);
+			if (!clientBillNo.isSuccess()) {
+				TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+				return R.fail(500, "生成订单编号失败");
+			}
+			finInvoices.setBillNo((String) clientBillNo.getData());
+			finInvoices.setCreateTime(new Date());
+			finInvoices.setCreateUser(AuthUtil.getUserId());
+			finInvoices.setCreateUserName(AuthUtil.getUserName());
+			if (ObjectUtils.isNotNull(AuthUtil.getDeptId())) {
+				finInvoices.setCreateDept(deptId);
+				finInvoices.setBranchId(branchId);
+				finInvoices.setCreateDeptName(deptName);
+			}
+		} else {
+			finInvoices.setUpdateUser(AuthUtil.getUserId());
+			finInvoices.setUpdateTime(new Date());
+			finInvoices.setUpdateUserName(AuthUtil.getUserName());
+		}
+		this.saveOrUpdate(finInvoices);
+		return R.data(finInvoices);
+	}
+
 	private void countFeeItems(FinInvoices reconciliation, List<FinInvoicesItems> finStlBillsItemsList, String exrateType) {
 		BigDecimal amountCnyD = new BigDecimal("0.00");
 		BigDecimal amountUsdD = new BigDecimal("0.00");

+ 9 - 0
blade-service/blade-los/src/main/java/org/springblade/los/finance/stl/controller/FinStlBillsController.java

@@ -174,6 +174,15 @@ public class FinStlBillsController extends BladeController {
 	}
 
 	/**
+	 * 新增或修改 业务-财务对账单和结算
+	 */
+	@PostMapping("/add")
+	@RepeatSubmit
+	public R add(@Valid @RequestBody FinStlBills finStlBills) {
+		return finStlBillsService.add(finStlBills);
+	}
+
+	/**
 	 * 财务对账单 确认
 	 */
 	@PostMapping("/confirmReconciliation")

+ 2 - 0
blade-service/blade-los/src/main/java/org/springblade/los/finance/stl/service/IFinStlBillsService.java

@@ -130,4 +130,6 @@ public interface IFinStlBillsService extends IService<FinStlBills> {
 	R confirmSettlementV1(FinStlBills finStlBills);
 
 	R revokeSettlementV1(FinStlBills finStlBills);
+
+	R add(FinStlBills finStlBills);
 }

+ 99 - 0
blade-service/blade-los/src/main/java/org/springblade/los/finance/stl/service/impl/FinStlBillsServiceImpl.java

@@ -203,6 +203,7 @@ public class FinStlBillsServiceImpl extends ServiceImpl<FinStlBillsMapper, FinSt
 			businessBillNo.setBusinessTypeId(businessType.getId());
 			businessBillNo.setCode(finStlBills.getBillNoFormat());
 			businessBillNo.setBranchId(branchId);
+			businessBillNo.setDate(finStlBills.getBillDate());
 			R<String> clientBillNo = businessBillNoService.getBillNoLos(businessBillNo);
 			if (!clientBillNo.isSuccess()) {
 				TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
@@ -3949,4 +3950,102 @@ public class FinStlBillsServiceImpl extends ServiceImpl<FinStlBillsMapper, FinSt
 		return R.data(detail);
 	}
 
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public R add(FinStlBills finStlBills) {
+		String deptId;
+		String branchId;
+		String deptName = "";
+		if (ObjectUtils.isNull(finStlBills.getBranchId())) {
+			deptId = AuthUtil.getDeptId();
+			branchId = AuthUtil.getDeptId();
+		} else {
+			deptId = finStlBills.getBranchId();
+			branchId = finStlBills.getBranchId();
+		}
+		String exrateType = currencyUtils.standardCurrency(branchId);
+		//获取部门ids对应中文名
+		R<String> res = sysClient.getDeptName(Long.parseLong(branchId));
+		if (res.isSuccess() && ObjectUtils.isNotNull(res.getData())) {
+			deptName = res.getData();
+		}
+		if (ObjectUtils.isNull(finStlBills.getBillDate())) {
+			finStlBills.setBillDate(new Date());
+		}
+		if (ObjectUtils.isNotNull(finStlBills.getBillDate()) && "STL,FFSQ".contains(finStlBills.getBusinessType())) {
+			LocalDate date = finStlBills.getBillDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
+			int year = date.getYear();
+			int month = date.getMonthValue();
+			FinPeriod finPeriod = finPeriodMapper.selectOne(new LambdaQueryWrapper<FinPeriod>()
+				.eq(FinPeriod::getTenantId, AuthUtil.getTenantId())
+				.eq(FinPeriod::getBranchId, finStlBills.getBillDate())
+				.eq(FinPeriod::getIsDeleted, 0)
+				.eq(FinPeriod::getPeriodYear, year)
+				.eq(FinPeriod::getPeriodMonth, month));
+			if (finPeriod != null) {
+				if (1 == finPeriod.getIsClosed()) {
+					throw new RuntimeException(year + "年" + month + "月账期已结转,保存失败");
+				}
+				if (1 == finPeriod.getLockingStatus()) {
+					throw new RuntimeException(year + "年" + month + "月账期已锁定,保存失败");
+				}
+			}
+		}
+		if (finStlBills.getId() == null) {
+			finStlBills.setWhetherManual("1");
+			BusinessType businessType = bBusinessTypeService.getOne(new LambdaQueryWrapper<BusinessType>()
+				.eq(BusinessType::getTenantId, AuthUtil.getTenantId())
+				.eq(BusinessType::getIsDeleted, 0)
+				.eq(BusinessType::getStatus, 0)
+				.eq(BusinessType::getCode, finStlBills.getBusinessTypeCode()));
+			if (businessType == null) {
+				throw new RuntimeException("未找到可用业务类型");
+			}
+			BusinessBillNo businessBillNo = new BusinessBillNo();
+			businessBillNo.setBusinessTypeId(businessType.getId());
+			businessBillNo.setCode(finStlBills.getBillNoFormat());
+			businessBillNo.setBranchId(branchId);
+			businessBillNo.setDate(finStlBills.getBillDate());
+			R<String> clientBillNo = businessBillNoService.getBillNoLos(businessBillNo);
+			if (!clientBillNo.isSuccess()) {
+				TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+				return R.fail(500, "生成订单编号失败");
+			}
+			finStlBills.setBillNo((String) clientBillNo.getData());
+			List<FinStlBills> finStlBillsList = baseMapper.selectList(new LambdaQueryWrapper<FinStlBills>()
+				.eq(FinStlBills::getBranchId, finStlBills.getBranchId())
+				.eq(FinStlBills::getTenantId, AuthUtil.getTenantId())
+				.eq(FinStlBills::getIsDeleted, 0)
+				.eq(FinStlBills::getBillNo, finStlBills.getBillNo())
+			);
+			if (!finStlBillsList.isEmpty()) {
+				throw new RuntimeException("订单编号重复,请重新保存");
+			}
+			finStlBills.setCreateTime(new Date());
+			finStlBills.setCreateUser(AuthUtil.getUserId());
+			finStlBills.setCreateUserName(AuthUtil.getUserName());
+			if (ObjectUtils.isNotNull(AuthUtil.getDeptId())) {
+				finStlBills.setCreateDept(deptId);
+				finStlBills.setBranchId(branchId);
+				finStlBills.setCreateDeptName(deptName);
+			}
+		} else {
+			List<FinStlBills> finStlBillsList = baseMapper.selectList(new LambdaQueryWrapper<FinStlBills>()
+				.eq(FinStlBills::getBranchId, finStlBills.getBranchId())
+				.eq(FinStlBills::getTenantId, AuthUtil.getTenantId())
+				.eq(FinStlBills::getIsDeleted, 0)
+				.ne(FinStlBills::getId, finStlBills.getId())
+				.eq(FinStlBills::getBillNo, finStlBills.getBillNo())
+			);
+			if (!finStlBillsList.isEmpty()) {
+				throw new RuntimeException("订单编号重复,请重新创建单据");
+			}
+			finStlBills.setUpdateUser(AuthUtil.getUserId());
+			finStlBills.setUpdateTime(new Date());
+			finStlBills.setUpdateUserName(AuthUtil.getUserName());
+		}
+		this.saveOrUpdate(finStlBills);
+		return R.data(finStlBills);
+	}
+
 }