|
|
@@ -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());
|
|
|
}
|