Browse Source

2024年2月27日17:31:48

纪新园 1 year ago
parent
commit
3e3bed1327
19 changed files with 1291 additions and 28 deletions
  1. 1 1
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/basic/acc/entity/AccItemsOpenblc.java
  2. 6 1
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/basic/business/entity/BusinessType.java
  3. 34 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/basic/voucher/dto/VoucherTemplateDTO.java
  4. 182 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/basic/voucher/entity/VoucherTemplate.java
  5. 36 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/basic/voucher/vo/VoucherTemplateVO.java
  6. 12 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/business/aea/entity/AeaBills.java
  7. 12 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/business/amends/entity/Amends.java
  8. 12 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/business/customsDeclaration/entity/CustomsDeclaration.java
  9. 40 11
      blade-service/blade-los/src/main/java/org/springblade/los/basic/acc/controller/AccountsController.java
  10. 7 0
      blade-service/blade-los/src/main/java/org/springblade/los/basic/acc/service/IAccountsService.java
  11. 44 3
      blade-service/blade-los/src/main/java/org/springblade/los/basic/acc/service/impl/AccountsServiceImpl.java
  12. 1 0
      blade-service/blade-los/src/main/java/org/springblade/los/basic/business/controller/BusinessTypeController.java
  13. 152 0
      blade-service/blade-los/src/main/java/org/springblade/los/basic/voucher/controller/VoucherTemplateController.java
  14. 42 0
      blade-service/blade-los/src/main/java/org/springblade/los/basic/voucher/mapper/VoucherTemplateMapper.java
  15. 40 0
      blade-service/blade-los/src/main/java/org/springblade/los/basic/voucher/mapper/VoucherTemplateMapper.xml
  16. 65 0
      blade-service/blade-los/src/main/java/org/springblade/los/basic/voucher/service/IVoucherTemplateService.java
  17. 224 0
      blade-service/blade-los/src/main/java/org/springblade/los/basic/voucher/service/impl/VoucherTemplateServiceImpl.java
  18. 2 2
      blade-service/blade-los/src/main/java/org/springblade/los/business/sea/controller/BillsController.java
  19. 379 10
      blade-service/blade-los/src/main/java/org/springblade/los/check/service/impl/AuditProecessServiceImpl.java

+ 1 - 1
blade-service-api/blade-los-api/src/main/java/org/springblade/los/basic/acc/entity/AccItemsOpenblc.java

@@ -98,7 +98,7 @@ public class AccItemsOpenblc implements Serializable {
 	 * 科目代码
 	 */
 	@ApiModelProperty(value = "科目代码")
-	private String accountCode;
+	private Long accountCode;
 	/**
 	 * 科目代码中文名称
 	 */

+ 6 - 1
blade-service-api/blade-los-api/src/main/java/org/springblade/los/basic/business/entity/BusinessType.java

@@ -121,7 +121,7 @@ public class BusinessType implements Serializable {
 	 * 是否已删除(0 否 1是)
 	 */
 	@ApiModelProperty(value = "是否已删除(0 否 1是)")
-	@TableLogic(value = "0",delval = "1")
+	@TableLogic(value = "0", delval = "1")
 	private Integer isDeleted;
 	/**
 	 * 备注
@@ -140,6 +140,11 @@ public class BusinessType implements Serializable {
 	 */
 	@ApiModelProperty(value = "是否启用费用模版")
 	private String enableFee;
+	/**
+	 * 是否启用凭证模版
+	 */
+	@ApiModelProperty(value = "是否启用凭证模版")
+	private String enableVoucher;
 
 
 }

+ 34 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/basic/voucher/dto/VoucherTemplateDTO.java

@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.basic.voucher.dto;
+
+import org.springblade.los.basic.voucher.entity.VoucherTemplate;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 基础资料-凭证模版数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2024-02-27
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class VoucherTemplateDTO extends VoucherTemplate {
+	private static final long serialVersionUID = 1L;
+
+}

+ 182 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/basic/voucher/entity/VoucherTemplate.java

@@ -0,0 +1,182 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.basic.voucher.entity;
+
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 基础资料-凭证模版实体类
+ *
+ * @author BladeX
+ * @since 2024-02-27
+ */
+@Data
+@TableName("los_b_voucher_template")
+@ApiModel(value = "VoucherTemplate对象", description = "基础资料-凭证模版")
+public class VoucherTemplate implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	private Long id;
+	/**
+	 * 分公司 Id
+	 */
+	@ApiModelProperty(value = "分公司 Id")
+	private String branchId;
+	/**
+	 * 创建人 Id
+	 */
+	@ApiModelProperty(value = "创建人 Id")
+	private Long createUser;
+	/**
+	 * 创建人
+	 */
+	@ApiModelProperty(value = "创建人")
+	private String createUserName;
+	/**
+	 * 创建部门 Id
+	 */
+	@ApiModelProperty(value = "创建部门 Id")
+	private String createDept;
+	/**
+	 * 创建部门
+	 */
+	@ApiModelProperty(value = "创建部门")
+	private String createDeptName;
+	/**
+	 * 创建时间
+	 */
+	@ApiModelProperty(value = "创建时间")
+	private Date createTime;
+	/**
+	 * 修改人 Id
+	 */
+	@ApiModelProperty(value = "修改人 Id")
+	private Long updateUser;
+	/**
+	 * 修改人
+	 */
+	@ApiModelProperty(value = "修改人")
+	private String updateUserName;
+	/**
+	 * 修改时间
+	 */
+	@ApiModelProperty(value = "修改时间")
+	private Date updateTime;
+	/**
+	 * 版本
+	 */
+	@ApiModelProperty(value = "版本")
+	private String version;
+	/**
+	 * 状态(0 正常 1停用)
+	 */
+	@ApiModelProperty(value = "状态(0 正常 1停用)")
+	private Integer status;
+	/**
+	 * 备注
+	 */
+	@ApiModelProperty(value = "备注")
+	private String remarks;
+	/**
+	 * 是否已删除(0 否 1是)
+	 */
+	@TableLogic(value = "0", delval = "1")
+	@ApiModelProperty(value = "是否已删除(0 否 1是)")
+	private Integer isDeleted;
+	/**
+	 * 币别代码
+	 */
+	@ApiModelProperty(value = "币别代码")
+	private String currencyCode;
+	/**
+	 * 币别名称
+	 */
+	@ApiModelProperty(value = "币别名称")
+	private String currencyName;
+	/**
+	 * 凭证类型
+	 */
+	@ApiModelProperty(value = "凭证类型")
+	private String voucherType;
+	/**
+	 * 凭证名称
+	 */
+	@ApiModelProperty(value = "凭证名称")
+	private String voucherName;
+	/**
+	 * 类型
+	 */
+	@ApiModelProperty(value = "类型")
+	private String dcType;
+	/**
+	 * 科目代码
+	 */
+	@ApiModelProperty(value = "科目代码")
+	private String subjectCode;
+	/**
+	 * 科目名称
+	 */
+	@ApiModelProperty(value = "科目名称")
+	private String subjectName;
+	/**
+	 * 金额方向
+	 */
+	@ApiModelProperty(value = "金额方向")
+	private String amountDirection;
+	/**
+	 * 静态值
+	 */
+	@ApiModelProperty(value = "静态值")
+	private String staticValue;
+	/**
+	 * 附加公式
+	 */
+	@ApiModelProperty(value = "附加公式")
+	private String additionalFormulas;
+	/**
+	 * 业务类型id
+	 */
+	@ApiModelProperty(value = "业务类型id")
+	private Long businessTypeId;
+	/**
+	 * 业务类型
+	 */
+	@ApiModelProperty(value = "业务类型")
+	private String businessType;
+
+	/**
+	 * 租户
+	 */
+	@ApiModelProperty(value = "租户")
+	private String tenantId;
+
+	/**
+	 * 排序
+	 */
+	@ApiModelProperty(value = "排序")
+	private Integer sort;
+
+
+}

+ 36 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/basic/voucher/vo/VoucherTemplateVO.java

