| | |
| | |
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public BigDecimal repayDebtByUid(Long uid, BigDecimal money) throws TeamDividentsDebtException {
|
| | | public BigDecimal repayDebtByUid(Long uid, Date maxEstimatePayTime, BigDecimal money)
|
| | | throws TeamDividentsDebtException {
|
| | | // 还钱
|
| | | long count = countNeedRepayDebt(uid);
|
| | | long count = countNeedRepayDebt(uid, maxEstimatePayTime);
|
| | | int page = (int) (count % 200 == 0 ? count / 200 : count / 200 + 1);
|
| | | List<TeamDividentsDebt> totalList = new ArrayList<>();
|
| | | for (int i = 0; i < page; i++) {
|
| | | List<TeamDividentsDebt> tempList = listNeedRepayDebt(uid, i + 1, 200);
|
| | | List<TeamDividentsDebt> tempList = listNeedRepayDebt(uid, maxEstimatePayTime, i + 1, 200);
|
| | | if (tempList != null && tempList.size() > 0) {
|
| | | totalList.addAll(tempList);
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public List<TeamDividentsDebt> listNeedRepayDebt(Long uid, int page, int count) {
|
| | | return teamDividentsDebtMapper.listByLeftMoneyAndUid(new BigDecimal("0.01"), null, uid, (page - 1) * count,
|
| | | count);
|
| | | public List<TeamDividentsDebt> listNeedRepayDebt(Long uid, Date maxEstimatePayTime, int page, int count) {
|
| | | return teamDividentsDebtMapper.listByLeftMoneyAndUidAndMaxEstimatePayTime(new BigDecimal("0.01"), null, uid,
|
| | | maxEstimatePayTime, (page - 1) * count, count);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countNeedRepayDebt(Long uid) {
|
| | | return teamDividentsDebtMapper.countByLeftMoneyAndUid(new BigDecimal("0.01"), null, uid);
|
| | | public long countNeedRepayDebt(Long uid, Date maxEstimatePayTime) {
|
| | | return teamDividentsDebtMapper.countByLeftMoneyAndUidAndMaxEstimatePayTime(new BigDecimal("0.01"), null, uid,
|
| | | maxEstimatePayTime);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getTotalDebtMoney(Long uid) {
|
| | | BigDecimal money = teamDividentsDebtMapper.sumLeftMoneyByUid(uid);
|
| | | public BigDecimal getTotalDebtMoney(Long uid, Date maxEstimatePayTime) {
|
| | | BigDecimal money = teamDividentsDebtMapper.sumLeftMoneyByUid(uid, maxEstimatePayTime);
|
| | | if (money == null)
|
| | | money = new BigDecimal(0);
|
| | | return money;
|