| | |
| | | import com.yeshi.fanli.entity.money.UserMoneyDebt.UserMoneyDebtTypeEnum;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDebtReturnHistory;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | | 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.service.inter.money.UserMoneyService;
|
| | | import com.yeshi.fanli.service.inter.money.msg.UserMoneyMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.money.tb.TaoBaoWeiQuanDrawBackService;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.HongBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.HongBaoV2Service;
|
| | | import com.yeshi.fanli.service.inter.order.tb.TaoBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | |
| | | private HongBaoV2Service hongBaoV2Service;
|
| | |
|
| | | @Resource
|
| | | private HongBaoOrderService hongBaoOrderService;
|
| | |
|
| | | @Resource
|
| | | private UserMoneyService userMoneyService;
|
| | |
|
| | | @Resource
|
| | |
| | |
|
| | | @Resource
|
| | | private AlipayAccountValidNormalHistoryMapper alipayAccountValidNormalHistoryMapper;
|
| | |
|
| | | @Resource
|
| | | private CommonOrderService commonOrderService;
|
| | |
|
| | | @Override
|
| | | public void addUserMoneyDebt(UserMoneyDebt debt) throws UserMoneyDebtException {
|
| | |
| | | return userMoneyDebtMapper.selectByTypeAndSourceId(type, sourceId);
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void repayDebt(UserMoneyDebt debt, BigDecimal money) throws UserMoneyDebtException {
|
| | | if (debt == null || debt.getId() == null)
|
| | |
| | | }
|
| | |
|
| | | // 新版通知
|
| | | List<CommonOrder> orderList = commonOrderService.listBySourceTypeAndOrderId(Constant.SOURCE_TYPE_TAOBAO,
|
| | | weiQuanDrawBack.getOrderId());
|
| | | int goodsCount = 0;
|
| | | for (CommonOrder co : orderList) {
|
| | | if (co.getState() != CommonOrder.STATE_SX)
|
| | | goodsCount += co.getCount();
|
| | | }
|
| | |
|
| | | BigDecimal fanliMoney = new BigDecimal(0);
|
| | | List<HongBaoOrder> hongBaoOrderList = hongBaoOrderService
|
| | | .listDetailByOrderIdAndSourceType(weiQuanDrawBack.getOrderId(), Constant.SOURCE_TYPE_TAOBAO);
|
| | |
|
| | | for (HongBaoOrder hongBaoOrder : hongBaoOrderList) {
|
| | | fanliMoney = fanliMoney.add(hongBaoOrder.getHongBaoV2().getMoney());
|
| | | }
|
| | |
|
| | | userMoneyMsgNotificationService.fanliOrderWeiQuan(uid, weiQuanDrawBack.getOrderId(),
|
| | | Constant.SOURCE_TYPE_TAOBAO, money, userInfoService.getBalance(uid));
|
| | | Constant.SOURCE_TYPE_TAOBAO, money, fanliMoney, goodsCount,
|
| | | orderList.get(0).getThirdCreateTime());
|
| | |
|
| | | break;
|
| | | case HongBaoV2.TYPE_SHARE_GOODS:
|
| | |
| | | weiQuanDrawBack, money);
|
| | | userMoneyService.subUserMoney(uid, money, userMoneyDetail);
|
| | |
|
| | | userMoneyMsgNotificationService.shareOrderWeiQuan(debt.getUid(), weiQuanDrawBack.getOrderId(),
|
| | | Constant.SOURCE_TYPE_TAOBAO, money, userInfoService.getBalance(uid));
|
| | | // 新版通知
|
| | | List<CommonOrder> orderList1 = commonOrderService
|
| | | .listBySourceTypeAndOrderId(Constant.SOURCE_TYPE_TAOBAO, weiQuanDrawBack.getOrderId());
|
| | | int goodsCount1 = 0;
|
| | | for (CommonOrder co : orderList1) {
|
| | | if (co.getState() != CommonOrder.STATE_SX)
|
| | | goodsCount1 += co.getCount();
|
| | | }
|
| | |
|
| | | BigDecimal fanliMoney1 = new BigDecimal(0);
|
| | | List<HongBaoOrder> hongBaoOrderList1 = hongBaoOrderService.listDetailByOrderIdAndSourceType(
|
| | | weiQuanDrawBack.getOrderId(), Constant.SOURCE_TYPE_TAOBAO);
|
| | |
|
| | | for (HongBaoOrder hongBaoOrder : hongBaoOrderList1) {
|
| | | fanliMoney1 = fanliMoney1.add(hongBaoOrder.getHongBaoV2().getMoney());
|
| | | }
|
| | |
|
| | | userMoneyMsgNotificationService.shareOrderWeiQuan(uid, weiQuanDrawBack.getOrderId(),
|
| | | Constant.SOURCE_TYPE_TAOBAO, money, fanliMoney1, goodsCount1,
|
| | | orderList1.get(0).getThirdCreateTime());
|
| | |
|
| | | } catch (UserMoneyDetailException e) {
|
| | | throw new UserMoneyDebtException(12, "插入资金详情出错");
|
| | |
| | | throw new UserMoneyDebtException(12, "插入资金详情出错");
|
| | | }
|
| | |
|
| | | // 新版通知
|
| | | userMoneyMsgNotificationService.inviteOrderWeiQuan(uid, weiQuanDrawBack.getOrderId(),
|
| | | Constant.SOURCE_TYPE_TAOBAO, money, userInfoService.getBalance(uid));
|
| | | break;
|
| | | }
|
| | | } else if (debt.getType() == UserMoneyDebtTypeEnum.extractVerify) {// 提现验证
|
| | | // 新版资金记录
|
| | | AlipayAccountValidNormalHistory aliPayAccountHistory = alipayAccountValidNormalHistoryMapper
|
| | | .selectByPrimaryKey(debt.getSourceId());
|
| | |
|
| | | AlipayAccountValidNormalHistory first = alipayAccountValidNormalHistoryMapper
|
| | | .selectLatestByUid(aliPayAccountHistory.getUid());
|
| | |
|
| | | if (aliPayAccountHistory == null)
|
| | | return;
|
| | | try {
|
| | |
| | | } catch (UserMoneyDetailException e) {
|
| | | throw new UserMoneyDebtException(12, "插入资金详情出错");
|
| | | }
|
| | |
|
| | | userMoneyMsgNotificationService.alipayAccountValid(aliPayAccountHistory);
|
| | | userMoneyMsgNotificationService.alipayAccountValid(aliPayAccountHistory, "1个月",
|
| | | first.getId().longValue() != aliPayAccountHistory.getId());
|
| | | }
|
| | | }
|
| | |
|
| | | @Transactional(rollbackFor=Exception.class)
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | @Override
|
| | | public void repayDebt(Long uid) {
|
| | | // 查询是否有欠债
|