@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.basic.voucher.vo;
+
+import org.springblade.los.basic.voucher.entity.VoucherTemplate;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+
+/**
+ * 基础资料-凭证模版视图实体类
+ *
+ * @author BladeX
+ * @since 2024-02-27
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "VoucherTemplateVO对象", description = "基础资料-凭证模版")
+public class VoucherTemplateVO extends VoucherTemplate {
+	private static final long serialVersionUID = 1L;
+
+}

+ 12 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/business/aea/entity/AeaBills.java

@@ -1284,6 +1284,18 @@ public class AeaBills implements Serializable {
 	@TableField(exist = false)
 	private String type;
 
+	/**
+	 * 核算部门Id
+	 */
+	@ApiModelProperty(value = "核算部门Id")
+	private String accDept;
+
+	/**
+	 * 核算部门
+	 */
+	@ApiModelProperty(value = "核算部门")
+	private String accDeptName;
+
 
 
 }

+ 12 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/business/amends/entity/Amends.java

@@ -528,5 +528,17 @@ public class Amends implements Serializable {
 	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private Date approvedDate;
 
+	/**
+	 * 核算部门Id
+	 */
+	@ApiModelProperty(value = "核算部门Id")
+	private String accDept;
+
+	/**
+	 * 核算部门
+	 */
+	@ApiModelProperty(value = "核算部门")
+	private String accDeptName;
+
 
 }

+ 12 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/business/customsDeclaration/entity/CustomsDeclaration.java

@@ -770,5 +770,17 @@ public class CustomsDeclaration implements Serializable {
 	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private Date approvedDate;
 
+	/**
+	 * 核算部门Id
+	 */
+	@ApiModelProperty(value = "核算部门Id")
+	private String accDept;
+
+	/**
+	 * 核算部门
+	 */
+	@ApiModelProperty(value = "核算部门")
+	private String accDeptName;
+
 
 }

+ 40 - 11
blade-service/blade-los/src/main/java/org/springblade/los/basic/acc/controller/AccountsController.java

@@ -16,28 +16,28 @@
  */
 package org.springblade.los.basic.acc.controller;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
-import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import lombok.AllArgsConstructor;
-import javax.validation.Valid;
-
+import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.secure.BladeUser;
-import org.springblade.core.secure.annotation.PreAuth;
-import org.springblade.core.secure.constant.AuthConstant;
+import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
-import org.springblade.system.vo.DeptVO;
-import org.springframework.web.bind.annotation.*;
-import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.los.Util.IDeptUtils;
 import org.springblade.los.basic.acc.entity.Accounts;
-import org.springblade.los.basic.acc.vo.AccountsVO;
 import org.springblade.los.basic.acc.service.IAccountsService;
-import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.los.basic.acc.vo.AccountsVO;
+import org.springframework.web.bind.annotation.*;
 
+import javax.validation.Valid;
 import java.util.List;
 
 /**
@@ -54,6 +54,8 @@ public class AccountsController extends BladeController {
 
 	private final IAccountsService accountsService;
 
+	private final IDeptUtils deptUtils;
+
 	/**
 	 * 详情
 	 */
@@ -72,7 +74,25 @@ public class AccountsController extends BladeController {
 	@ApiOperationSupport(order = 2)
 	@ApiOperation(value = "分页", notes = "传入accounts")
 	public R<IPage<Accounts>> list(Accounts accounts, Query query) {
-		IPage<Accounts> pages = accountsService.page(Condition.getPage(query), Condition.getQueryWrapper(accounts));
+		LambdaQueryWrapper<Accounts> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+		lambdaQueryWrapper.eq(Accounts::getTenantId, AuthUtil.getTenantId())
+			.eq(Accounts::getBranchId, deptUtils.getDeptPid())
+			.eq(ObjectUtils.isNotNull(accounts.getProperty()), Accounts::getProperty, accounts.getProperty())
+			.eq(ObjectUtils.isNotNull(accounts.getCode()), Accounts::getCode, accounts.getCode())
+			.eq(ObjectUtils.isNotNull(accounts.getCnName()), Accounts::getCnName, accounts.getCnName())
+			.eq(ObjectUtils.isNotNull(accounts.getCurCode()), Accounts::getCurCode, accounts.getCurCode())
+			.eq(ObjectUtils.isNotNull(accounts.getDc()), Accounts::getDc, accounts.getDc())
+			.eq(ObjectUtils.isNotNull(accounts.getIsForeign()), Accounts::getIsForeign, accounts.getIsForeign())
+			.eq(ObjectUtils.isNotNull(accounts.getIsQuantity()), Accounts::getIsQuantity, accounts.getIsQuantity())
+			.eq(ObjectUtils.isNotNull(accounts.getIsCorp()), Accounts::getIsCorp, accounts.getIsCorp())
+			.eq(ObjectUtils.isNotNull(accounts.getIsDept()), Accounts::getIsDept, accounts.getIsDept())
+			.eq(ObjectUtils.isNotNull(accounts.getIsEmpl()), Accounts::getIsEmpl, accounts.getIsEmpl())
+			.eq(ObjectUtils.isNotNull(accounts.getIsItem()), Accounts::getIsItem, accounts.getIsItem())
+			.orderByAsc(Accounts::getCode);
+		if (!AuthUtil.getUserRole().contains("admin")) {
+			lambdaQueryWrapper.eq(Accounts::getBranchId, deptUtils.getDeptPid());
+		}
+		IPage<Accounts> pages = accountsService.page(Condition.getPage(query), lambdaQueryWrapper);
 		return R.data(pages);
 	}
 
@@ -153,4 +173,13 @@ public class AccountsController extends BladeController {
 		return R.data(tree);
 	}
 
+	/**
+	 * 获取科目代码
+	 */
+	@GetMapping("/getAccountsCode")
+	public R<Long> getAccountsCode(Long code) {
+		Long accountsCode = accountsService.getAccountsCode(code);
+		return R.data(accountsCode);
+	}
+
 }

+ 7 - 0
blade-service/blade-los/src/main/java/org/springblade/los/basic/acc/service/IAccountsService.java

@@ -74,4 +74,11 @@ public interface IAccountsService extends IService<Accounts> {
 	 * @return
 	 */
 	List<AccountsVO> lazyTree(String strWithEmpty, Long parentId);
+
+	/**
+	 * 获取科目代码
+	 * @param code 父级科目代码
+	 * @return 新科目代码
+	 */
+	Long getAccountsCode(Long code);
 }

+ 44 - 3
blade-service/blade-los/src/main/java/org/springblade/los/basic/acc/service/impl/AccountsServiceImpl.java

@@ -47,6 +47,7 @@ import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
 import java.util.Objects;
