| | |
| | | public Object order_open(HttpServletRequest request) throws IOException { |
| | | String currency = request.getParameter("currency"); |
| | | if (StringUtils.isEmptyString(currency)) { |
| | | throw new YamiShopBindException("支付币种不正确"); |
| | | throw new YamiShopBindException("Invalid payment currency"); |
| | | } |
| | | String partyId = SecurityUtils.getCurrentUserId(); |
| | | String session_token = sessionTokenService.savePut(partyId); |
| | |
| | | party = userService.getById(partyId); |
| | | log.error("用户"+direction+"开始当前用户uid:"+party.getUserCode()+"当前用户名:"+party.getUserName()+"生成的订单号:"+orderNo); |
| | | if (Constants.SECURITY_ROLE_TEST.equals(party.getRoleName())) { |
| | | throw new YamiShopBindException("无权限"); |
| | | throw new YamiShopBindException("Permission denied"); |
| | | } |
| | | |
| | | if (!C2cLock.add(partyId)) { |
| | |
| | | Object object = this.sessionTokenService.cacheGet(session_token); |
| | | this.sessionTokenService.del(session_token); |
| | | if (null == object || !partyId.equals((String) object)) { |
| | | throw new YamiShopBindException("请稍后再试"); |
| | | throw new YamiShopBindException("Please try again later"); |
| | | } |
| | | |
| | | if (!party.isEnabled()) { |
| | |
| | | String c2c_sell_only_one = sysparaService.find("c2c_sell_only_one").getSvalue(); |
| | | if(StringUtils.isNotEmpty(c2c_sell_only_one)&&"1".equals(c2c_sell_only_one)) { |
| | | if(nofinishOrderCount >= 1) { |
| | | throw new YamiShopBindException("提交失败,当前有未处理订单"); |
| | | throw new YamiShopBindException("Submission failed, pending order exists"); |
| | | } |
| | | Long.valueOf(c2c_sell_only_one).longValue(); |
| | | } |
| | | Object obj2 = this.sysparaService.find("c2c_nofinish_order_count_max"); |
| | | if (null != obj2) { |
| | | if (nofinishOrderCount >= Long.valueOf(this.sysparaService.find("c2c_nofinish_order_count_max").getSvalue()).longValue()) { |
| | | throw new YamiShopBindException("用户未结束订单数量已达上限"); |
| | | throw new YamiShopBindException("Open order limit reached"); |
| | | } |
| | | } |
| | | |
| | |
| | | Object obj1 = this.sysparaService.find("c2c_order_cancel_day_times"); |
| | | if (null != obj1) { |
| | | if (orderCancelDayTimes >= Integer.valueOf(this.sysparaService.find("c2c_order_cancel_day_times").getSvalue()).intValue()) { |
| | | throw new YamiShopBindException("今日取消订单次数太多了,请明日再试"); |
| | | throw new YamiShopBindException("Too many order cancellations today, please try again tomorrow"); |
| | | } |
| | | } |
| | | |
| | | C2cAdvert c2cAdvert = this.c2cAdvertService.getById(c2c_advert_id); |
| | | if (null == c2cAdvert) { |
| | | throw new YamiShopBindException("广告不存在"); |
| | | throw new YamiShopBindException("Advertisement does not exist"); |
| | | } |
| | | |
| | | C2cPaymentMethod method =c2cPaymentMethodService.get(payment_method_id); |
| | | if (null == method) { |
| | | throw new YamiShopBindException("支付方式不存在"); |
| | | throw new YamiShopBindException("Payment method does not exist"); |
| | | } |
| | | |
| | | if (StringUtils.isEmptyString(order_type) || !Arrays.asList("by_amount", "by_num").contains(order_type)) { |
| | | throw new YamiShopBindException("订单类型不正确"); |
| | | throw new YamiShopBindException("Invalid order type"); |
| | | } |
| | | |
| | | if (C2cOrder.ORDER_TYPE_BY_AMOUNT.equals(order_type)) { |
| | | // 按支付金额支付 |
| | | if (StringUtils.isEmptyString(amount) || !StringUtils.isDouble(amount) || Double.valueOf(amount).doubleValue() <= 0) { |
| | | throw new YamiShopBindException("支付金额不正确"); |
| | | throw new YamiShopBindException("Invalid payment amount"); |
| | | } |
| | | coin_amount = "0"; |
| | | } else { |
| | | // 按币种数量支付 |
| | | if (StringUtils.isEmptyString(coin_amount) || !StringUtils.isDouble(coin_amount) || Double.valueOf(coin_amount).doubleValue() <= 0) { |
| | | throw new YamiShopBindException("币种数量不正确"); |
| | | throw new YamiShopBindException("Invalid currency amount"); |
| | | } |
| | | amount = "0"; |
| | | } |
| | |
| | | throw new BusinessException("待付款的订单无法放行"); |
| | | } |
| | | if ("3".equals(order.getState())) { |
| | | throw new BusinessException("订单已完成,无法放行"); |
| | | resultObject.setCode(0); |
| | | return resultObject; |
| | | //throw new BusinessException("订单已完成,无法放行"); |
| | | } |
| | | if ("4".equals(order.getState())) { |
| | | throw new BusinessException("订单已取消,无法放行"); |