| | |
| | | throw new YamiShopBindException(error); |
| | | } |
| | | if (StringUtils.isEmptyString(coin_amount) || !StringUtils.isDouble(coin_amount) || Double.valueOf(coin_amount).doubleValue() <= 0) { |
| | | throw new YamiShopBindException("交易币种数量未填或格式不正确"); |
| | | throw new YamiShopBindException("Trading currency amount is empty or invalid"); |
| | | } |
| | | if (StringUtils.isEmptyString(symbol_value) || !StringUtils.isDouble(symbol_value) || Double.valueOf(symbol_value).doubleValue() <= 0) { |
| | | throw new YamiShopBindException("币种单价未填或格式不正确"); |
| | | throw new YamiShopBindException("Currency unit price is empty or invalid"); |
| | | } |
| | | DecimalFormat df = new DecimalFormat("#.########"); |
| | | double coin_amount_double = Double.valueOf(df.format(Double.valueOf(coin_amount))).doubleValue(); |
| | |
| | | double investment_max_double = Double.valueOf(df.format(Double.valueOf(investment_max))).doubleValue(); |
| | | C2cUser c2cUser = c2cUserService.findByUsercode(c2c_user_code); |
| | | if (null == c2cUser) { |
| | | throw new YamiShopBindException("承兑商不存在"); |
| | | throw new YamiShopBindException("Merchant does not exist"); |
| | | } |
| | | // C2C承兑商添加广告最大数量 |
| | | List<C2cAdvert> advertList = this.c2cAdvertService.getByC2cUserId(c2cUser.getUuid().toString()); |
| | | Object obj = this.sysparaService.find("c2c_advert_count_max"); |
| | | if (null != obj) { |
| | | if (advertList.size() >= Integer.valueOf(this.sysparaService.find("c2c_advert_count_max").getSvalue()).intValue()) { |
| | | throw new YamiShopBindException("广告数量已达上限"); |
| | | throw new YamiShopBindException("Advertisement limit reached"); |
| | | } |
| | | } |
| | | // 计算广告参数 |
| | | Map<String, Object> computeValue = this.c2cAdvertService.getComputeValue(c2cUser.getDeposit(), currency, symbol, coin_amount_double, symbol_value_double); |
| | | if (coin_amount_double > Double.valueOf(computeValue.get("coin_amount_max").toString()).doubleValue()) { |
| | | throw new YamiShopBindException("交易币种数量不能大于最大可交易数量"); |
| | | throw new YamiShopBindException("Trading currency amount cannot exceed maximum tradable amount"); |
| | | } |
| | | if (investment_min_double <= 0 || investment_min_double < Double.valueOf(computeValue.get("investment_min_limit").toString()).doubleValue()) { |
| | | throw new YamiShopBindException("单笔订单支付金额下限错误"); |
| | | throw new YamiShopBindException("Invalid minimum payment amount per order"); |
| | | } |
| | | if (investment_max_double > Double.valueOf(computeValue.get("investment_max_limit").toString()).doubleValue()) { |
| | | throw new YamiShopBindException("单笔订单支付金额上限错误"); |
| | | throw new YamiShopBindException("Invalid maximum payment amount per order"); |
| | | } |
| | | double pay_rate_double = Double.valueOf(computeValue.get("pay_rate").toString()).doubleValue(); |
| | | double symbol_close_double = Double.valueOf(computeValue.get("symbol_close").toString()).doubleValue(); |
| | | double deposit_open_double = Double.valueOf(computeValue.get("deposit_open").toString()).doubleValue(); |
| | | if (deposit_open_double < 0) { |
| | | throw new YamiShopBindException("广告保证金不能小于0"); |
| | | throw new YamiShopBindException("Advertisement margin cannot be less than 0"); |
| | | } |
| | | C2cAdvert c2cAdvert = new C2cAdvert(); |
| | | c2cAdvert.setC2cUserId(c2cUser.getUuid()); |
| | |
| | | throw new YamiShopBindException(error); |
| | | } |
| | | if (StringUtils.isEmptyString(coin_amount) || !StringUtils.isDouble(coin_amount) || Double.valueOf(coin_amount).doubleValue() <= 0) { |
| | | throw new YamiShopBindException("交易币种数量未填或格式不正确"); |
| | | throw new YamiShopBindException("Trading currency amount is empty or invalid"); |
| | | } |
| | | if (StringUtils.isEmptyString(symbol_value) || !StringUtils.isDouble(symbol_value) || Double.valueOf(symbol_value).doubleValue() <= 0) { |
| | | throw new YamiShopBindException("币种单价未填或格式不正确"); |
| | | throw new YamiShopBindException("Currency unit price is empty or invalid"); |
| | | } |
| | | DecimalFormat df = new DecimalFormat("#.########"); |
| | | double coin_amount_double = Double.valueOf(df.format(Double.valueOf(coin_amount))).doubleValue(); |
| | |
| | | double investment_max_double = Double.valueOf(df.format(Double.valueOf(investment_max))).doubleValue(); |
| | | C2cUser c2cUser = this.c2cUserService.findByUsercode(c2c_user_code); |
| | | if (null == c2cUser) { |
| | | throw new YamiShopBindException("承兑商不存在"); |
| | | throw new YamiShopBindException("Merchant does not exist"); |
| | | } |
| | | C2cAdvert c2cAdvert = this.c2cAdvertService.getById(id); |
| | | if (null == c2cAdvert || !c2cAdvert.getC2cUserId().equals(c2cUser.getUuid().toString())) { |
| | | throw new YamiShopBindException("广告不存在"); |
| | | throw new YamiShopBindException("Advertisement does not exist"); |
| | | } |
| | | String userNameLogin = SecurityUtils.getSysUser().getUsername(); |
| | | // 验证资金密码 |
| | | sysUserService.checkSafeWord(login_safeword); |
| | | Long orderCount = this.c2cOrderService.findNoEndingOrdersCountByAdvertId(id); |
| | | if (orderCount > 0) { |
| | | throw new YamiShopBindException("广告还有未完结订单,不能修改"); |
| | | throw new YamiShopBindException("Advertisement has open orders and cannot be modified"); |
| | | } |
| | | Long appealCount = this.c2cAppealService.findNoHandleAppealsCountByAdvertId(id); |
| | | if (null == appealCount) { |
| | | throw new YamiShopBindException("广告还有未处理的订单申诉,不能修改"); |
| | | throw new YamiShopBindException("Advertisement has pending appeals and cannot be modified"); |
| | | } |
| | | // 计算广告参数 |
| | | Map<String, Object> computeValue = this.c2cAdvertService.getComputeValue(Arith.add(c2cUser.getDeposit(), c2cAdvert.getDeposit()), currency, symbol, |
| | | coin_amount_double, symbol_value_double); |
| | | if (coin_amount_double > Double.valueOf(computeValue.get("coin_amount_max").toString()).doubleValue()) { |
| | | throw new YamiShopBindException("交易币种数量不能大于最大可交易数量"); |
| | | throw new YamiShopBindException("Trading currency amount cannot exceed maximum tradable amount"); |
| | | } |
| | | if (investment_min_double <= 0 || investment_min_double < Double.valueOf(computeValue.get("investment_min_limit").toString()).doubleValue()) { |
| | | throw new YamiShopBindException("单笔订单支付金额下限错误"); |
| | | throw new YamiShopBindException("Invalid minimum payment amount per order"); |
| | | } |
| | | if (investment_max_double > Double.valueOf(computeValue.get("investment_max_limit").toString()).doubleValue()) { |
| | | throw new YamiShopBindException("单笔订单支付金额上限错误"); |
| | | throw new YamiShopBindException("Invalid maximum payment amount per order"); |
| | | } |
| | | // modelAndView.addObject("all_deposit", c2cUser.getDeposit()); |
| | | double pay_rate_double = Double.valueOf(computeValue.get("pay_rate").toString()).doubleValue(); |
| | |
| | | double deposit_double = Double.valueOf(computeValue.get("deposit_open").toString()).doubleValue(); |
| | | double change = deposit_double - deposit_old_double; |
| | | if (deposit_double < 0) { |
| | | throw new YamiShopBindException("广告保证金不能小于0"); |
| | | throw new YamiShopBindException("Advertisement margin cannot be less than 0"); |
| | | } |
| | | if (change > 0) { |
| | | if (Double.valueOf(change).doubleValue() > c2cUser.getDeposit()) { |
| | | throw new YamiShopBindException("广告保证金增加差值不能大于承兑商剩余总保证金"); |
| | | throw new YamiShopBindException("Margin increase cannot exceed merchant remaining total margin"); |
| | | } |
| | | } |
| | | String log = MessageFormat.format("ip:" + IPHelper.getIpAddr() |
| | |
| | | String id =model.getId(); |
| | | String login_safeword =model.getLogin_safeword(); |
| | | if (StringUtils.isEmptyString(id)) { |
| | | throw new YamiShopBindException("广告id不正确"); |
| | | throw new YamiShopBindException("Invalid advertisement ID"); |
| | | } |
| | | if (StringUtils.isEmptyString(login_safeword)) { |
| | | throw new YamiShopBindException("资金密码错误"); |
| | | throw new YamiShopBindException("Incorrect fund password"); |
| | | } |
| | | String userNameLogin = SecurityUtils.getSysUser().getUsername(); |
| | | sysUserService.checkSafeWord(model.getLogin_safeword()); |
| | | C2cAdvert c2cAdvert = this.c2cAdvertService.getById(id); |
| | | if (null == c2cAdvert) { |
| | | throw new YamiShopBindException("广告不存在"); |
| | | throw new YamiShopBindException("Advertisement does not exist"); |
| | | } |
| | | C2cUser c2cUser = this.c2cUserService.getById(c2cAdvert.getC2cUserId()); |
| | | if (null == c2cUser) { |
| | | throw new YamiShopBindException("承兑商不存在"); |
| | | throw new YamiShopBindException("Merchant does not exist"); |
| | | } |
| | | Long orderCount = this.c2cOrderService.findNoEndingOrdersCountByAdvertId(id); |
| | | if (orderCount > 0) { |
| | | throw new YamiShopBindException("广告还有未完结订单,不能关闭"); |
| | | throw new YamiShopBindException("Advertisement has open orders and cannot be closed"); |
| | | } |
| | | Long appealCount = this.c2cAppealService.findNoHandleAppealsCountByAdvertId(id); |
| | | if (null == appealCount) { |
| | | throw new YamiShopBindException("广告还有未处理的订单申诉,不能关闭"); |
| | | throw new YamiShopBindException("Advertisement has pending appeals and cannot be closed"); |
| | | } |
| | | double oldC2cUserDeposit = c2cUser.getDeposit(); |
| | | if (c2cAdvert.getDeposit() > 0) { |
| | |
| | | String id = request.getParameter("id"); |
| | | String login_safeword = request.getParameter("login_safeword"); |
| | | if (StringUtils.isEmptyString(id)) { |
| | | throw new YamiShopBindException("广告id不正确"); |
| | | throw new YamiShopBindException("Invalid advertisement ID"); |
| | | } |
| | | if (StringUtils.isEmptyString(login_safeword)) { |
| | | throw new YamiShopBindException("资金密码错误"); |
| | | throw new YamiShopBindException("Incorrect fund password"); |
| | | } |
| | | String userNameLogin = SecurityUtils.getSysUser().getUsername(); |
| | | sysUserService.checkSafeWord(login_safeword); |
| | | C2cAdvert c2cAdvert = this.c2cAdvertService.getById(id); |
| | | if (null == c2cAdvert) { |
| | | throw new YamiShopBindException("广告不存在"); |
| | | throw new YamiShopBindException("Advertisement does not exist"); |
| | | } |
| | | C2cUser c2cUser = this.c2cUserService.getById(c2cAdvert.getC2cUserId()); |
| | | if (null == c2cUser) { |
| | | throw new YamiShopBindException("承兑商不存在"); |
| | | throw new YamiShopBindException("Merchant does not exist"); |
| | | } |
| | | Long orderCount = this.c2cOrderService.findNoEndingOrdersCountByAdvertId(id); |
| | | if (orderCount > 0) { |
| | | throw new YamiShopBindException("广告还有未完结订单,不能退还"); |
| | | throw new YamiShopBindException("Advertisement has open orders and cannot be refunded"); |
| | | } |
| | | Long appealCount = this.c2cAppealService.findNoHandleAppealsCountByAdvertId(id); |
| | | if (null == appealCount) { |
| | | throw new YamiShopBindException("广告还有未处理的订单申诉,不能退还"); |
| | | throw new YamiShopBindException("Advertisement has pending appeals and cannot be refunded"); |
| | | } |
| | | DecimalFormat df = new DecimalFormat("#.########"); |
| | | double oldC2cUserDeposit = c2cUser.getDeposit(); |
| | |
| | | Map<String, Object> resultMap = new HashMap<String, Object>(); |
| | | C2cUser c2cUser = this.c2cUserService.findByUsercode(c2c_user_code); |
| | | if (null == c2cUser) { |
| | | throw new YamiShopBindException("承兑商不存在"); |
| | | throw new YamiShopBindException("Merchant does not exist"); |
| | | } |
| | | double advertDeposit = 0; |
| | | if (StringUtils.isNotEmpty(advert_id)) { |