+import java.util.stream.Collectors;
 
 /**
  * 基础资料-科目代码 服务实现类
@@ -96,7 +97,14 @@ public class AccountsServiceImpl extends ServiceImpl<AccountsMapper, Accounts> i
 				deptName = String.join(",", res.getData());
 			}
 		}
+		List<Accounts> detail = baseMapper.selectList(new LambdaQueryWrapper<Accounts>()
+			.eq(Accounts::getCode, accounts.getCode())
+			.eq(Accounts::getTenantId, AuthUtil.getTenantId())
+			.eq(Accounts::getBranchId, deptUtils.getDeptPid()));
 		if (accounts.getId() == null) {
+			if (!detail.isEmpty()) {
+				throw new RuntimeException("科目代码已存在,保存失败");
+			}
 			if (Func.isEmpty(accounts.getParentId())) {
 				accounts.setParentId(BladeConstant.TOP_PARENT_ID);
 			}
@@ -119,6 +127,9 @@ public class AccountsServiceImpl extends ServiceImpl<AccountsMapper, Accounts> i
 				}
 			}
 		} else {
+			if (!detail.isEmpty() && detail.stream().map(Accounts::getId).anyMatch(e -> !e.equals(accounts.getId()))) {
+				throw new RuntimeException("科目代码已存在,保存失败");
+			}
 			if (finVouchersItemsService.count(new LambdaQueryWrapper<FinVouchersItems>()
 				.eq(FinVouchersItems::getAccountId, accounts.getId())
 				.eq(FinVouchersItems::getTenantId, AuthUtil.getTenantId())
@@ -139,7 +150,7 @@ public class AccountsServiceImpl extends ServiceImpl<AccountsMapper, Accounts> i
 
 		if (ObjectUtils.isNotNull(accounts.getAccItemsOpenblcList())) {
 			for (AccItemsOpenblc item : accounts.getAccItemsOpenblcList()) {
-				item.setAccountCode(accounts.getCode());
+				item.setAccountCode(Long.parseLong(accounts.getCode()));
 				item.setAccountId(accounts.getId());
 				item.setAccountCnName(accounts.getCnName());
 				item.setAccountEnName(accounts.getEnName());
@@ -269,7 +280,38 @@ public class AccountsServiceImpl extends ServiceImpl<AccountsMapper, Accounts> i
 		return ForestNodeMerger.merge(tree);
 	}
 
-	private Accounts selectSuperiorCode(Accounts accounts, Long parentId) {
+	@Override
+	public Long getAccountsCode(Long code) {
+		long accountsCode = 0L;
+		List<Accounts> accountsList = baseMapper.selectList(new LambdaQueryWrapper<Accounts>()
+			.eq(Accounts::getTenantId, AuthUtil.getTenantId())
+			.eq(Accounts::getParentCode, code)
+			.orderByAsc(Accounts::getCode));
+		List<String> number = accountsList.stream().map(Accounts::getCode).sorted().collect(Collectors.toList());
+		boolean status = true;
+		for (int i = 0; i < number.size() - 1; i++) {
+			if (Integer.parseInt(number.get(i + 1)) != Integer.parseInt(number.get(i)) + 1) {
+				accountsCode = Integer.parseInt(number.get(i)) + 1;
+				status = false;
+				break;
+			}
+		}
+		if (status) {
+			if (code == 0) {
+				accountsCode = Integer.parseInt(number.get(number.size() - 1)) + 1;
+			} else {
+				if (!number.isEmpty()){
+					accountsCode = Integer.parseInt(number.get(number.size() - 1)) + 1;
+				}else{
+					String codes = code + "001";
+					accountsCode = Long.parseLong(codes);
+				}
+			}
+		}
+		return accountsCode;
+	}
+
+	private void selectSuperiorCode(Accounts accounts, Long parentId) {
 		Accounts accounts1 = baseMapper.selectById(parentId);
 		if (accounts1 != null) {
 			accounts.setFullName(accounts1.getCnName() + "/" + accounts.getFullName());
@@ -278,7 +320,6 @@ public class AccountsServiceImpl extends ServiceImpl<AccountsMapper, Accounts> i
 				this.selectSuperiorCode(accounts, accounts1.getParentId());
 			}
 		}
-		return accounts;
 	}
 
 

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

@@ -87,6 +87,7 @@ public class BusinessTypeController extends BladeController {
 			.like(ObjectUtils.isNotNull(businessType.getEnName()), BusinessType::getEnName, businessType.getEnName())
 			.like(ObjectUtils.isNotNull(businessType.getStatus()), BusinessType::getStatus, businessType.getStatus())
 			.eq(ObjectUtils.isNotNull(businessType.getEnableFee()), BusinessType::getEnableFee, businessType.getEnableFee())
+			.eq(ObjectUtils.isNotNull(businessType.getEnableVoucher()), BusinessType::getEnableVoucher, businessType.getEnableVoucher())
 			.orderByDesc(BusinessType::getCreateTime);
 		IPage<BusinessType> pages = bBusinessTypeService.page(Condition.getPage(query), lambdaQueryWrapper);
 		return R.data(pages);

+ 152 - 0
blade-service/blade-los/src/main/java/org/springblade/los/basic/voucher/controller/VoucherTemplateController.java

@@ -0,0 +1,152 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.basic.voucher.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.los.Util.IDeptUtils;
+import org.springblade.los.basic.voucher.entity.VoucherTemplate;
+import org.springblade.los.basic.voucher.service.IVoucherTemplateService;
+import org.springblade.los.basic.voucher.vo.VoucherTemplateVO;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.List;
+
+/**
+ * 基础资料-凭证模版 控制器
+ *
+ * @author BladeX
+ * @since 2024-02-27
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/voucherTemplate")
+@Api(value = "基础资料-凭证模版", tags = "基础资料-凭证模版接口")
+public class VoucherTemplateController extends BladeController {
+
+	private final IVoucherTemplateService voucherTemplateService;
+
+	private final IDeptUtils deptUtils;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入voucherTemplate")
+	public R<VoucherTemplate> detail(VoucherTemplate voucherTemplate) {
+		VoucherTemplate detail = voucherTemplateService.detail(voucherTemplate);
+		return R.data(detail);
+	}
+
+	/**
+	 * 分页 基础资料-凭证模版
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入voucherTemplate")
+	public R<IPage<VoucherTemplate>> list(VoucherTemplate voucherTemplate, Query query) {
+		LambdaQueryWrapper<VoucherTemplate> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+		lambdaQueryWrapper.eq(VoucherTemplate::getTenantId, AuthUtil.getTenantId())
+			.eq(VoucherTemplate::getIsDeleted, 0)
+			.eq(ObjectUtils.isNotNull(voucherTemplate.getDcType()), VoucherTemplate::getDcType, voucherTemplate.getDcType())
+			.eq(ObjectUtils.isNotNull(voucherTemplate.getBusinessTypeId()), VoucherTemplate::getBusinessTypeId, voucherTemplate.getBusinessTypeId())
+			.eq(ObjectUtils.isNotNull(voucherTemplate.getStatus()), VoucherTemplate::getStatus, voucherTemplate.getStatus())
+			.orderByAsc(VoucherTemplate::getSort);
+		if (!AuthUtil.getUserRole().contains("admin")) {
+			lambdaQueryWrapper.eq(VoucherTemplate::getBranchId, deptUtils.getDeptPid());
+		}
+		IPage<VoucherTemplate> pages = voucherTemplateService.page(Condition.getPage(query), lambdaQueryWrapper);
+		return R.data(pages);
+	}
+
+	/**
+	 * 自定义分页 基础资料-凭证模版
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入voucherTemplate")
+	public R<IPage<VoucherTemplateVO>> page(VoucherTemplateVO voucherTemplate, Query query) {
+		IPage<VoucherTemplateVO> pages = voucherTemplateService.selectVoucherTemplatePage(Condition.getPage(query), voucherTemplate);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增 基础资料-凭证模版
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入voucherTemplate")
+	public R save(@Valid @RequestBody VoucherTemplate voucherTemplate) {
+		return R.status(voucherTemplateService.save(voucherTemplate));
+	}
+
+	/**
+	 * 修改 基础资料-凭证模版
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入voucherTemplate")
+	public R update(@Valid @RequestBody VoucherTemplate voucherTemplate) {
+		return R.status(voucherTemplateService.updateById(voucherTemplate));
+	}
+
+	/**
+	 * 新增或修改 基础资料-凭证模版
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入voucherTemplate")
+	public R submit(@Valid @RequestBody VoucherTemplate voucherTemplate) {
+		return voucherTemplateService.submit(voucherTemplate);
+	}
+
+
+	/**
+	 * 删除 基础资料-凭证模版
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(voucherTemplateService.removeByIds(Func.toLongList(ids)));
+	}
+
+	/**
+	 * 初始化
+	 */
+	@GetMapping("/initialization")
+	public R<List<VoucherTemplate>> initialization(Long businessTypeId, String businessType) {
+		List<VoucherTemplate> pages = voucherTemplateService.initialization(businessTypeId,businessType);
+		return R.data(pages);
+	}
+
+
+}

+ 42 - 0
blade-service/blade-los/src/main/java/org/springblade/los/basic/voucher/mapper/VoucherTemplateMapper.java

@@ -0,0 +1,42 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.basic.voucher.mapper;
+
+import org.springblade.los.basic.voucher.entity.VoucherTemplate;
+import org.springblade.los.basic.voucher.vo.VoucherTemplateVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ * 基础资料-凭证模版 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2024-02-27
+ */
+public interface VoucherTemplateMapper extends BaseMapper<VoucherTemplate> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param voucherTemplate
+	 * @return
+	 */
+	List<VoucherTemplateVO> selectVoucherTemplatePage(IPage page, VoucherTemplateVO voucherTemplate);
+
+}

+ 40 - 0
blade-service/blade-los/src/main/java/org/springblade/los/basic/voucher/mapper/VoucherTemplateMapper.xml

