| | |
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanDrawBack;
|
| | | import com.yeshi.fanli.exception.money.UserMoneyDebtException;
|
| | | import com.yeshi.fanli.exception.money.UserMoneyDetailException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service;
|
| | | import com.yeshi.fanli.service.inter.money.UserMoneyDebtService;
|
| | | import com.yeshi.fanli.service.inter.msg.UserMoneyMsgNotificationService;
|
| | |
| | |
|
| | | // 新版通知
|
| | | userMoneyMsgNotificationService.fanliOrderWeiQuan(uid, weiQuanDrawBack.getOrderId(), money,
|
| | | userInfoService.getMyHB(uid));
|
| | | userInfoService.getBalance(uid));
|
| | |
|
| | | break;
|
| | | case HongBaoV2.TYPE_SHARE_GOODS:
|
| | |
| | | userMoneyService.subUserMoney(uid, money, userMoneyDetail);
|
| | |
|
| | | userMoneyMsgNotificationService.shareOrderWeiQuan(debt.getUid(), weiQuanDrawBack.getOrderId(),
|
| | | money, userInfoService.getMyHB(uid));
|
| | | money, userInfoService.getBalance(uid));
|
| | |
|
| | | } catch (UserMoneyDetailException e) {
|
| | | throw new UserMoneyDebtException(12, "插入资金详情出错");
|
| | |
| | |
|
| | | // 新版通知
|
| | | userMoneyMsgNotificationService.inviteOrderWeiQuan(uid, weiQuanDrawBack.getOrderId(), money,
|
| | | userInfoService.getMyHB(uid));
|
| | | userInfoService.getBalance(uid));
|
| | | break;
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void repayDebt(Long uid) {
|
| | | // 查询是否有欠债
|
| | | List<UserMoneyDebt> list = userMoneyDebtMapper.listByUidWithHasLeftMoney(uid, 0, 50);
|
| | | if (list != null && list.size() > 0) {// 有欠债
|
| | | for (UserMoneyDebt debt : list) {
|
| | | BigDecimal leftMoney = userInfoService.getBalance(uid);
|
| | | if (leftMoney.compareTo(debt.getLeftMoney()) >= 0) {// 有足够的资金偿还债务
|
| | | try {
|
| | | repayDebt(debt, debt.getLeftMoney());
|
| | | } catch (UserMoneyDebtException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e, "uid:" + uid + " debtId:" + debt.getId(), null);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public boolean isHaveDebtToRepay(Long uid) {
|
| | | List<UserMoneyDebt> debtList = userMoneyDebtMapper.listByUidWithHasLeftMoney(uid, 0, 1);
|
| | | if (debtList != null && debtList.size() > 0)
|
| | | return true;
|
| | | return false;
|
| | | }
|
| | |
|
| | | }
|