| | |
| | | public Result close(@RequestBody @Valid CloseModel model) { |
| | | ExchangeApplyOrder order = exchangeApplyOrderService.findByOrderNo(model.getOrderNo()); |
| | | if (ExchangeApplyOrder.STATE_CREATED.equals(order.getState())) { |
| | | throw new YamiShopBindException("委托已完成无法撤销"); |
| | | throw new YamiShopBindException("Order is completed and cannot be cancelled"); |
| | | } |
| | | exchangeApplyOrderService.saveCancel(order.getPartyId(), model.getOrderNo()); |
| | | return Result.succeed(); |
| | |
| | | sysUserService.checkSafeWord(successModel.getLoginSafeword()); |
| | | ExchangeApplyOrder order = exchangeApplyOrderService.findByOrderNo(successModel.getOrderNo()); |
| | | if (order == null) { |
| | | throw new YamiShopBindException("委托单不存在或请稍后再试"); |
| | | throw new YamiShopBindException("Order does not exist, please try again later"); |
| | | } |
| | | if (ExchangeApplyOrder.STATE_CREATED.equals(order.getState())) |
| | | throw new YamiShopBindException("委托已完成无法操作"); |
| | | throw new YamiShopBindException("Order is completed and cannot be operated"); |
| | | if (!"limit".equals(order.getOrderPriceType())) { |
| | | throw new YamiShopBindException("委托并非限价单,无法限价成交"); |
| | | throw new YamiShopBindException("Order is not a limit order and cannot be filled at limit price"); |
| | | } |
| | | Realtime realtime = new Realtime(); |
| | | realtime.setClose(new BigDecimal(order.getPrice())); |
| | |
| | | |
| | | private String verificationResetLock(String money_revise, String reset_type, String coin_type, String login_safeword) { |
| | | if (StringUtils.isNullOrEmpty(money_revise)) { |
| | | throw new YamiShopBindException("账变金额必填"); |
| | | throw new YamiShopBindException("Balance change amount is required"); |
| | | } |
| | | if (!StringUtils.isDouble(money_revise)) { |
| | | throw new YamiShopBindException("账变金额输入错误,请输入浮点数"); |
| | | throw new YamiShopBindException("Invalid balance change amount, please enter a decimal number"); |
| | | } |
| | | if (Double.valueOf(money_revise).doubleValue() <= 0) { |
| | | throw new YamiShopBindException("账变金额不能小于等于0"); |
| | | throw new YamiShopBindException("Balance change amount must be greater than 0"); |
| | | } |
| | | if (StringUtils.isNullOrEmpty(login_safeword)) { |
| | | throw new YamiShopBindException("请输入资金密码"); |
| | | throw new YamiShopBindException("Please enter fund password"); |
| | | } |
| | | if (StringUtils.isNullOrEmpty(reset_type)) { |
| | | throw new YamiShopBindException("请选择转移方向"); |
| | | throw new YamiShopBindException("Please select transfer direction"); |
| | | } |
| | | if (StringUtils.isNullOrEmpty(coin_type)) { |
| | | throw new YamiShopBindException("请选择转移币种"); |
| | | throw new YamiShopBindException("Please select transfer currency"); |
| | | } |
| | | return null; |
| | | } |
| | |
| | | } |
| | | sysUserService.checkSafeWord(model.getLoginSafeword()); |
| | | if (!LockFilter.add(model.getId())) { |
| | | throw new YamiShopBindException("请稍后再试"); |
| | | throw new YamiShopBindException("Please try again later"); |
| | | } |
| | | lock = true; |
| | | |
| | |
| | | } catch (YamiShopBindException e) { |
| | | throw new YamiShopBindException(e.getMessage()); |
| | | } catch (Throwable t) { |
| | | throw new YamiShopBindException("程序错误"); |
| | | throw new YamiShopBindException("Program error"); |
| | | } finally { |
| | | if (lock) { |
| | | LockFilter.remove(model.getId()); |
| | |
| | | } |
| | | sysUserService.checkSafeWord(lockModel.getLoginSafeword()); |
| | | if (!LockFilter.add(lockModel.getId())) { |
| | | throw new YamiShopBindException("请稍后再试"); |
| | | throw new YamiShopBindException("Please try again later"); |
| | | } |
| | | lock = true; |
| | | double money_revise = Double.valueOf(lockModel.getMoneyRevise()).doubleValue(); |