@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.los.basic.voucher.mapper.VoucherTemplateMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="voucherTemplateResultMap" type="org.springblade.los.basic.voucher.entity.VoucherTemplate">
+        <id column="id" property="id"/>
+        <result column="branch_id" property="branchId"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_user_name" property="createUserName"/>
+        <result column="create_dept" property="createDept"/>
+        <result column="create_dept_name" property="createDeptName"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="update_user_name" property="updateUserName"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="version" property="version"/>
+        <result column="status" property="status"/>
+        <result column="remarks" property="remarks"/>
+        <result column="is_deleted" property="isDeleted"/>
+        <result column="currency_code" property="currencyCode"/>
+        <result column="currency_name" property="currencyName"/>
+        <result column="voucher_type" property="voucherType"/>
+        <result column="voucher_name" property="voucherName"/>
+        <result column="dc_type" property="dcType"/>
+        <result column="subject_code" property="subjectCode"/>
+        <result column="subject_name" property="subjectName"/>
+        <result column="amount_direction" property="amountDirection"/>
+        <result column="static_value" property="staticValue"/>
+        <result column="additional_formulas" property="additionalFormulas"/>
+        <result column="business_type_id" property="businessTypeId"/>
+        <result column="business_type" property="businessType"/>
+    </resultMap>
+
+
+    <select id="selectVoucherTemplatePage" resultMap="voucherTemplateResultMap">
+        select * from los_b_voucher_template where is_deleted = 0
+    </select>
+
+</mapper>

+ 65 - 0
blade-service/blade-los/src/main/java/org/springblade/los/basic/voucher/service/IVoucherTemplateService.java

@@ -0,0 +1,65 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.basic.voucher.service;
+
+import org.springblade.core.tool.api.R;
+import org.springblade.los.basic.voucher.entity.VoucherTemplate;
+import org.springblade.los.basic.voucher.vo.VoucherTemplateVO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+import java.util.List;
+
+/**
+ * 基础资料-凭证模版 服务类
+ *
+ * @author BladeX
+ * @since 2024-02-27
+ */
+public interface IVoucherTemplateService extends IService<VoucherTemplate> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param voucherTemplate
+	 * @return
+	 */
+	IPage<VoucherTemplateVO> selectVoucherTemplatePage(IPage<VoucherTemplateVO> page, VoucherTemplateVO voucherTemplate);
+
+	/**
+	 * 新增或修改 基础资料-凭证模版
+	 * @param voucherTemplate
+	 * @return
+	 */
+	R submit(VoucherTemplate voucherTemplate);
+
+	/**
+	 * 详情
+	 * @param voucherTemplate
+	 * @return
+	 */
+	VoucherTemplate detail(VoucherTemplate voucherTemplate);
+
+	/**
+	 * 初始化
+	 * @param businessTypeId
+	 * @param businessType
+	 * @return
+	 */
+    List<VoucherTemplate> initialization(Long businessTypeId, String businessType);
+}

+ 224 - 0
blade-service/blade-los/src/main/java/org/springblade/los/basic/voucher/service/impl/VoucherTemplateServiceImpl.java

