| | |
| | | * 新币申购 |
| | | */ |
| | | public Result<String> subscribe(UserSubscription model) { |
| | | try { |
| | | if (model == null || model.getIcoProjectId() == null) { |
| | | throw new YamiShopBindException("参数异常"); |
| | | } |
| | |
| | | |
| | | User party = userService.getById(partyId); |
| | | if (!party.isEnabled()) { |
| | | return Result.succeed("User is locked"); |
| | | throw new YamiShopBindException("User is locked"); |
| | | } |
| | | if (Constants.SECURITY_ROLE_TEST.equals(party.getRoleName())) { |
| | | throw new YamiShopBindException("无权限"); |
| | | } |
| | | if (!C2cLock.add(partyId)) { |
| | | throw new YamiShopBindException("Please try again later"); |
| | | } |
| | | |
| | | if (model.getSubscribeNums() == null || model.getSubscribeNums() == 0) { |
| | |
| | | } |
| | | userSubscriptionService.save(model); |
| | | return Result.ok("申请成功" ); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | if(userSubscription.getStatus() == 3){ |
| | | throw new YamiShopBindException("不能更改申购状态"); |
| | | } |
| | | Ico ico = this.getById(model.getIcoProjectId()); |
| | | Ico ico = this.getById(userSubscription.getIcoProjectId()); |
| | | String userId = userSubscription.getUserId(); |
| | | if (model.getStatus() == 3 || model.getStatus() == 5) { |
| | | if(model.getBallotNumber() == null || model.getBallotNumber() == 0){ |
| | |
| | | WalletExtend walletExtend = walletService.saveExtendByPara(userId, ico.getSymbol()); |
| | | walletService.updateExtend(userId, walletExtend.getWallettype(), model.getBallotNumber()); |
| | | } |
| | | userSubscriptionService.save(userSubscription); |
| | | userSubscriptionService.saveOrUpdate(userSubscription); |
| | | return Result.ok ( "操作成功" ); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | |
| | | item.setShowStatus("1"); |
| | | item.setTradeStatus("1"); |
| | | item.setQuoteCurrency(ico.getCurrency()); |
| | | item.setCurrencyType(0); |
| | | item.setCurrencyType(1); //新币 |
| | | item.setStatus(0); |
| | | item.setTradeType(ico.getIsContractTrading().toString()); |
| | | return item; |