|
@@ -19,6 +19,7 @@ import com.fjhx.account.service.account.AccountRunningWaterService;
|
|
|
import com.fjhx.common.constant.SourceConstant;
|
|
|
import com.fjhx.common.entity.corporation.po.Corporation;
|
|
|
import com.fjhx.common.service.corporation.CorporationService;
|
|
|
+import com.fjhx.common.utils.Assert;
|
|
|
import com.fjhx.item.util.excel.util.ExcelUtil;
|
|
|
import com.fjhx.tenant.entity.dict.dto.DictTenantDataSelectDto;
|
|
|
import com.fjhx.tenant.entity.dict.vo.DictTenantDataVo;
|
|
@@ -31,6 +32,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -73,9 +75,9 @@ public class AccountRunningWaterServiceImpl extends ServiceImpl<AccountRunningWa
|
|
|
//交易结束金额
|
|
|
wrapper.le(ObjectUtil.isNotEmpty(dto.getEndAmount()), "arw.amount", dto.getEndAmount());
|
|
|
//交易开始时间
|
|
|
- wrapper.ge(ObjectUtil.isNotEmpty(dto.getStartTime()), "arw.create_time", dto.getStartTime());
|
|
|
- //交易结束金额
|
|
|
- wrapper.le(ObjectUtil.isNotEmpty(dto.getStopTime()), "arw.create_time", dto.getStopTime());
|
|
|
+ wrapper.ge(ObjectUtil.isNotEmpty(dto.getStartTime()), "arw.transaction_time", dto.getStartTime());
|
|
|
+ //交易结束时间
|
|
|
+ wrapper.le(ObjectUtil.isNotEmpty(dto.getStopTime()), "arw.transaction_time", dto.getStopTime());
|
|
|
//对方账户名称
|
|
|
wrapper.eq(ObjectUtil.isNotEmpty(dto.getName()), "arw.name", dto.getName());
|
|
|
//摘要
|
|
@@ -101,6 +103,45 @@ public class AccountRunningWaterServiceImpl extends ServiceImpl<AccountRunningWa
|
|
|
return page;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 账户流水分页
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Page<AccountRunningWaterVo> getPage1(AccountRunningWaterSelectDto dto) {
|
|
|
+ Assert.notEmpty(dto.getAccountManagementId(), "资金账户不能为空");
|
|
|
+ Assert.notEmpty(dto.getCurrency(), "币种不能为空");
|
|
|
+ //获取账户余额
|
|
|
+ AccountRemainder accountRemainder = accountRemainderService.getOne(q -> q
|
|
|
+ .eq(AccountRemainder::getAccountManagementId, dto.getAccountManagementId())
|
|
|
+ .eq(AccountRemainder::getCurrency, dto.getCurrency()));
|
|
|
+ BigDecimal remainder = accountRemainder.getRemainder();
|
|
|
+
|
|
|
+ QueryWrapper<Object> wrapper = Wrappers.query();
|
|
|
+ //资金账户
|
|
|
+ wrapper.eq(ObjectUtil.isNotEmpty(dto.getAccountManagementId()), "arw.account_management_id", dto.getAccountManagementId());
|
|
|
+ //币种
|
|
|
+ wrapper.eq(ObjectUtil.isNotEmpty(dto.getCurrency()), "arw.currency", dto.getCurrency());
|
|
|
+ wrapper.orderByDesc("arw.transaction_time");
|
|
|
+ Page<AccountRunningWaterVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
+ List<AccountRunningWaterVo> records = page.getRecords();
|
|
|
+ boolean flag = true;
|
|
|
+ for (AccountRunningWaterVo record : records) {
|
|
|
+ //如果是第一条不计算余额
|
|
|
+ if (!flag) {
|
|
|
+ //根据当前余额 反向计算 每条记录操作后的余额 收入减 支出加
|
|
|
+ remainder = "10".equals(record.getStatus()) ? remainder.subtract(record.getAmount()) : remainder.add(record.getAmount());
|
|
|
+ } else {
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
+ record.setRemainder(remainder);
|
|
|
+ }
|
|
|
+ //赋值归属公司名称
|
|
|
+ corporationService.attributeAssign(records, AccountRunningWaterVo::getCorporationId, (item, corporation) -> {
|
|
|
+ item.setCorporationName(corporation.getName());
|
|
|
+ });
|
|
|
+ return page;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public AccountRunningWaterVo detail(Long id) {
|
|
|
AccountRunningWaterVo result = baseMapper.getDetail(id);
|