@@ -0,0 +1,224 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.basic.voucher.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import io.seata.spring.annotation.GlobalTransactional;
+import lombok.AllArgsConstructor;
+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.voucher.entity.VoucherTemplate;
+import org.springblade.los.basic.voucher.mapper.VoucherTemplateMapper;
+import org.springblade.los.basic.voucher.service.IVoucherTemplateService;
+import org.springblade.los.basic.voucher.vo.VoucherTemplateVO;
+import org.springblade.system.feign.ISysClient;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 基础资料-凭证模版 服务实现类
+ *
+ * @author BladeX
+ * @since 2024-02-27
+ */
+@Service
+@AllArgsConstructor
+public class VoucherTemplateServiceImpl extends ServiceImpl<VoucherTemplateMapper, VoucherTemplate> implements IVoucherTemplateService {
+
+
+	private final ISysClient sysClient;
+
+	private final IDeptUtils deptUtils;
+
+
+	@Override
+	public IPage<VoucherTemplateVO> selectVoucherTemplatePage(IPage<VoucherTemplateVO> page, VoucherTemplateVO voucherTemplate) {
+		return page.setRecords(baseMapper.selectVoucherTemplatePage(page, voucherTemplate));
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
+	public R submit(VoucherTemplate voucherTemplate) {
+		String deptId = "";
+		String deptName = "";
+		String branchId = deptUtils.getDeptPid() + "";
+		//获取部门ids对应中文名
+		if (ObjectUtils.isNotNull(AuthUtil.getDeptId())) {
+			deptId = AuthUtil.getDeptId();
+			R<List<String>> res = sysClient.getDeptNames(AuthUtil.getDeptId());
+			if (res.isSuccess() && ObjectUtils.isNotNull(res.getData())) {
+				deptName = String.join(",", res.getData());
+			}
+		}
+		if (voucherTemplate.getId() == null) {
+			voucherTemplate.setCreateTime(new Date());
+			voucherTemplate.setCreateUser(AuthUtil.getUserId());
+			voucherTemplate.setCreateUserName(AuthUtil.getUserName());
+			//获取部门ids对应中文名
+			if (ObjectUtils.isNotNull(deptId)) {
+				voucherTemplate.setCreateDept(deptId);
+				voucherTemplate.setBranchId(branchId);
+				R<List<String>> res = sysClient.getDeptNames(AuthUtil.getDeptId());
+				if (res.isSuccess() && ObjectUtils.isNotNull(res.getData())) {
+					voucherTemplate.setCreateDeptName(deptName);
+				}
+			}
+		} else {
+			voucherTemplate.setUpdateUser(AuthUtil.getUserId());
+			voucherTemplate.setUpdateTime(new Date());
+			voucherTemplate.setUpdateUserName(AuthUtil.getUserName());
+		}
+		this.saveOrUpdate(voucherTemplate);
+		return R.data(voucherTemplate);
+	}
+
+	@Override
+	public VoucherTemplate detail(VoucherTemplate voucherTemplate) {
+		return baseMapper.selectById(voucherTemplate.getId());
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
+	public List<VoucherTemplate> initialization(Long businessTypeId, String businessType) {
+		List<VoucherTemplate> voucherTemplateList = new ArrayList<>();
+		String deptId = "";
+		String deptName = "";
+		String branchId = deptUtils.getDeptPid() + "";
+		//获取部门ids对应中文名
+		if (ObjectUtils.isNotNull(AuthUtil.getDeptId())) {
+			deptId = AuthUtil.getDeptId();
+			R<List<String>> res = sysClient.getDeptNames(AuthUtil.getDeptId());
+			if (res.isSuccess() && ObjectUtils.isNotNull(res.getData())) {
+				deptName = String.join(",", res.getData());
+			}
+		}
+		List<VoucherTemplate> voucherTemplates = baseMapper.selectList(new LambdaQueryWrapper<VoucherTemplate>()
+			.eq(VoucherTemplate::getBusinessTypeId, businessTypeId)
+			.eq(VoucherTemplate::getBusinessType, businessType));
+		if (!voucherTemplates.isEmpty()) {
+			this.removeByIds(voucherTemplates.stream().map(VoucherTemplate::getId).collect(Collectors.toList()));
+		}
+		if ("HYCK".equals(businessType) || "HYJK".equals(businessType) || "KYCK".equals(businessType) ||
+			"KYJK".equals(businessType) || "SEA".equals(businessType) || "SIA".equals(businessType) ||
+			"AEA".equals(businessType) || "AIA".equals(businessType)) {
+			String[] CUR_CODE = new String[]{"RMB", "RMB", "RMB", "RMB", "USD", "USD", "USD", "USD"};
+			String[] CUR_NAME = new String[]{"人民币", "人民币", "人民币", "人民币", "美元", "美元", "美元", "美元"};
+			String[] DC_TYPE = new String[]{"应收", "收入", "应付", "成本", "应收", "收入", "应付", "成本"};
+			String[] VOUCHER_TYPE = new String[]{"应收凭证", "", "应付凭证", "", "应收凭证", "", "应付凭证", ""};
+			String[] HY = new String[]{"海运应收", "代理业务收入", "海运应付", "代理业务成本", "海运应收", "代理业务收入", "海运应付", "代理业务成本"};
+			String[] KY = new String[]{"空运应收", "代理业务收入", "空运应付", "代理业务成本", "空运应收", "代理业务收入", "空运应付", "代理业务成本"};
+			String[] HY_AMEND = new String[]{"海运amend应收", "代理业务收入", "海运amend应付", "代理业务成本", "海运amend应收", "代理业务收入", "海运amend应付", "代理业务成本"};
+			String[] KY_AMEND = new String[]{"空运amend应收", "代理业务收入", "空运amend应付", "代理业务成本", "空运amend应收", "代理业务收入", "空运amend应付", "代理业务成本"};
+			String CK_FORMULAS = "[corpCnName] [mblno] [etd]";
+			String JK_FORMULAS = "[corpCnName] [mblno] [eta]";
+			for (int i = 0; i < 8; i++) {
+				VoucherTemplate voucherTemplate = new VoucherTemplate();
+				voucherTemplate.setCreateTime(new Date());
+				voucherTemplate.setCreateUser(AuthUtil.getUserId());
+				voucherTemplate.setCreateUserName(AuthUtil.getUserName());
+				voucherTemplate.setSort(i);
+				//获取部门ids对应中文名
+				if (ObjectUtils.isNotNull(deptId)) {
+					voucherTemplate.setCreateDept(deptId);
+					voucherTemplate.setBranchId(branchId);
+					R<List<String>> res = sysClient.getDeptNames(AuthUtil.getDeptId());
+					if (res.isSuccess() && ObjectUtils.isNotNull(res.getData())) {
+						voucherTemplate.setCreateDeptName(deptName);
+					}
+				}
+				voucherTemplate.setBusinessTypeId(businessTypeId);
+				voucherTemplate.setBusinessType(businessType);
+				voucherTemplate.setCurrencyCode(CUR_CODE[i]);
+				voucherTemplate.setCurrencyName(CUR_NAME[i]);
+				voucherTemplate.setDcType(DC_TYPE[i]);
+				voucherTemplate.setVoucherType(VOUCHER_TYPE[i]);
+				if ("HYCK".equals(businessType)) {
+					voucherTemplate.setStaticValue(HY[i]);
+					voucherTemplate.setAdditionalFormulas(CK_FORMULAS);
+				} else if ("HYJK".equals(businessType)) {
+					voucherTemplate.setStaticValue(HY[i]);
+					voucherTemplate.setAdditionalFormulas(JK_FORMULAS);
+				} else if ("KYCK".equals(businessType)) {
+					voucherTemplate.setStaticValue(KY[i]);
+					voucherTemplate.setAdditionalFormulas(CK_FORMULAS);
+				} else if ("KYJK".equals(businessType)) {
+					voucherTemplate.setStaticValue(KY[i]);
+					voucherTemplate.setAdditionalFormulas(JK_FORMULAS);
+				} else if ("SEA".equals(businessType)) {
+					voucherTemplate.setStaticValue(HY_AMEND[i]);
+					voucherTemplate.setAdditionalFormulas(CK_FORMULAS);
+				} else if ("SIA".equals(businessType)) {
+					voucherTemplate.setStaticValue(HY_AMEND[i]);
+					voucherTemplate.setAdditionalFormulas(JK_FORMULAS);
+				} else if ("AEA".equals(businessType)) {
+					voucherTemplate.setStaticValue(KY_AMEND[i]);
+					voucherTemplate.setAdditionalFormulas(CK_FORMULAS);
+				} else {
+					voucherTemplate.setStaticValue(KY_AMEND[i]);
+					voucherTemplate.setAdditionalFormulas(JK_FORMULAS);
+				}
+				voucherTemplateList.add(voucherTemplate);
+			}
+		} else if ("STL".equals(businessType)) {
+			String[] CUR_CODE = new String[]{"RMB", "RMB", "RMB", "RMB", "RMB", "USD", "USD", "USD", "USD", "USD"};
+			String[] CUR_NAME = new String[]{"人民币", "人民币", "人民币", "人民币", "人民币", "美元", "美元", "美元", "美元", "美元"};
+			String[] DC_TYPE = new String[]{"现金", "银行", "应收账款", "应付账款", "汇兑收益", "现金", "银行", "应收账款", "应付账款", "汇兑收益"};
+			String[] VOUCHER_TYPE = new String[]{"现金收入凭证", "银行收入凭证", "现金支出凭证", "银行支出凭证", "", "现金收入凭证", "银行收入凭证", "现金支出凭证", "银行支出凭证", ""};
+			String[] STATIC_VALUE = new String[]{"海运收入", "海运收入", "海运收入", "海运收入", "汇兑收益", "海运收入", "海运收入", "海运收入", "海运收入", "汇兑收益"};
+			String FORMULAS = "[corpCnName]";
+			for (int i = 0; i < 8; i++) {
+				VoucherTemplate voucherTemplate = new VoucherTemplate();
+				voucherTemplate.setCreateTime(new Date());
+				voucherTemplate.setCreateUser(AuthUtil.getUserId());
+				voucherTemplate.setCreateUserName(AuthUtil.getUserName());
+				voucherTemplate.setSort(i);
+				//获取部门ids对应中文名
+				if (ObjectUtils.isNotNull(deptId)) {
+					voucherTemplate.setCreateDept(deptId);
+					voucherTemplate.setBranchId(branchId);
+					R<List<String>> res = sysClient.getDeptNames(AuthUtil.getDeptId());
+					if (res.isSuccess() && ObjectUtils.isNotNull(res.getData())) {
+						voucherTemplate.setCreateDeptName(deptName);
+					}
+				}
+				voucherTemplate.setBusinessTypeId(businessTypeId);
+				voucherTemplate.setBusinessType(businessType);
+				voucherTemplate.setCurrencyCode(CUR_CODE[i]);
+				voucherTemplate.setCurrencyName(CUR_NAME[i]);
+				voucherTemplate.setDcType(DC_TYPE[i]);
+				voucherTemplate.setVoucherType(VOUCHER_TYPE[i]);
+				voucherTemplate.setStaticValue(STATIC_VALUE[i]);
+				voucherTemplate.setAdditionalFormulas(FORMULAS);
+				voucherTemplateList.add(voucherTemplate);
+			}
+		}
+		this.saveOrUpdateBatch(voucherTemplateList);
+		return voucherTemplateList;
+	}
+
+}

+ 2 - 2
blade-service/blade-los/src/main/java/org/springblade/los/business/sea/controller/BillsController.java

@@ -111,11 +111,11 @@ public class BillsController extends BladeController {
 			.and(ObjectUtils.isNotNull(bills.getSrcCnName()), i -> i.like(Bills::getSrcCnName, bills.getSrcCnName()).or()
 				.like(Bills::getSrcEnName, bills.getSrcCnName()))
 			.apply(ObjectUtils.isNotNull(bills.getCreateDeptName()), "find_in_set('" + bills.getCreateDeptName() + "',create_dept_name)");
-		if (ObjectUtils.isNotNull(bills.getEtdList()) && bills.getEtdList().size() > 0) {
+		if (ObjectUtils.isNotNull(bills.getEtdList()) && !bills.getEtdList().isEmpty()) {
 			lambdaQueryWrapper.ge(Bills::getEtd, bills.getEtdList().get(0));
 			lambdaQueryWrapper.le(Bills::getEtd, bills.getEtdList().get(1));
 		}
-		if (ObjectUtils.isNotNull(bills.getEtaList()) && bills.getEtaList().size() > 0) {
+		if (ObjectUtils.isNotNull(bills.getEtaList()) && !bills.getEtaList().isEmpty()) {
 			lambdaQueryWrapper.ge(Bills::getEta, bills.getEtaList().get(0));
 			lambdaQueryWrapper.le(Bills::getEta, bills.getEtaList().get(1));
 		}

+ 379 - 10
blade-service/blade-los/src/main/java/org/springblade/los/check/service/impl/AuditProecessServiceImpl.java

@@ -19,6 +19,7 @@ package org.springblade.los.check.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import io.seata.spring.annotation.GlobalTransactional;
@@ -27,8 +28,18 @@ import org.springblade.client.entity.Message;
 import org.springblade.client.feign.IMessageClient;
 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.acc.entity.Accounts;
+import org.springblade.los.basic.acc.service.IAccountsService;
+import org.springblade.los.basic.business.entity.BusinessType;
+import org.springblade.los.basic.business.service.IBusinessTypeService;
 import org.springblade.los.basic.corps.entity.BCorps;
 import org.springblade.los.basic.corps.service.IBCorpsService;
+import org.springblade.los.basic.cur.service.IBCurrencyService;
+import org.springblade.los.basic.voucher.entity.VoucherTemplate;
+import org.springblade.los.basic.voucher.service.IVoucherTemplateService;
+import org.springblade.los.billno.entity.BusinessBillNo;
+import org.springblade.los.billno.service.IBusinessBillNoService;
 import org.springblade.los.business.aea.entity.AeaBills;
 import org.springblade.los.business.aea.mapper.AeaBillsMapper;
 import org.springblade.los.business.amends.entity.Amends;
@@ -53,9 +64,19 @@ import org.springblade.los.finance.invoices.entity.FinInvoices;
 import org.springblade.los.finance.invoices.mapper.FinInvoicesMapper;
 import org.springblade.los.finance.stl.entity.FinStlBills;
 import org.springblade.los.finance.stl.mapper.FinStlBillsMapper;
+import org.springblade.los.finance.vouchers.entity.FinVouchers;
+import org.springblade.los.finance.vouchers.entity.FinVouchersItems;
+import org.springblade.los.finance.vouchers.mapper.FinVouchersMapper;
+import org.springblade.los.finance.vouchers.service.IFinVouchersItemsService;
+import org.springblade.system.entity.Dept;
+import org.springblade.system.feign.ISysClient;
+import org.springblade.system.user.entity.User;
+import org.springblade.system.user.feign.IUserClient;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
+import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -92,6 +113,26 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
 
 	private final AmendsMapper amendsMapper;
 
+	private final FinVouchersMapper finVouchersMapper;
+
+	private final IFinVouchersItemsService finVouchersItemsService;
+
+	private final IVoucherTemplateService voucherTemplateService;
+
+	private final IBusinessTypeService bBusinessTypeService;
+
+	private final IBusinessBillNoService businessBillNoService;
+
+	private final ISysClient sysClient;
+
+	private final IUserClient userClient;
+
+	private final IDeptUtils deptUtils;
+
+	private final IAccountsService accountsService;
+
+	private final IBCurrencyService bCurrencyService;
+
 
 	@Override
 	public IPage<LosAuditProecessVO> selectAuditProecessPage(IPage<LosAuditProecessVO> page, LosAuditProecessVO auditProecess) {
@@ -230,9 +271,9 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
 		List<LosAuditProecess> auditProecessList = proecessList.stream().filter(e -> e.getBatchNo() == max).collect(Collectors.toList());
 		//如果最新审批记录 第一级已经操作,就禁止撤回
 		long count = auditProecessList.stream().filter(
-			e -> e.getBatchNo() == max &&
-				e.getLevelId() == 1 &&
-				("A".equals(e.getAuditStatus()) || "B".equals(e.getAuditStatus())))
+				e -> e.getBatchNo() == max &&
+					e.getLevelId() == 1 &&
+					("A".equals(e.getAuditStatus()) || "B".equals(e.getAuditStatus())))
 			.count();
 		if (count > 0) {
 			throw new SecurityException("第一级审批已经开始,禁止撤回");
@@ -441,9 +482,9 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
 						.eq(Bills::getIsDeleted, 0)
 						.eq(Bills::getMasterId, bills.getId())
 						.eq(Bills::getMasterBillNo, bills.getMasterBillNo()));
-					if (billsList.size() > 0) {
+					if (!billsList.isEmpty()) {
 						List<Long> ids = billsList.stream().map(Bills::getId).filter(Objects::nonNull).collect(Collectors.toList());
-						if (ids.size() > 0) {
+						if (!ids.isEmpty()) {
 							List<FeeCenter> feeCenters = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
 								.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
 								.eq(FeeCenter::getIsDeleted, 0)
@@ -459,7 +500,7 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
 					item.setAuditStatus("1");
 				}
 				List<FeeCenter> feeCenters = feeCenterList.stream().filter(e -> 0 == e.getAccStatus()).collect(Collectors.toList());
-				if (feeCenters.size() != 0) {
+				if (!feeCenters.isEmpty()) {
 					FinAccBills finAccBills = new FinAccBills();
 					finAccBills.setFeeCenterList(feeCenters);
 					finAccBills.setBusinessTypeCode("HYZD");
@@ -475,6 +516,10 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
 					finAccBillsService.generateBill(finAccBills);
 				}
 				feeCenterService.saveOrUpdateBatch(feeCenterList);
+				String status = sysClient.getParamService("automatic.generate.voucher");
+				if ("1".equals(status)) {
+					generateVoucher(auditProecess.getCheckType(), bills.getId());
+				}
 				if ("海运出口审核".equals(auditProecess.getProcessType())) {
 					sendMessage.setMessageBody("您的海运出口审核已通过" + ",业务单号:" + proecessTemp.getBillNo() + ",驳回原因:" + auditProecess.getAuditMsg());
 				}
@@ -1086,7 +1131,7 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
 					item.setApproveTime(new Date());
 				}
 				feeCenterService.saveOrUpdateBatch(feeCenterList);
-				if (feeCenterList.size() != 0) {
+				if (!feeCenterList.isEmpty()) {
 					FinAccBills finAccBills = new FinAccBills();
 					finAccBills.setFeeCenterList(feeCenterList);
 					if ("SEA".equals(detail.getBusinessType()) || "SIA".equals(detail.getBusinessType())) {
@@ -1104,6 +1149,10 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
 					finAccBills.setPodNamePrint(bills.getPodNamePrint());
 					finAccBillsService.generateBill(finAccBills);
 				}
+				String status = sysClient.getParamService("automatic.generate.voucher");
+				if ("1".equals(status)) {
+					generateVoucher(auditProecess.getCheckType(), bills.getId());
+				}
 				if ("海运出口AMEND".equals(auditProecess.getProcessType())) {
 					sendMessage.setMessageBody("您的海运出口AMEND审核已通过" + ",业务单号:" + proecessTemp.getBillNo() + ",驳回原因:" + auditProecess.getAuditMsg());
 				} else if ("海运进口口AMEND".equals(auditProecess.getProcessType())) {
@@ -1157,6 +1206,322 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
 		baseMapper.updateById(auditProecess);
 	}
 
+	private void generateVoucher(String checkType, Long id) {
+		String typeCode;
+		if ("HYCK-DJ".equals(checkType)) {
+			typeCode = "HYCK";
+		} else if ("HYJK-DJ".equals(checkType)) {
+			typeCode = "HYJK";
+		} else if ("KYCK-DJ".equals(checkType)) {
+			typeCode = "KYCK";
+		} else if ("KYJK-DJ".equals(checkType)) {
+			typeCode = "KYJK";
+		} else if ("sea-approve".equals(checkType)) {
+			typeCode = "SEA";
+		} else if ("sia-approve".equals(checkType)) {
+			typeCode = "SIA";
+		} else if ("aea-approve".equals(checkType)) {
+			typeCode = "AEA";
+		} else if ("aia-approve".equals(checkType)) {
+			typeCode = "AIA";
+		} else {
+			typeCode = "";
+		}
+		List<BusinessType> businessTypeList = bBusinessTypeService.list(new LambdaQueryWrapper<BusinessType>()
+			.eq(BusinessType::getIsDeleted, 0)
+			.eq(BusinessType::getTenantId, AuthUtil.getTenantId())
+			.eq(BusinessType::getStatus, 0));
+		BusinessType bVoucherType = businessTypeList.stream().filter(e -> e.getCode().equals(typeCode)).findFirst().orElse(null);
+		if (bVoucherType == null) {
+			throw new RuntimeException("未找到生成凭证业务类型");
+		}
+		//查询业务凭证模板信息
+		List<VoucherTemplate> voucherTemplateList = voucherTemplateService.list(new LambdaQueryWrapper<VoucherTemplate>()
+			.eq(VoucherTemplate::getTenantId, AuthUtil.getTenantId())
+			.eq(VoucherTemplate::getIsDeleted, 0)
+			.eq(VoucherTemplate::getBusinessTypeId, bVoucherType.getId())
+			.eq(VoucherTemplate::getStatus, 0));
+		if (voucherTemplateList.isEmpty()) {
+			throw new RuntimeException("未配置凭证模板");
+		}
+		//查询业务费用
+		List<FeeCenter> feeCenterList = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
+			.eq(FeeCenter::getPid, id));
+		if (feeCenterList.isEmpty()) {
+			throw new RuntimeException("费用为空,自动生成凭证失败");
+		}
+		BCorps bCorps = null;
+		Dept dept = null;
+		User user = null;
+		BCorps userSrc = null;
+		//查询各业务模块 核算客户,核算部门,核算职员信息
+		if ("HYCK-DJ".equals(checkType) || "HYJK-DJ".equals(checkType)) {
+			Bills bills = billsMapper.selectById(id);
+			if (bills != null) {
+				bCorps = bCorpsService.getById(bills.getCorpId());
+				R<Dept> deptR = sysClient.getDept(Long.parseLong(bills.getAccDept()));
+				if (deptR.isSuccess()) {
+					dept = deptR.getData();
+				}
+				if ("SALES".equals(bills.getSrcType())) {
+					R<User> userR = userClient.userInfoById(bills.getSrcId());
+					if (userR.isSuccess()) {
+						user = userR.getData();
+					}
+				} else {
+					userSrc = bCorpsService.getById(bills.getSrcId());
+				}
+			}
+		} else if ("KYCK-DJ".equals(checkType) || "KYJK-DJ".equals(checkType)) {
+			AeaBills bills = aeaBillsMapper.selectById(id);
+			if (bills != null) {
+				bCorps = bCorpsService.getById(bills.getCorpId());
+				R<Dept> deptR = sysClient.getDept(Long.parseLong(bills.getAccDept()));
+				if (deptR.isSuccess()) {
+					dept = deptR.getData();
+				}
+				if ("SALES".equals(bills.getSrcType())) {
+					R<User> userR = userClient.userInfoById(bills.getSrcId());
+					if (userR.isSuccess()) {
+						user = userR.getData();
+					}
+				} else {
+					userSrc = bCorpsService.getById(bills.getSrcId());
+				}
+			}
+		} else if ("BGSE".equals(checkType) || "BGSI".equals(checkType) ||
+			"BGAE".equals(checkType) || "BGAI".equals(checkType)) {
+			CustomsDeclaration bills = customsDeclarationMapper.selectById(id);
+			if (bills != null) {
+				bCorps = bCorpsService.getById(bills.getCorpId());
+				R<Dept> deptR = sysClient.getDept(Long.parseLong(bills.getAccDept()));
+				if (deptR.isSuccess()) {
+					dept = deptR.getData();
+				}
+				if ("SALES".equals(bills.getSrcType())) {
+					R<User> userR = userClient.userInfoById(bills.getSrcId());
+					if (userR.isSuccess()) {
+						user = userR.getData();
+					}
+				} else {
+					userSrc = bCorpsService.getById(bills.getSrcId());
+				}
+			}
+		} else if ("sea-approve".equals(checkType) || "sia-approve".equals(checkType) ||
+			"aea-approve".equals(checkType) || "aia-approve".equals(checkType)) {
+			Amends bills = amendsMapper.selectById(id);
+			if (bills != null) {
+				bCorps = bCorpsService.getById(bills.getCorpId());
+				R<Dept> deptR = sysClient.getDept(Long.parseLong(bills.getAccDept()));
+				if (deptR.isSuccess()) {
+					dept = deptR.getData();
+				}
+				if ("SEA".equals(bills.getBusinessType()) || "SIA".equals(bills.getBusinessType())) {
+					Bills bills1 = billsMapper.selectById(id);
+					if (bills1 != null) {
+						if ("SALES".equals(bills1.getSrcType())) {
+							R<User> userR = userClient.userInfoById(bills1.getSrcId());
+							if (userR.isSuccess()) {
+								user = userR.getData();
+							}
+						} else {
+							userSrc = bCorpsService.getById(bills1.getSrcId());
+						}
+					}
+				} else {
+					AeaBills aeaBills = aeaBillsMapper.selectById(id);
+					if (aeaBills != null) {
+						if ("SALES".equals(aeaBills.getSrcType())) {
+							R<User> userR = userClient.userInfoById(aeaBills.getSrcId());
+							if (userR.isSuccess()) {
+								user = userR.getData();
+							}
+						} else {
+							userSrc = bCorpsService.getById(aeaBills.getSrcId());
+						}
+					}
+				}
+			}
+		}
+		//计算 应收,应付人民币,美元各个合计金额
+		BigDecimal amountC = feeCenterList.stream().filter(e -> "RMB".equals(e.getCurCode()) && "C".equals(e.getDc())).map(FeeCenter::getAmount)
+			.reduce(BigDecimal.ZERO, BigDecimal::add);
+		BigDecimal amountD = feeCenterList.stream().filter(e -> "RMB".equals(e.getCurCode()) && "D".equals(e.getDc())).map(FeeCenter::getAmount)
+			.reduce(BigDecimal.ZERO, BigDecimal::add);
+		BigDecimal amountCUsd = feeCenterList.stream().filter(e -> "USD".equals(e.getCurCode()) && "C".equals(e.getDc())).map(FeeCenter::getAmount)
+			.reduce(BigDecimal.ZERO, BigDecimal::add);
+		BigDecimal amountDUsd = feeCenterList.stream().filter(e -> "USD".equals(e.getCurCode()) && "D".equals(e.getDc())).map(FeeCenter::getAmount)
+			.reduce(BigDecimal.ZERO, BigDecimal::add);
+
+		//固定借,贷金额数组
+		BigDecimal[] amount = new BigDecimal[]{amountD, amountD, amountC, amountC, amountDUsd, amountDUsd, amountCUsd, amountCUsd};
+
+		//创建凭证主表信息
+		FinVouchers finVouchers = new FinVouchers();
+		String deptId = "";
+		String deptName = "";
+		String branchId = deptUtils.getDeptPid() + "";
+		//获取部门ids对应中文名
+		if (ObjectUtils.isNotNull(AuthUtil.getDeptId())) {
+			deptId = AuthUtil.getDeptId();
+			R<List<String>> res = sysClient.getDeptNames(AuthUtil.getDeptId());
+			if (res.isSuccess() && ObjectUtils.isNotNull(res.getData())) {
+				deptName = String.join(",", res.getData());
+			}
+		}
+		BusinessType businessType = businessTypeList.stream().filter(e -> e.getCode().equals("PZDH")).findFirst().orElse(null);
+		if (businessType == null) {
+			throw new RuntimeException("未找到可用业务类型");
+		}
+		BusinessBillNo businessBillNo = new BusinessBillNo();
+		businessBillNo.setBusinessTypeId(businessType.getId());
+		businessBillNo.setCode("PZDH-J");
+		R clientBillNo = businessBillNoService.getBillNoLos(businessBillNo);
+		if (!clientBillNo.isSuccess()) {
+			TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+			throw new RuntimeException("生成订单编号失败");
+		}
+		finVouchers.setBillNo((String) clientBillNo.getData());
+		finVouchers.setVoucherDate(new Date());
+		finVouchers.setCreateTime(new Date());
+		finVouchers.setCreateUser(AuthUtil.getUserId());
+		finVouchers.setCreateUserName(AuthUtil.getUserName());
+		if (ObjectUtils.isNotNull(AuthUtil.getDeptId())) {
+			finVouchers.setCreateDept(deptId);
+			finVouchers.setBranchId(branchId);
+			finVouchers.setCreateDeptName(deptName);
+		}
+		finVouchersMapper.insert(finVouchers);
+		//获取所需科目列表信息
+		String accountsCode = voucherTemplateList.stream().map(VoucherTemplate::getSubjectCode).collect(Collectors.joining(","));
+		List<Accounts> accountsList = accountsService.list(new LambdaQueryWrapper<Accounts>()
+			.eq(Accounts::getStatus, 0)
+			.apply("find_in_set(code,'" + accountsCode + "')"));
+		List<FinVouchersItems> finVouchersItemsList = new ArrayList<>();
+		int count = 0;
+		//循环复制凭证明细信息
+		for (VoucherTemplate item : voucherTemplateList) {
+			count++;
+			FinVouchersItems finVouchersItems = new FinVouchersItems();
+			finVouchersItems.setCreateTime(new Date());
+			finVouchersItems.setCreateUser(AuthUtil.getUserId());
+			finVouchersItems.setCreateUserName(AuthUtil.getUserName());
+			if (ObjectUtils.isNotNull(AuthUtil.getDeptId())) {
+				finVouchersItems.setCreateDept(deptId);
+				finVouchersItems.setBranchId(branchId);
+				finVouchersItems.setCreateDeptName(deptName);
+			}
+			finVouchersItems.setPid(finVouchers.getId());
+			finVouchersItems.setBillNo(finVouchers.getBillNo());
+			finVouchersItems.setVoucherSource("SYSTEM");
+			finVouchersItems.setVoucherType("记");
+			finVouchersItems.setVoucherNo("");
+			finVouchersItems.setVoucherDate(finVouchers.getVoucherDate());
+			Accounts accounts = accountsList.stream().filter(e -> e.getCode().equals(item.getSubjectCode()))
+				.findFirst().orElse(null);
+			//获取模板中科目所对应科目信息并赋值
+			if (accounts != null) {
+				finVouchersItems.setAccountId(accounts.getId());
+				finVouchersItems.setAccountCode(accounts.getCode());
+				finVouchersItems.setAccountCnName(accounts.getCnName());
+				finVouchersItems.setAccountEnName(accounts.getEnName());
+				finVouchersItems.setAccountProperty(accounts.getProperty());
+				finVouchersItems.setAccountLevel(accounts.getLevel());
+				finVouchersItems.setDc(item.getAmountDirection());
+				finVouchersItems.setCurCode(accounts.getCurCode());
+				finVouchersItems.setExrate(accounts.getExrate());
+				/*判断是否人民币,美元
+				 * 人民币 判断模版借贷方向与科目借贷方向是否一致 true D+D=正 D+C=负 C+C=正 C+D=负
+				 * 美元 判断模版借贷方向与科目借贷方向是否一致 true D+D=正 D+C=负 C+C=正 C+D=负
+				 * 借或贷金额为零时跳过本次循环
+				 * */
+				if ("RMB".equals(item.getCurrencyCode())) {
+					if ("D".equals(item.getAmountDirection())) {
+						if ("D".equals(accounts.getDc())) {
+							if (new BigDecimal("0.00").compareTo(amount[count - 1]) != 0) {
+								finVouchersItems.setAmountDr(amount[count - 1]);
+							} else {
+								continue;
+							}
+						} else {
+							finVouchersItems.setAmountDr(new BigDecimal("0.00").subtract(amount[count - 1]));
+						}
+					} else {
+						if ("D".equals(accounts.getDc())) {
+							finVouchersItems.setAmountDr(new BigDecimal("0.00").subtract(amount[count - 1]));
+						} else {
+							if (new BigDecimal("0.00").compareTo(amount[count - 1]) != 0) {
+								finVouchersItems.setAmountCr(amount[count - 1]);
+							} else {
+								continue;
+							}
+						}
+					}
+				} else {
+					if ("D".equals(item.getAmountDirection())) {
+						if ("D".equals(accounts.getDc())) {
+							if (new BigDecimal("0.00").compareTo(amount[count - 1]) != 0) {
+								finVouchersItems.setAmountDrUsd(amount[count - 1]);
+							} else {
+								continue;
+							}
+						} else {
+							finVouchersItems.setAmountDrUsd(new BigDecimal("0.00").subtract(amount[count - 1]));
+						}
+					} else {
+						if ("D".equals(accounts.getDc())) {
+							finVouchersItems.setAmountDrUsd(new BigDecimal("0.00").subtract(amount[count - 1]));
+						} else {
+							if (new BigDecimal("0.00").compareTo(amount[count - 1]) != 0) {
+								finVouchersItems.setAmountCrUsd(amount[count - 1]);
+							} else {
+								continue;
+							}
+						}
+					}
+				}
+				//计算借,贷人民币与美金合计人民币金额
+				finVouchersItems.setAmountDrLoc(finVouchersItems.getAmountDr().add(bCurrencyService.converterCny("USD", finVouchersItems.getAmountDrUsd(), "D")));
+				finVouchersItems.setAmountCrLoc(finVouchersItems.getAmountCr().add(bCurrencyService.converterCny("USD", finVouchersItems.getAmountCrUsd(), "C")));
+				finVouchersItems.setIsCorp(accounts.getIsCorp());
+				//判断是否核算客户 true 向明细中客户字段复制
+				if (1 == finVouchersItems.getIsCorp()) {
+					if (bCorps != null) {
+						finVouchersItems.setCorpId(bCorps.getCorpId());
+						finVouchersItems.setCorpCnName(bCorps.getCnName());
+						finVouchersItems.setCorpEnName(bCorps.getEnName());
+					}
+				}
+				finVouchersItems.setIsDept(accounts.getIsDept());
+				//判断是否核算部门 true 向明细中部门字段复制
+				if (1 == finVouchersItems.getIsDept()) {
+					if (dept != null) {
+						finVouchersItems.setDeptId(dept.getId());
+						finVouchersItems.setDeptName(dept.getDeptName());
+					}
+				}
+				finVouchersItems.setIsEmpl(accounts.getIsEmpl());
+				//判断是否核算职员 true 向明细中职员字段复制
+				if (1 == finVouchersItems.getIsEmpl()) {
+					if (user != null) {
+						finVouchersItems.setEmplId(user.getId());
+						finVouchersItems.setEmplName(user.getName());
+					} else {
+						if (userSrc != null) {
+							finVouchersItems.setEmplId(userSrc.getId());
+							finVouchersItems.setEmplName(userSrc.getCnName());
+						}
+					}
+				}
+			} else {
+				throw new RuntimeException("未找到科目信息");
+			}
+			finVouchersItems.setLineNo(count);
+			finVouchersItemsList.add(finVouchersItems);
+		}
+		finVouchersItemsService.saveOrUpdateBatch(finVouchersItemsList);
+	}
+
 	@Override
 	public void losAeBillsCheck(LosAuditProecess auditProecess) {
 		//查看最新操作记录,防止重复提交
@@ -1348,9 +1713,9 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
 						.eq(Bills::getIsDeleted, 0)
 						.eq(Bills::getMasterId, bills.getId())
 						.eq(Bills::getMasterBillNo, bills.getMasterBillNo()));
-					if (billsList.size() > 0) {
+					if (!billsList.isEmpty()) {
 						List<Long> ids = billsList.stream().map(Bills::getId).filter(Objects::nonNull).collect(Collectors.toList());
-						if (ids.size() > 0) {
+						if (!ids.isEmpty()) {
 							List<FeeCenter> feeCenters = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
 								.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
 								.eq(FeeCenter::getIsDeleted, 0)
@@ -1366,7 +1731,7 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
 					item.setAuditStatus("1");
 				}
 				List<FeeCenter> feeCenters = feeCenterList.stream().filter(e -> 0 == e.getAccStatus()).collect(Collectors.toList());
-				if (feeCenters.size() != 0) {
+				if (!feeCenters.isEmpty()) {
 					FinAccBills finAccBills = new FinAccBills();
 					finAccBills.setFeeCenterList(feeCenters);
 					finAccBills.setBusinessTypeCode("HYZD");
@@ -1378,6 +1743,10 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
 					finAccBillsService.generateBill(finAccBills);
 				}
 				feeCenterService.saveOrUpdateBatch(feeCenterList);
+				String status = sysClient.getParamService("automatic.generate.voucher");
+				if ("1".equals(status)) {
+					generateVoucher(auditProecess.getCheckType(), bills.getId());
+				}
 				if ("空运出口审核".equals(auditProecess.getProcessType())) {
 					sendMessage.setMessageBody("您的空运出口审核已通过" + ",业务单号:" + proecessTemp.getBillNo() + ",驳回原因:" + auditProecess.getAuditMsg());
 				}