|
@@ -353,26 +353,44 @@ public class FundAccountDetailServiceImpl extends ServiceImpl<FundAccountDetailM
|
|
|
throw new ServiceException("租户异常");
|
|
|
}
|
|
|
condition.put("tenantId", AuthUtil.getTenantId());
|
|
|
- //查询出账户货币得总余额
|
|
|
+ // 查询出账户货币得总余额
|
|
|
FundResult result = iFundAccountService.sumCurrMoney(condition);
|
|
|
- //查询出收支总金额
|
|
|
+
|
|
|
+ // 查询出收支总金额
|
|
|
List<FundAccountDetail> list = baseMapper.getSumMoneyGroupByCT(condition);
|
|
|
for (FundAccountDetail f : list) {
|
|
|
- if (f.getType() == FundDetailTypeEnum.INCOME.getKey()) {//收入
|
|
|
- if (f.getCurrencyType() == CurrencyTypeEnum.RMB.getKey()) {//人民币
|
|
|
- result.setRMBIncome(f.getMoney());
|
|
|
- } else if (f.getCurrencyType() == CurrencyTypeEnum.USA.getKey()) {//美元
|
|
|
- result.setDOLIncome(f.getMoney());
|
|
|
- } else if (f.getCurrencyType() == CurrencyTypeEnum.EURO.getKey()) {//欧元
|
|
|
- result.setEUROIncome(f.getMoney());
|
|
|
+ // 收入
|
|
|
+ if (f.getType() == FundDetailTypeEnum.INCOME.getKey()) {
|
|
|
+ switch (CurrencyTypeEnum.getEnum(f.getCurrencyType())) {
|
|
|
+ case RMB:
|
|
|
+ result.setRMBIncome(f.getMoney());
|
|
|
+ break;
|
|
|
+ case USA:
|
|
|
+ result.setDOLIncome(f.getMoney());
|
|
|
+ break;
|
|
|
+ case EURO:
|
|
|
+ result.setEUROIncome(f.getMoney());
|
|
|
+ break;
|
|
|
+ case STERLING:
|
|
|
+ result.setSterlingIncome(f.getMoney());
|
|
|
+ break;
|
|
|
}
|
|
|
- } else {//支出
|
|
|
- if (f.getCurrencyType() == CurrencyTypeEnum.RMB.getKey()) {//人民币
|
|
|
- result.setRMBExpend(f.getMoney());
|
|
|
- } else if (f.getCurrencyType() == CurrencyTypeEnum.USA.getKey()) {//美元
|
|
|
- result.setDOLExpend(f.getMoney());
|
|
|
- } else if (f.getCurrencyType() == CurrencyTypeEnum.EURO.getKey()) {//欧元
|
|
|
- result.setEUROExpend(f.getMoney());
|
|
|
+ }
|
|
|
+ // 支出
|
|
|
+ else {
|
|
|
+ switch (CurrencyTypeEnum.getEnum(f.getCurrencyType())) {
|
|
|
+ case RMB:
|
|
|
+ result.setRMBExpend(f.getMoney());
|
|
|
+ break;
|
|
|
+ case USA:
|
|
|
+ result.setDOLExpend(f.getMoney());
|
|
|
+ break;
|
|
|
+ case EURO:
|
|
|
+ result.setEUROExpend(f.getMoney());
|
|
|
+ break;
|
|
|
+ case STERLING:
|
|
|
+ result.setSterlingExpend(f.getMoney());
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -496,6 +514,10 @@ public class FundAccountDetailServiceImpl extends ServiceImpl<FundAccountDetailM
|
|
|
if (Func.isEmpty(fundAccount.getEuroAmount()) || fundAccount.getEuroAmount().compareTo(detail.getMoney()) == -1) {
|
|
|
return false;
|
|
|
}
|
|
|
+ case 4:
|
|
|
+ if (Func.isEmpty(fundAccount.getSterlingAmount()) || fundAccount.getSterlingAmount().compareTo(detail.getMoney()) == -1) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
return true;
|
|
@@ -1189,7 +1211,7 @@ public class FundAccountDetailServiceImpl extends ServiceImpl<FundAccountDetailM
|
|
|
.eq(FundAccount::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(FundAccount::getDelFleg, 0)
|
|
|
.select(BasicsEntity::getId, FundAccount::getName, FundAccount::getAccountNumber,
|
|
|
- FundAccount::getRmbAmount, FundAccount::getDollarAmount, FundAccount::getEuroAmount));
|
|
|
+ FundAccount::getRmbAmount, FundAccount::getDollarAmount, FundAccount::getEuroAmount,FundAccount::getSterlingAmount));
|
|
|
|
|
|
if (accountList.size() == 0) {
|
|
|
return new ArrayList<>();
|
|
@@ -1232,6 +1254,9 @@ public class FundAccountDetailServiceImpl extends ServiceImpl<FundAccountDetailM
|
|
|
detail.setEuroAmount(item.getEuroAmount());
|
|
|
// detail.setEuroIncome(BigDecimal.ZERO);
|
|
|
// detail.setEuroExpenditure(BigDecimal.ZERO);
|
|
|
+
|
|
|
+ detail.setSterlingAmount(item.getSterlingAmount());
|
|
|
+
|
|
|
detailList.add(detail);
|
|
|
|
|
|
yearMonthDay = DateUtil.offsetDay(yearMonthDay, -1);
|
|
@@ -1247,6 +1272,7 @@ public class FundAccountDetailServiceImpl extends ServiceImpl<FundAccountDetailM
|
|
|
detail.setRmbAmount(item.getRmbAmount());
|
|
|
detail.setDollarAmount(item.getDollarAmount());
|
|
|
detail.setEuroAmount(item.getEuroAmount());
|
|
|
+ detail.setSterlingAmount(item.getSterlingAmount());
|
|
|
// if (integerMapMap == null) {
|
|
|
// detail.setRmbIncome(BigDecimal.ZERO);
|
|
|
// detail.setRmbExpenditure(BigDecimal.ZERO);
|
|
@@ -1258,14 +1284,9 @@ public class FundAccountDetailServiceImpl extends ServiceImpl<FundAccountDetailM
|
|
|
if (integerMapMap != null) {
|
|
|
// Map<收支类型(1:收入 2:支出),改变数量>
|
|
|
Map<Integer, BigDecimal> rmbMap = integerMapMap.get(CurrencyTypeEnum.RMB.getKey());
|
|
|
- // if (rmbMap == null) {
|
|
|
- // detail.setRmbIncome(BigDecimal.ZERO);
|
|
|
- // detail.setRmbExpenditure(BigDecimal.ZERO);
|
|
|
- // }
|
|
|
-
|
|
|
if (rmbMap != null) {
|
|
|
- BigDecimal expenditure = rmbMap.get(2);
|
|
|
BigDecimal income = rmbMap.get(1);
|
|
|
+ BigDecimal expenditure = rmbMap.get(2);
|
|
|
|
|
|
detail.setRmbIncome(income);
|
|
|
detail.setRmbExpenditure(expenditure);
|
|
@@ -1284,13 +1305,9 @@ public class FundAccountDetailServiceImpl extends ServiceImpl<FundAccountDetailM
|
|
|
|
|
|
// Map<收支类型(1:收入 2:支出),改变数量>
|
|
|
Map<Integer, BigDecimal> dollarMap = integerMapMap.get(CurrencyTypeEnum.USA.getKey());
|
|
|
- // if (dollarMap == null) {
|
|
|
- // detail.setDollarIncome(BigDecimal.ZERO);
|
|
|
- // detail.setRmbExpenditure(BigDecimal.ZERO);
|
|
|
- // }
|
|
|
if (dollarMap != null) {
|
|
|
- BigDecimal expenditure = dollarMap.get(2);
|
|
|
BigDecimal income = dollarMap.get(1);
|
|
|
+ BigDecimal expenditure = dollarMap.get(2);
|
|
|
|
|
|
detail.setDollarIncome(income);
|
|
|
detail.setDollarExpenditure(expenditure);
|
|
@@ -1309,13 +1326,9 @@ public class FundAccountDetailServiceImpl extends ServiceImpl<FundAccountDetailM
|
|
|
|
|
|
// Map<收支类型(1:收入 2:支出),改变数量>
|
|
|
Map<Integer, BigDecimal> euroMap = integerMapMap.get(CurrencyTypeEnum.EURO.getKey());
|
|
|
- // if (euroMap == null) {
|
|
|
- // detail.setEuroIncome(BigDecimal.ZERO);
|
|
|
- // detail.setEuroExpenditure(BigDecimal.ZERO);
|
|
|
- // }
|
|
|
if (euroMap != null) {
|
|
|
- BigDecimal expenditure = cn.hutool.core.util.ObjectUtil.defaultIfNull(euroMap.get(2), BigDecimal.ZERO);
|
|
|
- BigDecimal income = cn.hutool.core.util.ObjectUtil.defaultIfNull(euroMap.get(1), BigDecimal.ZERO);
|
|
|
+ BigDecimal income = euroMap.get(1);
|
|
|
+ BigDecimal expenditure = euroMap.get(2);
|
|
|
|
|
|
detail.setEuroIncome(income);
|
|
|
detail.setEuroExpenditure(expenditure);
|
|
@@ -1331,6 +1344,28 @@ public class FundAccountDetailServiceImpl extends ServiceImpl<FundAccountDetailM
|
|
|
item.setEuroAmount(euroAmount);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // Map<收支类型(1:收入 2:支出),改变数量>
|
|
|
+ Map<Integer, BigDecimal> sterlingMap = integerMapMap.get(CurrencyTypeEnum.STERLING.getKey());
|
|
|
+ if (sterlingMap != null) {
|
|
|
+ BigDecimal income = sterlingMap.get(1);
|
|
|
+ BigDecimal expenditure = sterlingMap.get(2);
|
|
|
+
|
|
|
+ detail.setSterlingIncome(income);
|
|
|
+ detail.setSterlingExpenditure(expenditure);
|
|
|
+
|
|
|
+ BigDecimal sterlingAmount = item.getEuroAmount();
|
|
|
+ if (sterlingAmount != null) {
|
|
|
+ if (income != null) {
|
|
|
+ sterlingAmount = sterlingAmount.subtract(income);
|
|
|
+ }
|
|
|
+ if (expenditure != null) {
|
|
|
+ sterlingAmount = sterlingAmount.add(expenditure);
|
|
|
+ }
|
|
|
+ item.setSterlingAmount(sterlingAmount);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
detailList.add(detail);
|
|
|
yearMonthDay = DateUtil.offsetDay(yearMonthDay, -1);
|
|
@@ -1401,6 +1436,12 @@ public class FundAccountDetailServiceImpl extends ServiceImpl<FundAccountDetailM
|
|
|
if (euroAmountChange != null) {
|
|
|
fundAccount.setEuroAmount(fundAccount.getEuroAmount().add(euroAmountChange));
|
|
|
}
|
|
|
+
|
|
|
+ BigDecimal sterlingAmountChange = itemMap.get(CurrencyTypeEnum.STERLING.getKey());
|
|
|
+ if (sterlingAmountChange != null) {
|
|
|
+ fundAccount.setSterlingAmount(fundAccount.getSterlingAmount().add(sterlingAmountChange));
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|