|
@@ -16,10 +16,12 @@ import com.fjhx.account.entity.account.po.AccountManagement;
|
|
|
import com.fjhx.account.entity.account.po.AccountRemainder;
|
|
|
import com.fjhx.account.entity.account.po.AccountRunningWater;
|
|
|
import com.fjhx.account.entity.account.vo.AccountRunningWaterVo;
|
|
|
+import com.fjhx.account.entity.tax.po.TaxRefundDetails;
|
|
|
import com.fjhx.account.mapper.account.AccountRunningWaterMapper;
|
|
|
import com.fjhx.account.service.account.AccountManagementService;
|
|
|
import com.fjhx.account.service.account.AccountRemainderService;
|
|
|
import com.fjhx.account.service.account.AccountRunningWaterService;
|
|
|
+import com.fjhx.account.service.tax.TaxRefundDetailsService;
|
|
|
import com.fjhx.common.constant.SourceConstant;
|
|
|
import com.fjhx.common.entity.corporation.po.Corporation;
|
|
|
import com.fjhx.common.service.corporation.CorporationService;
|
|
@@ -66,6 +68,8 @@ public class AccountRunningWaterServiceImpl extends ServiceImpl<AccountRunningWa
|
|
|
|
|
|
@Autowired
|
|
|
private AccountManagementService accountManagementService;
|
|
|
+ @Autowired
|
|
|
+ private TaxRefundDetailsService taxRefundDetailsService;
|
|
|
|
|
|
@Override
|
|
|
public Page<AccountRunningWaterVo> getPage(AccountRunningWaterSelectDto dto) {
|
|
@@ -141,6 +145,17 @@ public class AccountRunningWaterServiceImpl extends ServiceImpl<AccountRunningWa
|
|
|
// 币种
|
|
|
wrapper.eq(ObjectUtil.isNotEmpty(dto.getCurrency()), "arw.currency", dto.getCurrency());
|
|
|
wrapper.orderByDesc("arw.transaction_time");
|
|
|
+
|
|
|
+ //获取当前分页之前的数据先处理余额
|
|
|
+ Integer size = (dto.getPageNum() - 1) * dto.getPageSize();
|
|
|
+ List<AccountRunningWater> amounts = baseMapper.getAccountRunningWaterAmount(wrapper, size);
|
|
|
+ //收入合
|
|
|
+ BigDecimal incomeSum = amounts.stream().filter(item -> "10".equals(item.getStatus())).map(AccountRunningWater::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ //支出合
|
|
|
+ BigDecimal expenditureSum = amounts.stream().filter(item -> "20".equals(item.getStatus())).map(AccountRunningWater::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ remainder = remainder.subtract(incomeSum).add(expenditureSum);
|
|
|
+
|
|
|
+ //获取分页数据
|
|
|
Page<AccountRunningWaterVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
List<AccountRunningWaterVo> records = page.getRecords();
|
|
|
for (AccountRunningWaterVo record : records) {
|
|
@@ -172,7 +187,7 @@ public class AccountRunningWaterServiceImpl extends ServiceImpl<AccountRunningWa
|
|
|
@Override
|
|
|
@DSTransactional
|
|
|
public void add(AccountRunningWaterDto dto) {
|
|
|
- if(StringUtils.isEmpty(dto.getCurrency())){
|
|
|
+ if (StringUtils.isEmpty(dto.getCurrency())) {
|
|
|
throw new ServiceException("币种不能为空");
|
|
|
}
|
|
|
dto.setRate(ExchangeRateUtil.getCnyToCodeRate(dto.getCurrency()));
|
|
@@ -348,4 +363,17 @@ public class AccountRunningWaterServiceImpl extends ServiceImpl<AccountRunningWa
|
|
|
return dictTenantDataServiceList;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 退税添加
|
|
|
+ */
|
|
|
+ @DSTransactional
|
|
|
+ @Override
|
|
|
+ public void taxRefund(AccountRunningWaterDto dto) {
|
|
|
+ dto.setStatus("10");
|
|
|
+ add(dto);
|
|
|
+ List<TaxRefundDetails> taxRefundDetailsList = dto.getTaxRefundDetailsList();
|
|
|
+ taxRefundDetailsList.forEach(item -> item.setAccountRunningWaterId(dto.getId()));
|
|
|
+ taxRefundDetailsService.saveBatch(taxRefundDetailsList);
|
|
|
+ }
|
|
|
+
|
|
|
}
|