|
|
@@ -76,8 +76,12 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
|
|
|
|
+import java.lang.reflect.Field;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.math.MathContext;
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
+import java.time.LocalDate;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -578,6 +582,8 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
|
|
|
public void losStlBillsCheck(LosAuditProecess auditProecess) {
|
|
|
//查看最新操作记录,防止重复提交
|
|
|
LosAuditProecess proecessTemp = baseMapper.selectById(auditProecess.getId());
|
|
|
@@ -766,6 +772,8 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
|
|
|
public void losFinInvoicesCheck(LosAuditProecess auditProecess) {
|
|
|
//查看最新操作记录,防止重复提交
|
|
|
LosAuditProecess proecessTemp = baseMapper.selectById(auditProecess.getId());
|
|
|
@@ -951,6 +959,8 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
|
|
|
public void amendsCheck(LosAuditProecess auditProecess) {
|
|
|
//查看最新操作记录,防止重复提交
|
|
|
LosAuditProecess proecessTemp = baseMapper.selectById(auditProecess.getId());
|
|
|
@@ -1208,24 +1218,46 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
|
|
|
|
|
|
private void generateVoucher(String checkType, Long id) {
|
|
|
String typeCode;
|
|
|
+ String typeName;
|
|
|
if ("HYCK-DJ".equals(checkType)) {
|
|
|
typeCode = "HYCK";
|
|
|
+ typeName = "海运出口";
|
|
|
} else if ("HYJK-DJ".equals(checkType)) {
|
|
|
typeCode = "HYJK";
|
|
|
+ typeName = "海运进口";
|
|
|
} else if ("KYCK-DJ".equals(checkType)) {
|
|
|
typeCode = "KYCK";
|
|
|
+ typeName = "空运出口";
|
|
|
} else if ("KYJK-DJ".equals(checkType)) {
|
|
|
typeCode = "KYJK";
|
|
|
+ typeName = "空运进口";
|
|
|
} else if ("sea-approve".equals(checkType)) {
|
|
|
typeCode = "SEA";
|
|
|
+ typeName = "海运出口amend";
|
|
|
} else if ("sia-approve".equals(checkType)) {
|
|
|
typeCode = "SIA";
|
|
|
+ typeName = "海运进口amend";
|
|
|
} else if ("aea-approve".equals(checkType)) {
|
|
|
typeCode = "AEA";
|
|
|
+ typeName = "空运出口amend";
|
|
|
} else if ("aia-approve".equals(checkType)) {
|
|
|
typeCode = "AIA";
|
|
|
+ typeName = "空运进口amend";
|
|
|
+ } else if ("BGSE".equals(checkType)) {
|
|
|
+ typeCode = "BGSE";
|
|
|
+ typeName = "海运出口报关";
|
|
|
+ } else if ("BGSI".equals(checkType)) {
|
|
|
+ typeCode = "BGSI";
|
|
|
+ typeName = "海运进口报关";
|
|
|
+ } else if ("BGAE".equals(checkType)) {
|
|
|
+ typeCode = "BGAE";
|
|
|
+ typeName = "空运出口报关";
|
|
|
+ } else if ("BGAI".equals(checkType)) {
|
|
|
+ typeCode = "BGAI";
|
|
|
+ typeName = "空运进口报关";
|
|
|
} else {
|
|
|
typeCode = "";
|
|
|
+ typeName = "";
|
|
|
}
|
|
|
List<BusinessType> businessTypeList = bBusinessTypeService.list(new LambdaQueryWrapper<BusinessType>()
|
|
|
.eq(BusinessType::getIsDeleted, 0)
|
|
|
@@ -1254,12 +1286,17 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
|
|
|
Dept dept = null;
|
|
|
User user = null;
|
|
|
BCorps userSrc = null;
|
|
|
+ Bills billsDetail = null;
|
|
|
+ AeaBills aeaBillsDetail = null;
|
|
|
+ CustomsDeclaration customsDeclarationDetail = null;
|
|
|
+ Amends amendsDetail = null;
|
|
|
//查询各业务模块 核算客户,核算部门,核算职员信息
|
|
|
if ("HYCK-DJ".equals(checkType) || "HYJK-DJ".equals(checkType)) {
|
|
|
Bills bills = billsMapper.selectById(id);
|
|
|
if (bills != null) {
|
|
|
+ billsDetail = bills;
|
|
|
bCorps = bCorpsService.getById(bills.getCorpId());
|
|
|
- if (ObjectUtils.isNotNull(bills.getAccDept())){
|
|
|
+ if (ObjectUtils.isNotNull(bills.getAccDept())) {
|
|
|
R<Dept> deptR = sysClient.getDept(Long.parseLong(bills.getAccDept()));
|
|
|
if (deptR.isSuccess()) {
|
|
|
dept = deptR.getData();
|
|
|
@@ -1273,12 +1310,26 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
|
|
|
} else {
|
|
|
userSrc = bCorpsService.getById(bills.getSrcId());
|
|
|
}
|
|
|
+ if ("MM".equals(bills.getBillType())) {
|
|
|
+ List<Bills> billsList = billsMapper.selectList(new LambdaQueryWrapper<Bills>()
|
|
|
+ .select(Bills::getId)
|
|
|
+ .eq(Bills::getMasterId, bills.getId()));
|
|
|
+ if (!billsList.isEmpty()) {
|
|
|
+ List<Long> billsId = billsList.stream().map(Bills::getId).collect(Collectors.toList());
|
|
|
+ List<FeeCenter> feeCenters = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
|
|
|
+ .in(FeeCenter::getPid, billsId));
|
|
|
+ if (!feeCenters.isEmpty()) {
|
|
|
+ feeCenterList.addAll(feeCenters);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
} else if ("KYCK-DJ".equals(checkType) || "KYJK-DJ".equals(checkType)) {
|
|
|
AeaBills bills = aeaBillsMapper.selectById(id);
|
|
|
if (bills != null) {
|
|
|
+ aeaBillsDetail = bills;
|
|
|
bCorps = bCorpsService.getById(bills.getCorpId());
|
|
|
- if (ObjectUtils.isNotNull(bills.getAccDept())){
|
|
|
+ if (ObjectUtils.isNotNull(bills.getAccDept())) {
|
|
|
R<Dept> deptR = sysClient.getDept(Long.parseLong(bills.getAccDept()));
|
|
|
if (deptR.isSuccess()) {
|
|
|
dept = deptR.getData();
|
|
|
@@ -1292,13 +1343,27 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
|
|
|
} else {
|
|
|
userSrc = bCorpsService.getById(bills.getSrcId());
|
|
|
}
|
|
|
+ if ("MM".equals(bills.getBillType())) {
|
|
|
+ List<Bills> billsList = billsMapper.selectList(new LambdaQueryWrapper<Bills>()
|
|
|
+ .select(Bills::getId)
|
|
|
+ .eq(Bills::getMasterId, bills.getId()));
|
|
|
+ if (!billsList.isEmpty()) {
|
|
|
+ List<Long> billsId = billsList.stream().map(Bills::getId).collect(Collectors.toList());
|
|
|
+ List<FeeCenter> feeCenters = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
|
|
|
+ .in(FeeCenter::getPid, billsId));
|
|
|
+ if (!feeCenters.isEmpty()) {
|
|
|
+ feeCenterList.addAll(feeCenters);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
} else if ("BGSE".equals(checkType) || "BGSI".equals(checkType) ||
|
|
|
"BGAE".equals(checkType) || "BGAI".equals(checkType)) {
|
|
|
CustomsDeclaration bills = customsDeclarationMapper.selectById(id);
|
|
|
if (bills != null) {
|
|
|
+ customsDeclarationDetail = bills;
|
|
|
bCorps = bCorpsService.getById(bills.getCorpId());
|
|
|
- if (ObjectUtils.isNotNull(bills.getAccDept())){
|
|
|
+ if (ObjectUtils.isNotNull(bills.getAccDept())) {
|
|
|
R<Dept> deptR = sysClient.getDept(Long.parseLong(bills.getAccDept()));
|
|
|
if (deptR.isSuccess()) {
|
|
|
dept = deptR.getData();
|
|
|
@@ -1317,8 +1382,9 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
|
|
|
"aea-approve".equals(checkType) || "aia-approve".equals(checkType)) {
|
|
|
Amends bills = amendsMapper.selectById(id);
|
|
|
if (bills != null) {
|
|
|
+ amendsDetail = bills;
|
|
|
bCorps = bCorpsService.getById(bills.getCorpId());
|
|
|
- if (ObjectUtils.isNotNull(bills.getAccDept())){
|
|
|
+ if (ObjectUtils.isNotNull(bills.getAccDept())) {
|
|
|
R<Dept> deptR = sysClient.getDept(Long.parseLong(bills.getAccDept()));
|
|
|
if (deptR.isSuccess()) {
|
|
|
dept = deptR.getData();
|
|
|
@@ -1335,6 +1401,19 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
|
|
|
} else {
|
|
|
userSrc = bCorpsService.getById(bills1.getSrcId());
|
|
|
}
|
|
|
+ if ("MM".equals(bills1.getBillType())) {
|
|
|
+ List<Bills> billsList = billsMapper.selectList(new LambdaQueryWrapper<Bills>()
|
|
|
+ .select(Bills::getId)
|
|
|
+ .eq(Bills::getMasterId, bills.getId()));
|
|
|
+ if (!billsList.isEmpty()) {
|
|
|
+ List<Long> billsId = billsList.stream().map(Bills::getId).collect(Collectors.toList());
|
|
|
+ List<FeeCenter> feeCenters = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
|
|
|
+ .in(FeeCenter::getPid, billsId));
|
|
|
+ if (!feeCenters.isEmpty()) {
|
|
|
+ feeCenterList.addAll(feeCenters);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
AeaBills aeaBills = aeaBillsMapper.selectById(id);
|
|
|
@@ -1347,14 +1426,27 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
|
|
|
} else {
|
|
|
userSrc = bCorpsService.getById(aeaBills.getSrcId());
|
|
|
}
|
|
|
+ if ("MM".equals(aeaBills.getBillType())) {
|
|
|
+ List<Bills> billsList = billsMapper.selectList(new LambdaQueryWrapper<Bills>()
|
|
|
+ .select(Bills::getId)
|
|
|
+ .eq(Bills::getMasterId, bills.getId()));
|
|
|
+ if (!billsList.isEmpty()) {
|
|
|
+ List<Long> billsId = billsList.stream().map(Bills::getId).collect(Collectors.toList());
|
|
|
+ List<FeeCenter> feeCenters = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
|
|
|
+ .in(FeeCenter::getPid, billsId));
|
|
|
+ if (!feeCenters.isEmpty()) {
|
|
|
+ feeCenterList.addAll(feeCenters);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//计算 应收,应付人民币,美元各个合计金额
|
|
|
- BigDecimal amountC = feeCenterList.stream().filter(e -> "RMB".equals(e.getCurCode()) && "C".equals(e.getDc())).map(FeeCenter::getAmount)
|
|
|
+ BigDecimal amountC = feeCenterList.stream().filter(e -> "CNY".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)
|
|
|
+ BigDecimal amountD = feeCenterList.stream().filter(e -> "CNY".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);
|
|
|
@@ -1363,7 +1455,20 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
|
|
|
|
|
|
//固定借,贷金额数组
|
|
|
BigDecimal[] amount = new BigDecimal[]{amountD, amountD, amountC, amountC, amountDUsd, amountDUsd, amountCUsd, amountCUsd};
|
|
|
-
|
|
|
+ BigDecimal rateC = new BigDecimal("0.00");
|
|
|
+ BigDecimal rateCRmb = new BigDecimal("0.00");
|
|
|
+ List<FeeCenter> rateListC = feeCenterList.stream().filter(e -> "USD".equals(e.getCurCode()) && "C".equals(e.getDc())).collect(Collectors.toList());
|
|
|
+ for (FeeCenter item : rateListC) {
|
|
|
+ rateCRmb = rateCRmb.add(item.getAmount().multiply(item.getExrate()));
|
|
|
+ }
|
|
|
+ rateC = rateCRmb.divide(amountCUsd, MathContext.DECIMAL32).setScale(4, RoundingMode.HALF_UP);
|
|
|
+ BigDecimal rateD = new BigDecimal("0.00");
|
|
|
+ BigDecimal rateDRmb = new BigDecimal("0.00");
|
|
|
+ List<FeeCenter> rateListD = feeCenterList.stream().filter(e -> "USD".equals(e.getCurCode()) && "D".equals(e.getDc())).collect(Collectors.toList());
|
|
|
+ for (FeeCenter item : rateListD) {
|
|
|
+ rateDRmb = rateDRmb.add(item.getAmount().multiply(item.getExrate()));
|
|
|
+ }
|
|
|
+ rateD = rateDRmb.divide(amountDUsd, MathContext.DECIMAL32).setScale(4, RoundingMode.HALF_UP);
|
|
|
//创建凭证主表信息
|
|
|
FinVouchers finVouchers = new FinVouchers();
|
|
|
String deptId = "";
|
|
|
@@ -1390,7 +1495,22 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
|
|
|
throw new RuntimeException("生成订单编号失败");
|
|
|
}
|
|
|
finVouchers.setBillNo((String) clientBillNo.getData());
|
|
|
+ finVouchers.setVoucherType("记");
|
|
|
+ BusinessBillNo businessBillNo1 = new BusinessBillNo();
|
|
|
+ businessBillNo1.setBusinessTypeId(businessType.getId());
|
|
|
+ businessBillNo1.setCode("记");
|
|
|
+ R voucherNo = businessBillNoService.getVoucherNoLos(businessBillNo1);
|
|
|
+ if (!clientBillNo.isSuccess()) {
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ throw new RuntimeException("生成凭证号失败");
|
|
|
+ }
|
|
|
+ finVouchers.setVoucherNo((String) voucherNo.getData());
|
|
|
+ finVouchers.setVoucherSource(typeName);
|
|
|
finVouchers.setVoucherDate(new Date());
|
|
|
+ LocalDate currentDate = LocalDate.now();
|
|
|
+ finVouchers.setAccountYear(currentDate.getYear());
|
|
|
+ finVouchers.setAccountMonth(currentDate.getMonthValue());
|
|
|
+ finVouchers.setAccountDay(currentDate.getDayOfMonth());
|
|
|
finVouchers.setCreateTime(new Date());
|
|
|
finVouchers.setCreateUser(AuthUtil.getUserId());
|
|
|
finVouchers.setCreateUserName(AuthUtil.getUserName());
|
|
|
@@ -1406,6 +1526,7 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
|
|
|
.eq(Accounts::getStatus, 0)
|
|
|
.apply("find_in_set(code,'" + accountsCode + "')"));
|
|
|
List<FinVouchersItems> finVouchersItemsList = new ArrayList<>();
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
int count = 0;
|
|
|
//循环复制凭证明细信息
|
|
|
for (VoucherTemplate item : voucherTemplateList) {
|
|
|
@@ -1436,14 +1557,14 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
|
|
|
finVouchersItems.setAccountProperty(accounts.getProperty());
|
|
|
finVouchersItems.setAccountLevel(accounts.getLevel());
|
|
|
finVouchersItems.setDc(item.getAmountDirection());
|
|
|
- finVouchersItems.setCurCode(accounts.getCurCode());
|
|
|
- finVouchersItems.setExrate(accounts.getExrate());
|
|
|
+ finVouchersItems.setCurCode(item.getCurrencyCode());
|
|
|
/*判断是否人民币,美元
|
|
|
* 人民币 判断模版借贷方向与科目借贷方向是否一致 true D+D=正 D+C=负 C+C=正 C+D=负
|
|
|
* 美元 判断模版借贷方向与科目借贷方向是否一致 true D+D=正 D+C=负 C+C=正 C+D=负
|
|
|
* 借或贷金额为零时跳过本次循环
|
|
|
* */
|
|
|
- if ("RMB".equals(item.getCurrencyCode())) {
|
|
|
+ if ("CNY".equals(item.getCurrencyCode())) {
|
|
|
+ finVouchersItems.setExrate(new BigDecimal("1"));
|
|
|
if ("D".equals(item.getAmountDirection())) {
|
|
|
if ("D".equals(accounts.getDc())) {
|
|
|
if (new BigDecimal("0.00").compareTo(amount[count - 1]) != 0) {
|
|
|
@@ -1452,7 +1573,7 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
|
|
|
continue;
|
|
|
}
|
|
|
} else {
|
|
|
- finVouchersItems.setAmountDr(new BigDecimal("0.00").subtract(amount[count - 1]));
|
|
|
+ finVouchersItems.setAmountCr(new BigDecimal("0.00").subtract(amount[count - 1]));
|
|
|
}
|
|
|
} else {
|
|
|
if ("D".equals(accounts.getDc())) {
|
|
|
@@ -1467,21 +1588,27 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
|
|
|
}
|
|
|
} else {
|
|
|
if ("D".equals(item.getAmountDirection())) {
|
|
|
+ finVouchersItems.setExrate(rateD);
|
|
|
if ("D".equals(accounts.getDc())) {
|
|
|
if (new BigDecimal("0.00").compareTo(amount[count - 1]) != 0) {
|
|
|
finVouchersItems.setAmountDrUsd(amount[count - 1]);
|
|
|
+ finVouchersItems.setAmountDr(finVouchersItems.getAmountDrUsd().multiply(rateD));
|
|
|
} else {
|
|
|
continue;
|
|
|
}
|
|
|
} else {
|
|
|
- finVouchersItems.setAmountDrUsd(new BigDecimal("0.00").subtract(amount[count - 1]));
|
|
|
+ finVouchersItems.setAmountCrUsd(new BigDecimal("0.00").subtract(amount[count - 1]));
|
|
|
+ finVouchersItems.setAmountCr(finVouchersItems.getAmountCrUsd().multiply(rateD));
|
|
|
}
|
|
|
} else {
|
|
|
+ finVouchersItems.setExrate(rateC);
|
|
|
if ("D".equals(accounts.getDc())) {
|
|
|
finVouchersItems.setAmountDrUsd(new BigDecimal("0.00").subtract(amount[count - 1]));
|
|
|
+ finVouchersItems.setAmountDr(finVouchersItems.getAmountDrUsd().multiply(rateC));
|
|
|
} else {
|
|
|
if (new BigDecimal("0.00").compareTo(amount[count - 1]) != 0) {
|
|
|
finVouchersItems.setAmountCrUsd(amount[count - 1]);
|
|
|
+ finVouchersItems.setAmountCr(finVouchersItems.getAmountCrUsd().multiply(rateC));
|
|
|
} else {
|
|
|
continue;
|
|
|
}
|
|
|
@@ -1489,8 +1616,10 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
|
|
|
}
|
|
|
}
|
|
|
//计算借,贷人民币与美金合计人民币金额
|
|
|
- finVouchersItems.setAmountDrLoc(finVouchersItems.getAmountDr().add(bCurrencyService.converterCny("USD", finVouchersItems.getAmountDrUsd(), "D")));
|
|
|
- finVouchersItems.setAmountCrLoc(finVouchersItems.getAmountCr().add(bCurrencyService.converterCny("USD", finVouchersItems.getAmountCrUsd(), "C")));
|
|
|
+ finVouchersItems.setAmountDrLoc(ObjectUtils.isNull(finVouchersItems.getAmountDr()) ? new BigDecimal("0") : finVouchersItems.getAmountDr()
|
|
|
+ .add(bCurrencyService.converterCny("USD", ObjectUtils.isNull(finVouchersItems.getAmountDrUsd()) ? new BigDecimal("0") : finVouchersItems.getAmountDrUsd(), "D")));
|
|
|
+ finVouchersItems.setAmountCrLoc(ObjectUtils.isNull(finVouchersItems.getAmountCr()) ? new BigDecimal("0") : finVouchersItems.getAmountCr()
|
|
|
+ .add(bCurrencyService.converterCny("USD", ObjectUtils.isNull(finVouchersItems.getAmountCrUsd()) ? new BigDecimal("0") : finVouchersItems.getAmountCrUsd(), "C")));
|
|
|
finVouchersItems.setIsCorp(accounts.getIsCorp());
|
|
|
//判断是否核算客户 true 向明细中客户字段复制
|
|
|
if (1 == finVouchersItems.getIsCorp()) {
|
|
|
@@ -1525,12 +1654,111 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
|
|
|
throw new RuntimeException("未找到科目信息");
|
|
|
}
|
|
|
finVouchersItems.setLineNo(count);
|
|
|
+ StringBuilder formulasValue = new StringBuilder();
|
|
|
+ formulasValue.append(" ");
|
|
|
+ String formulasData = item.getAdditionalFormulas();
|
|
|
+ String[] arr = formulasData.split(",");
|
|
|
+ for (String i : arr) {
|
|
|
+ if ("HYCK-DJ".equals(checkType) || "HYJK-DJ".equals(checkType)) {
|
|
|
+ try {
|
|
|
+ Field field = Bills.class.getDeclaredField(i);
|
|
|
+ field.setAccessible(true);
|
|
|
+ if (field.getType().equals(Date.class)) {
|
|
|
+ if (ObjectUtils.isNotNull(field.get(billsDetail))) {
|
|
|
+ String formattedDate = dateFormat.format(field.get(billsDetail));
|
|
|
+ formulasValue.append(formattedDate).append(" ");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ formulasValue.append(field.get(billsDetail)).append(" ");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ } else if ("KYCK-DJ".equals(checkType) || "KYJK-DJ".equals(checkType)) {
|
|
|
+ try {
|
|
|
+ Field field = AeaBills.class.getDeclaredField(i);
|
|
|
+ field.setAccessible(true);
|
|
|
+ if (field.getType().equals(Date.class)) {
|
|
|
+ if (ObjectUtils.isNotNull(field.get(aeaBillsDetail))) {
|
|
|
+ String formattedDate = dateFormat.format(field.get(aeaBillsDetail));
|
|
|
+ formulasValue.append(formattedDate).append(" ");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ formulasValue.append(field.get(aeaBillsDetail)).append(" ");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ } else if ("BGSE".equals(checkType) || "BGSI".equals(checkType) ||
|
|
|
+ "BGAE".equals(checkType) || "BGAI".equals(checkType)) {
|
|
|
+ try {
|
|
|
+ Field field = CustomsDeclaration.class.getDeclaredField(i);
|
|
|
+ field.setAccessible(true);
|
|
|
+ if (field.getType().equals(Date.class)) {
|
|
|
+ if (ObjectUtils.isNotNull(field.get(customsDeclarationDetail))) {
|
|
|
+ String formattedDate = dateFormat.format(field.get(customsDeclarationDetail));
|
|
|
+ formulasValue.append(formattedDate).append(" ");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ formulasValue.append(field.get(customsDeclarationDetail)).append(" ");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ } else if ("sea-approve".equals(checkType) || "sia-approve".equals(checkType) ||
|
|
|
+ "aea-approve".equals(checkType) || "aia-approve".equals(checkType)) {
|
|
|
+ try {
|
|
|
+ Field field = Amends.class.getDeclaredField(i);
|
|
|
+ field.setAccessible(true);
|
|
|
+ if (field.getType().equals(Date.class)) {
|
|
|
+ if (ObjectUtils.isNotNull(field.get(amendsDetail))) {
|
|
|
+ String formattedDate = dateFormat.format(field.get(amendsDetail));
|
|
|
+ formulasValue.append(formattedDate).append(" ");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ formulasValue.append(field.get(amendsDetail)).append(" ");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ finVouchersItems.setDescr(item.getStaticValue() + formulasValue);
|
|
|
finVouchersItemsList.add(finVouchersItems);
|
|
|
}
|
|
|
finVouchersItemsService.saveOrUpdateBatch(finVouchersItemsList);
|
|
|
+ BigDecimal amountDrCNY = new BigDecimal("0.00");
|
|
|
+ BigDecimal amountCrCNY = new BigDecimal("0.00");
|
|
|
+ BigDecimal amountDrUSD = new BigDecimal("0.00");
|
|
|
+ BigDecimal amountCrUSD = new BigDecimal("0.00");
|
|
|
+ amountDrCNY = amountDrCNY.add(finVouchersItemsList.stream()
|
|
|
+ .filter(e -> "CNY".equals(e.getCurCode()) && "D".equals(e.getDc())).map(FinVouchersItems::getAmountDr)
|
|
|
+ .filter(ObjectUtils::isNotNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ finVouchers.setAmountDr(amountDrCNY);
|
|
|
+ amountCrCNY = amountCrCNY.add(finVouchersItemsList.stream()
|
|
|
+ .filter(e -> "CNY".equals(e.getCurCode()) && "C".equals(e.getDc())).map(FinVouchersItems::getAmountCr)
|
|
|
+ .filter(ObjectUtils::isNotNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ finVouchers.setAmountCr(amountCrCNY);
|
|
|
+ amountDrUSD = amountDrUSD.add(finVouchersItemsList.stream()
|
|
|
+ .filter(e -> "USD".equals(e.getCurCode()) && "D".equals(e.getDc())).map(FinVouchersItems::getAmountDrUsd)
|
|
|
+ .filter(ObjectUtils::isNotNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ finVouchers.setAmountDrUsd(amountDrUSD);
|
|
|
+ amountCrUSD = amountCrUSD.add(finVouchersItemsList.stream()
|
|
|
+ .filter(e -> "USD".equals(e.getCurCode()) && "C".equals(e.getDc())).map(FinVouchersItems::getAmountCrUsd)
|
|
|
+ .filter(ObjectUtils::isNotNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ finVouchers.setAmountCrUsd(amountCrUSD);
|
|
|
+ finVouchers.setAmountDrLoc(amountDrCNY.add(bCurrencyService.converterCny("USD", amountDrUSD, "D")));
|
|
|
+ finVouchers.setAmountCrLoc(amountCrCNY.add(bCurrencyService.converterCny("USD", amountCrUSD, "C")));
|
|
|
+ finVouchers.setDescr(finVouchersItemsList.get(0).getDescr());
|
|
|
+ if (finVouchersItemsList.stream().anyMatch(e -> "USD".equals(e.getCurCode()))) {
|
|
|
+ finVouchers.setIsForeign(1);
|
|
|
+ }
|
|
|
+ finVouchersMapper.updateById(finVouchers);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
|
|
|
public void losAeBillsCheck(LosAuditProecess auditProecess) {
|
|
|
//查看最新操作记录,防止重复提交
|
|
|
LosAuditProecess proecessTemp = baseMapper.selectById(auditProecess.getId());
|
|
|
@@ -1813,6 +2041,8 @@ public class AuditProecessServiceImpl extends ServiceImpl<AuditProecessMapper, L
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
|
|
|
public void losCustomsDeclarationCheck(LosAuditProecess auditProecess) {
|
|
|
//查看最新操作记录,防止重复提交
|
|
|
LosAuditProecess proecessTemp = baseMapper.selectById(auditProecess.getId());
|