| | |
| | | import com.yeshi.fanli.dao.mybatis.AlipayAccountValidNormalHistoryMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.BindingAccountMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.UserInfoMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.money.UserMoneyDetailMapper;
|
| | | import com.yeshi.fanli.dao.user.BindingAccountDao;
|
| | | import com.yeshi.fanli.entity.bus.user.AccountDetails;
|
| | | import com.yeshi.fanli.entity.bus.user.AlipayAccountValidNormalHistory;
|
| | | import com.yeshi.fanli.entity.bus.user.BindingAccount;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.exception.AlipayAccountException;
|
| | | import com.yeshi.fanli.exception.AlipayTransferException;
|
| | | import com.yeshi.fanli.exception.BindingAccountException;
|
| | | import com.yeshi.fanli.exception.money.UserMoneyDetailException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.user.BindingAccountService;
|
| | | import com.yeshi.fanli.service.inter.user.UserNotificationService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.factory.AccountDetailsFactory;
|
| | | import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | |
| | | private AccountDetailsMapper accountDetailsMapper;
|
| | | @Resource
|
| | | private UserNotificationService userNotificationService;
|
| | | |
| | | @Resource
|
| | | private UserMoneyDetailMapper userMoneyDetailMapper;
|
| | |
|
| | | public List<BindingAccount> getBindingAccountByUid(long uid) {
|
| | | return bindingAccountDao.list("from BindingAccount ba where ba.userInfo.id=?", new Serializable[] { uid });
|
| | |
| | |
|
| | | UserInfo userInfo = userInfoMapper.selectByPrimaryKeyForUpdate(uid);
|
| | | if (userInfo.getMyHongBao().compareTo(new BigDecimal("0")) <= 0)
|
| | | throw new AlipayAccountException(AlipayAccountException.CODE_NO_MONEY, "你的账户目前没有余额,暂时不能绑定支付宝提现");
|
| | | throw new AlipayAccountException(AlipayAccountException.CODE_NO_MONEY, "你的账户目前没有余额,无需绑定提现帐号。");
|
| | |
|
| | | // 需要转账验证
|
| | | BigDecimal money = new BigDecimal("0.1");
|
| | |
| | | AccountDetails accountDetails = AccountDetailsFactory.create("-" + money.toString(),
|
| | | AccountDetailsFactory.VALID_ALIPAY_ACCOUNT, null, null, new UserInfo(uid));
|
| | | accountDetailsMapper.insertSelective(accountDetails);
|
| | | // 新版资金
|
| | | try {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createExtractAccountValid(history, money);
|
| | | userMoneyDetail.setId(accountDetails.getId());
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | userNotificationService.alipayAccountValidRight(uid, money, account);
|
| | |
|
| | | }
|
| | |
| | | public boolean canVerifyAlipayAccount(Long uid) throws BindingAccountException {
|
| | | UserInfo userInfo = userInfoMapper.selectByPrimaryKeyForUpdate(uid);
|
| | | if (userInfo.getMyHongBao().compareTo(new BigDecimal("0")) <= 0)
|
| | | throw new BindingAccountException(1, "账户无余额");
|
| | | throw new BindingAccountException(1, "你的账户目前没有余额,无需绑定提现帐号。");
|
| | |
|
| | | AlipayAccountValidNormalHistory latest = alipayAccountValidNormalHistoryMapper.selectLatestByUid(uid);
|
| | | if (latest != null) {
|
| | |
| | | caLatest.setTimeInMillis(latest.getCreateTime().getTime());
|
| | | Calendar nowLatest = Calendar.getInstance();
|
| | | if (caLatest.get(Calendar.MONTH) == nowLatest.get(Calendar.MONTH))// 上次更改和现在是同一个月
|
| | | throw new BindingAccountException(2, "本月支付宝绑定次数超限");
|
| | | throw new BindingAccountException(2, "每月仅可修改1次提现账号,请下月再试吧。");
|
| | | }
|
| | | return true;
|
| | | }
|