| | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.jdbc.core.JdbcTemplate; |
| | | import org.springframework.web.bind.annotation.CrossOrigin; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | |
| | | import kernel.web.BaseAction; |
| | | import kernel.web.ResultObject; |
| | | import project.Constants; |
| | | import project.data.DataService; |
| | | import project.log.Log; |
| | | import project.log.LogService; |
| | | import project.party.PartyService; |
| | | import project.party.model.Party; |
| | | import project.redis.RedisHandler; |
| | | import project.syspara.SysparaService; |
| | | import project.wallet.WalletGatherService; |
| | | import project.wallet.WalletLogService; |
| | | import project.wallet.WalletService; |
| | | import project.wallet.internal.WalletGatherServiceImpl; |
| | | import project.withdraw.Withdraw; |
| | | import project.withdraw.WithdrawService; |
| | | import util.LockFilter; |
| | |
| | | |
| | | @Autowired |
| | | private LogService logService; |
| | | |
| | | @Autowired |
| | | private RedisHandler redisHandler; |
| | | |
| | | @Autowired |
| | | private JdbcTemplate jdbcTemplate; |
| | | |
| | | @Autowired |
| | | private WalletService walletService; |
| | | |
| | | |
| | | private final String action = "/api/withdraw!"; |
| | | |
| | |
| | | if (!"0".equals(resultObject.getCode())) { |
| | | return resultObject; |
| | | } |
| | | |
| | | |
| | | String partyId = this.getLoginPartyId(); |
| | | boolean lock = false; |
| | | try { |
| | |
| | | if (!StringUtils.isNullOrEmpty(error)) { |
| | | throw new BusinessException(error); |
| | | } |
| | | |
| | | |
| | | double amount_double = Double.valueOf(amount).doubleValue(); |
| | | |
| | | |
| | | // 交易所提现是否需要资金密码 |
| | | String exchange_withdraw_need_safeword = this.sysparaService.find("exchange_withdraw_need_safeword").getValue(); |
| | | if(StringUtils.isEmptyString(exchange_withdraw_need_safeword)) { |
| | | throw new BusinessException("系统参数错误"); |
| | | } |
| | | |
| | | |
| | | if ("true".equals(exchange_withdraw_need_safeword)) { |
| | | |
| | | |
| | | if (StringUtils.isEmptyString(safeword)) { |
| | | throw new BusinessException("资金密码不能为空"); |
| | | } |
| | |
| | | if (safeword.length() < 6 || safeword.length() > 12) { |
| | | throw new BusinessException("资金密码必须6-12位"); |
| | | } |
| | | |
| | | |
| | | if (!this.partyService.checkSafeword(safeword, partyId)) { |
| | | throw new BusinessException("资金密码错误"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (!LockFilter.add(partyId)) { |
| | | throw new BusinessException(error); |
| | | } |
| | | |
| | | |
| | | lock = true; |
| | | |
| | | |
| | | Object object = this.sessionTokenService.cacheGet(session_token); |
| | | this.sessionTokenService.del(session_token); |
| | | if (null == object || !this.getLoginPartyId().equals((String) object)) { |
| | |
| | | withdraw.setAddress(from); |
| | | withdraw.setCurrency(currency); |
| | | withdraw.setDeviceIp(this.getIp()); |
| | | |
| | | |
| | | // 保存 |
| | | this.withdrawService.saveApply(withdraw, channel, null, googleCode); |
| | | |
| | | |
| | | Log log = new Log(); |
| | | Party party = this.partyService.cachePartyBy(partyId, false); |
| | | log.setCategory(Constants.LOG_CATEGORY_SECURITY); |
| | |
| | | |
| | | } catch (BusinessException e) { |
| | | if (105 == e.getSign()) { |
| | | resultObject.setCode("105"); |
| | | resultObject.setCode("105"); |
| | | } else if (401 == e.getSign()) { |
| | | resultObject.setCode("401"); |
| | | resultObject.setCode("401"); |
| | | } else if (506 == e.getSign()) { |
| | | resultObject.setCode("506"); |
| | | resultObject.setCode("506"); |
| | | } else { |
| | | resultObject.setCode("1"); |
| | | resultObject.setCode("1"); |
| | | } |
| | | resultObject.setMsg(e.getMessage()); |
| | | } catch (Throwable t) { |
| | |
| | | LockFilter.remove(partyId); |
| | | } |
| | | } |
| | | |
| | | |
| | | return resultObject; |
| | | } |
| | | |