| | |
| | | if (!party.isEnabled()) { |
| | | throw new YamiShopBindException("用户已锁定"); |
| | | } |
| | | if ("recharge".equals(direction)) { |
| | | realNameAuthRecordService.requireApproved(party, false); |
| | | } |
| | | // 手续费 |
| | | double fee = 0; |
| | | if ("withdraw".equals(direction)) { |
| | |
| | | if (party_kyc==null){ |
| | | party_kyc=new RealNameAuthRecord(); |
| | | } |
| | | if (!(party_kyc.getStatus() == 2) && "true".equals(this.sysparaService.find("withdraw_by_kyc").getSvalue())) { |
| | | throw new YamiShopBindException("未实名认证,无提现权限"); |
| | | if ("true".equals(this.sysparaService.find("withdraw_by_kyc").getSvalue())) { |
| | | realNameAuthRecordService.requireApproved(party, false); |
| | | } |
| | | HighLevelAuthRecord party_kycHighLevel = highLevelAuthRecordService.findByUserId(partyId); |
| | | if (party_kycHighLevel==null){ |
| | |
| | | import com.yami.trading.common.util.ThreadUtils; |
| | | import com.yami.trading.security.common.util.SecurityUtils; |
| | | import com.yami.trading.service.MarketOpenChecker; |
| | | import com.yami.trading.service.RealNameAuthRecordService; |
| | | import com.yami.trading.service.SessionTokenService; |
| | | import com.yami.trading.service.WalletService; |
| | | import com.yami.trading.service.contract.ContractApplyOrderService; |
| | |
| | | private SessionTokenService sessionTokenService; |
| | | @Autowired |
| | | TipService tipService; |
| | | @Autowired |
| | | private RealNameAuthRecordService realNameAuthRecordService; |
| | | // @Autowired |
| | | // private ExchangeRateService exchangeRateService; |
| | | |
| | |
| | | throw new YamiShopBindException("用户已锁定"); |
| | | } |
| | | validateTradePermission(user); |
| | | realNameAuthRecordService.requireApproved(user, true); |
| | | |
| | | Syspara syspara = sysparaService.find("stop_user_internet"); |
| | | String stopUserInternet = syspara.getSvalue(); |
| | |
| | | // 模拟账户不做二步校验限制 |
| | | if (user.getAccountType() != null && user.getAccountType() == 1) { |
| | | return; |
| | | } |
| | | if (!user.isGoogleAuthBind() || StringUtils.isEmptyString(user.getSafePassword())) { |
| | | throw new YamiShopBindException("请先完成两步认证并设置资金密码后再交易"); |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.yami.trading.common.util.ThreadUtils; |
| | | import com.yami.trading.security.common.util.SecurityUtils; |
| | | import com.yami.trading.service.MarketOpenChecker; |
| | | import com.yami.trading.service.RealNameAuthRecordService; |
| | | import com.yami.trading.service.SessionTokenService; |
| | | import com.yami.trading.service.WalletService; |
| | | import com.yami.trading.service.future.FuturesOrderService; |
| | |
| | | SysparaService sysparaService; |
| | | @Autowired |
| | | TipService tipService; |
| | | @Autowired |
| | | RealNameAuthRecordService realNameAuthRecordService; |
| | | // @Autowired |
| | | // private ExchangeRateService exchangeRateService; |
| | | |
| | |
| | | if (!party.isEnabled()) { |
| | | throw new YamiShopBindException("用户已锁定"); |
| | | } |
| | | realNameAuthRecordService.requireApproved(party, true); |
| | | if (null == object || !party.getUserId().equals((String) object)) { |
| | | throw new BusinessException("请稍后再试"); |
| | | } |
| | |
| | | queryWrapper.notIn(ObjectUtil.notEqual("1", itemQuery.getMarketIndex()), "symbol", symbolsNotCotnains); |
| | | } |
| | | |
| | | List<String> symbols = Lists.newArrayList(); |
| | | if (StrUtil.isNotEmpty(symbol)) { |
| | | symbols = Splitter.on(",").splitToList(symbol); |
| | | // 搜索:name / symbol 均支持对 NAME、SYMBOL、en_name 模糊匹配。 |
| | | // 仅当 symbol 为逗号分隔的多代码时,才按精确 symbol 列表筛选。 |
| | | String nameParam = StrUtil.trim(itemQuery.getName()); |
| | | String keywordParam = StrUtil.trim(itemQuery.getKeyword()); |
| | | String symbolParam = StrUtil.trim(symbol); |
| | | List<String> symbolFilter = Lists.newArrayList(); |
| | | String keyword = null; |
| | | if (StrUtil.isNotEmpty(symbolParam) && symbolParam.contains(",")) { |
| | | symbolFilter = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(symbolParam); |
| | | } else if (StrUtil.isNotBlank(keywordParam)) { |
| | | keyword = keywordParam; |
| | | } else if (StrUtil.isNotBlank(nameParam)) { |
| | | keyword = nameParam; |
| | | } else if (StrUtil.isNotBlank(symbolParam)) { |
| | | keyword = symbolParam; |
| | | } |
| | | |
| | | if ("1".equalsIgnoreCase(itemQuery.getBoardType())) { |
| | |
| | | } else if ("2".equalsIgnoreCase(itemQuery.getBoardType())) { |
| | | queryWrapper.ne("category", "global"); |
| | | } |
| | | queryWrapper.in(CollectionUtil.isNotEmpty(symbols), "symbol", symbols); |
| | | String name = itemQuery.getName(); |
| | | queryWrapper.and(StringUtils.isNotEmpty(name), itemWrapper -> itemWrapper.like("name", name).or().like("symbol", name).or().like("en_name", name)); |
| | | queryWrapper.in(CollectionUtil.isNotEmpty(symbolFilter), "symbol", symbolFilter); |
| | | if (StrUtil.isNotBlank(keyword)) { |
| | | final String kw = keyword; |
| | | queryWrapper.and(w -> w.like("name", kw).or().like("symbol", kw).or().like("en_name", kw)); |
| | | } |
| | | queryWrapper.eq(StrUtil.isNotBlank(type), "type", type); |
| | | queryWrapper.like(StrUtil.isNotBlank(category), "category", category); |
| | | // 倒序吗? TODO |
| | |
| | | import com.yami.trading.common.exception.YamiShopBindException; |
| | | import com.yami.trading.common.util.StringUtils; |
| | | import com.yami.trading.security.common.util.SecurityUtils; |
| | | import com.yami.trading.service.RealNameAuthRecordService; |
| | | import com.yami.trading.service.RechargeBlockchainOrderService; |
| | | import com.yami.trading.service.SessionTokenService; |
| | | import com.yami.trading.service.c2c.C2cOrderService; |
| | |
| | | WalletLogService walletLogService; |
| | | @Autowired |
| | | C2cOrderService c2cOrderService; |
| | | @Autowired |
| | | RealNameAuthRecordService realNameAuthRecordService; |
| | | |
| | | /** |
| | | * 首次进入页面,传递session_token |
| | |
| | | if (Constants.SECURITY_ROLE_TEST.equals(party.getRoleName())) { |
| | | throw new YamiShopBindException("无权限"); |
| | | } |
| | | realNameAuthRecordService.requireApproved(party, false); |
| | | // 充值申请中的订单是否只能唯一:1唯一,2不限制 |
| | | double recharge_only_one = Double.valueOf(sysparaService.find("recharge_only_one").getSvalue()); |
| | | // 用户未结束银行卡订单数量 |
| | |
| | | throw new YamiShopBindException("用户已禁用"); |
| | | } |
| | | validateTradePermission(party); |
| | | realNameAuthRecordService.requireApproved(party, true); |
| | | Syspara syspara = sysparaService.find("stop_user_internet"); |
| | | String stopUserInternet = syspara.getSvalue(); |
| | | if (org.apache.commons.lang3.StringUtils.isNotEmpty(stopUserInternet)) { |
| | |
| | | throw new YamiShopBindException("用户已禁用!"); |
| | | } |
| | | validateTradePermission(party); |
| | | realNameAuthRecordService.requireApproved(party, true); |
| | | symbol = itemService.getCleanSymbol(symbol); |
| | | symbol_to = itemService.getCleanSymbol(symbol_to); |
| | | String relation_order_no = UUID.randomUUID().toString(); |
| | |
| | | // 模拟账户不做二步校验限制 |
| | | if (user.getAccountType() != null && user.getAccountType() == 1) { |
| | | return; |
| | | } |
| | | if (!user.isGoogleAuthBind() || StringUtils.isEmptyString(user.getSafePassword())) { |
| | | throw new YamiShopBindException("请先完成两步认证并设置资金密码后再交易"); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.yami.trading.common.util.StringUtils; |
| | | import com.yami.trading.common.util.ThreadUtils; |
| | | import com.yami.trading.security.common.util.SecurityUtils; |
| | | import com.yami.trading.service.RealNameAuthRecordService; |
| | | import com.yami.trading.service.SessionTokenService; |
| | | import com.yami.trading.service.WalletService; |
| | | import com.yami.trading.service.data.DataService; |
| | |
| | | |
| | | @Autowired |
| | | ExchangeLeverOrderService exchangeLeverOrderService; |
| | | @Autowired |
| | | RealNameAuthRecordService realNameAuthRecordService; |
| | | |
| | | /** |
| | | * 开仓页面参数 |
| | |
| | | throw new YamiShopBindException("用户已禁用"); |
| | | } |
| | | validateTradePermission(party); |
| | | realNameAuthRecordService.requireApproved(party, true); |
| | | ExchangeLeverApplyOrder order = new ExchangeLeverApplyOrder(); |
| | | order.setPartyId(SecurityUtils.getCurrentUserId()); |
| | | order.setSymbol(symbol); |
| | |
| | | // 模拟账户不做二步校验限制 |
| | | if (user.getAccountType() != null && user.getAccountType() == 1) { |
| | | return; |
| | | } |
| | | if (!user.isGoogleAuthBind() || StringUtils.isEmptyString(user.getSafePassword())) { |
| | | throw new YamiShopBindException("请先完成两步认证并设置资金密码后再交易"); |
| | | } |
| | | } |
| | | |
| | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * name |
| | | * 搜索关键词,模糊匹配币种名称(NAME)、代码(SYMBOL) |
| | | */ |
| | | @ApiParam(value = "name") |
| | | @Query(type = QueryType.LIKE) |
| | | private String name; |
| | | |
| | | /** |
| | | * 代码 |
| | | * 统一搜索关键词(与 name 等价,便于前端传参) |
| | | */ |
| | | @ApiParam(value = "keyword") |
| | | private String keyword; |
| | | |
| | | /** |
| | | * 代码(SYMBOL)。单个值时作为搜索关键词模糊匹配 NAME/SYMBOL;逗号分隔时为精确 symbol 列表筛选 |
| | | */ |
| | | @ApiParam(value = "symbol") |
| | | @Query(type = QueryType.LIKE) |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.yami.trading.bean.model.RealNameAuthRecord; |
| | | import com.yami.trading.bean.model.User; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | |
| | | */ |
| | | boolean isPass(String userId); |
| | | |
| | | /** |
| | | * 校验用户已完成实名认证(审核通过)。 |
| | | * |
| | | * @param user 用户 |
| | | * @param skipSimAccount 模拟账户是否跳过(开仓等场景) |
| | | */ |
| | | void requireApproved(User user, boolean skipSimAccount); |
| | | |
| | | Page pageRecord(Page page, String rolename, String idNumber, String status,String userCode, List<String> userIds); |
| | | |
| | | long waitCount(List<String> userIds); |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yami.trading.bean.model.HighLevelAuthRecord; |
| | | import com.yami.trading.bean.model.RealNameAuthRecord; |
| | | import com.yami.trading.bean.model.User; |
| | | import com.yami.trading.common.exception.YamiShopBindException; |
| | | import com.yami.trading.dao.user.RealNameAuthRecordMapper; |
| | | import com.yami.trading.service.RealNameAuthRecordService; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void requireApproved(User user, boolean skipSimAccount) { |
| | | if (user == null) { |
| | | throw new YamiShopBindException("The user does not exist.\n"); |
| | | } |
| | | if (skipSimAccount && user.getAccountType() != null && user.getAccountType() == 1) { |
| | | return; |
| | | } |
| | | if (!isPass(user.getUserId())) { |
| | | throw new YamiShopBindException("Please complete real-name verification first."); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public long waitCount(List<String> userIds) { |
| | | |
| | | LambdaQueryWrapper<RealNameAuthRecord> lambdaQueryWrapper= Wrappers.<RealNameAuthRecord>query().lambda().eq(RealNameAuthRecord::getStatus,1); |
| | |
| | | if (party_kyc==null){ |
| | | party_kyc=new RealNameAuthRecord(); |
| | | } |
| | | if (!(party_kyc.getStatus() == 2) && "true".equals(sysparaService.find("withdraw_by_kyc").getSvalue())) { |
| | | throw new YamiShopBindException("未基础认证"); |
| | | if ("true".equals(sysparaService.find("withdraw_by_kyc").getSvalue())) { |
| | | realNameAuthRecordService.requireApproved(party, false); |
| | | } |
| | | double withdraw_by_high_kyc = Double.valueOf(sysparaService.find("withdraw_by_high_kyc").getSvalue()); |
| | | if (withdraw_by_high_kyc > 0 && withdraw.getVolume().doubleValue() > withdraw_by_high_kyc |
| | |
| | | if (party_kyc==null){ |
| | | party_kyc=new RealNameAuthRecord(); |
| | | } |
| | | if (!(party_kyc.getStatus() == 2) && "true".equals(sysparaService.find("withdraw_by_kyc").getSvalue())) { |
| | | throw new YamiShopBindException("未基础认证"); |
| | | if ("true".equals(sysparaService.find("withdraw_by_kyc").getSvalue())) { |
| | | realNameAuthRecordService.requireApproved(party, false); |
| | | } |
| | | if (party_kycHighLevel==null){ |
| | | party_kycHighLevel=new HighLevelAuthRecord(); |
| | |
| | | throw new YamiShopBindException("无权限"); |
| | | } |
| | | RealNameAuthRecord realNameAuthRecord = realNameAuthRecordService.getByUserId(user.getUserId()); |
| | | if (!(realNameAuthRecord.getStatus() == 2) && "true".equals(sysparaService.find("withdraw_by_kyc").getSvalue())) { |
| | | throw new YamiShopBindException("未安全认证,无提现权限"); |
| | | if ("true".equals(sysparaService.find("withdraw_by_kyc").getSvalue())) { |
| | | realNameAuthRecordService.requireApproved(user, false); |
| | | } |
| | | HighLevelAuthRecord highLevelAuthRecord = highLevelAuthRecordService.findByUserId(withdraw.getUserId()); |
| | | BigDecimal withdrawByHighKyc = new BigDecimal(sysparaService.find("withdraw_by_high_kyc").getSvalue()); |