Example #1
0
 protected void order(
     HttpServletRequest paramHttpServletRequest,
     HttpServletResponse paramHttpServletResponse,
     String paramString1,
     ResponseResult paramResponseResult,
     String paramString2) {
   if (this.log.isDebugEnabled()) {
     this.log.debug("Entering 'order' method ");
   }
   String str1 = "";
   OrderReturnValue localOrderReturnValue = new OrderReturnValue();
   try {
     String str2 = getLogonType(paramString2);
     str1 = getValueByTagName(paramString1, "USER_ID");
     if ("".equals(str1)) {
       str1 = getValueByTagName(paramString1, "TRADER_ID");
     }
     international((String) lanaguages.get(str1));
     String str3 = getValueByTagName(paramString1, "CUSTOMER_ID");
     Short localShort1 = new Short(getValueByTagName(paramString1, "BUY_SELL"));
     String str4 = getValueByTagName(paramString1, "COMMODITY_ID");
     this.log.debug("commID: " + str4);
     Double localDouble = new Double(getValueByTagName(paramString1, "PRICE"));
     Long localLong = new Long(getValueByTagName(paramString1, "QTY"));
     Short localShort2 = new Short(getValueByTagName(paramString1, "SETTLE_BASIS"));
     long l = parseLong(getValueByTagName(paramString1, "SESSION_ID"));
     Privilege localPrivilege = getSessionBean(paramHttpServletRequest);
     this.log.debug("Begin to Check Order Privilege........");
     if (localPrivilege == null) {
       this.log.debug("====>Reload session ..");
       TraderLogonInfo localObject1 = tradeRMI.getTraderInfo(str1);
       Object localObject2 = (OrdersManager) getBean("ordersManager");
       localPrivilege =
           ((OrdersManager) localObject2).getradePrivilege((TraderLogonInfo) localObject1);
       paramHttpServletRequest.getSession().setAttribute("privilege", localPrivilege);
     }
     if (!PrivilegeController.checkDirectTradePrivilege(
         localPrivilege, str4, localShort1, localShort2)) {
       paramResponseResult.setRetCode(-230);
       paramResponseResult.setMessage(this.properties.getProperty("-221"));
     } else if (localDouble.doubleValue() <= 0.0D) {
       paramResponseResult.setRetCode(-231);
       paramResponseResult.setMessage(this.properties.getProperty("-222"));
     } else if (!PrivilegeController.checkBreedPrivilege(localPrivilege, localShort2, str4)) {
       paramResponseResult.setRetCode(-225);
       paramResponseResult.setMessage(this.properties.getProperty("-223"));
     } else if (!PrivilegeController.checkTraderPrvg(
         localPrivilege, localShort1, localShort2, str4)) {
       paramResponseResult.setRetCode(-221);
       paramResponseResult.setMessage(this.properties.getProperty("-224"));
     } else if (!PrivilegeController.checkFBreedPrivilege(
         localPrivilege, localShort1, localShort2, str4)) {
       paramResponseResult.setRetCode(-226);
       paramResponseResult.setMessage(this.properties.getProperty("-225"));
     } else if (!PrivilegeController.checkCommPrivilege(
         localPrivilege, localShort1, localShort2, str4)) {
       paramResponseResult.setRetCode(-227);
       paramResponseResult.setMessage(this.properties.getProperty("-226"));
     } else if (!PrivilegeController.checkFCodePrivilege(
         localPrivilege, localShort1, localShort2, str4)) {
       paramResponseResult.setRetCode(-228);
       paramResponseResult.setMessage(this.properties.getProperty("-227"));
     } else if (!PrivilegeController.checkCusBreedPrivilege(
         localPrivilege, localShort1, localShort2, str3, str4)) {
       paramResponseResult.setRetCode(-229);
       paramResponseResult.setMessage(this.properties.getProperty("-228"));
     } else if (!PrivilegeController.checkCusCommPrivilege(
         localPrivilege, localShort1, localShort2, str3, str4)) {
       paramResponseResult.setRetCode(-229);
       paramResponseResult.setMessage(this.properties.getProperty("-229"));
     } else {
       this.log.debug("Order Privilege Pass,Begin to Submit Order..");
       Short localShort3 = null;
       Short localObject1 = null;
       Double localObject2 = null;
       if (localShort2.shortValue() == 2) {
         String str5 = getValueByTagName(paramString1, "CLOSEMODE");
         localObject1 = Short.valueOf(str5.equals("") ? 1 : new Short(str5).shortValue());
         String localObject3 = getValueByTagName(paramString1, "L_PRICE");
         localObject2 =
             ((String) localObject3).equals("") ? null : new Double((String) localObject3);
         String str6 = getValueByTagName(paramString1, "TIMEFLAG");
         localShort3 = str6.trim().equals("") ? null : new Short(str6);
       }
       String str5 = getValueByTagName(paramString1, "BILLTYPE");
       Object localObject3 = "".equals(str5.trim()) ? null : new Short(str5);
       String str6 = getValueByTagName(paramString1, "SO");
       Order localOrder = new Order();
       localOrder.setTraderID(str1);
       localOrder.setCustomerID(str3);
       localOrder.setCommodityID(str4);
       localOrder.setBuyOrSell(localShort1);
       localOrder.setOrderType(localShort2);
       localOrder.setPrice(localDouble);
       localOrder.setQuantity(localLong);
       localOrder.setCloseMode((Short) localObject1);
       localOrder.setSpecPrice((Double) localObject2);
       localOrder.setSpecTime(localShort3);
       localOrder.setBillTradeType((Short) localObject3);
       int i = localOrder.getOrderType().shortValue();
       if (!"".equals(str6)) {
         localOrder.setSpecialOrderFlag(Short.valueOf(Short.parseShort(str6)));
       }
       paramResponseResult =
           submitOrder(l, localOrder, paramResponseResult, localOrderReturnValue, str2);
     }
   } catch (ConnectException localConnectException) {
     this.log.error("change_password rmi conection exception" + localConnectException);
     paramResponseResult.setRetCode(-201);
     paramResponseResult.setMessage(this.properties.getProperty("-201"));
     initRMI();
   } catch (RemoteException localRemoteException) {
     this.log.error("order error:" + localRemoteException);
     errorException(localRemoteException);
     paramResponseResult.setRetCode(-202);
     paramResponseResult.setMessage(this.properties.getProperty("-202"));
   } catch (Exception localException) {
     this.log.error("order error:" + localException);
     errorException(localException);
     paramResponseResult.setRetCode(-203);
     paramResponseResult.setMessage(this.properties.getProperty("-203"));
   }
   if ("mobile".equals(paramString2)) {
     this.mobileServlet.renderXML(
         paramHttpServletResponse,
         ResponseXml.order(str1, paramResponseResult, localOrderReturnValue));
   } else {
     renderXML(
         paramHttpServletResponse,
         ResponseXml.order(str1, paramResponseResult, localOrderReturnValue));
   }
 }
Example #2
0
 protected void order_wd(
     HttpServletRequest paramHttpServletRequest,
     HttpServletResponse paramHttpServletResponse,
     String paramString1,
     ResponseResult paramResponseResult,
     String paramString2) {
   if (this.log.isDebugEnabled()) {
     this.log.debug("Entering 'order_wd' method ");
   }
   String str1 = "";
   OrderReturnValue localOrderReturnValue = new OrderReturnValue();
   try {
     String str2 = getLogonType(paramString2);
     str1 = getValueByTagName(paramString1, "USER_ID");
     if ("".equals(str1)) {
       str1 = getValueByTagName(paramString1, "TRADER_ID");
     }
     international((String) lanaguages.get(str1));
     Long localLong = new Long(getValueByTagName(paramString1, "ORDER_NO"));
     long l = parseLong(getValueByTagName(paramString1, "SESSION_ID"));
     if (!isLogon(paramHttpServletRequest, str1, l, str2)) {
       paramResponseResult.setRetCode(-201);
       paramResponseResult.setMessage(this.properties.getProperty("-205"));
     } else {
       OrdersManager localOrdersManager = (OrdersManager) getBean("ordersManager");
       Orders localOrders = new Orders();
       localOrders.setA_OrderNo(localLong);
       Privilege localPrivilege = getSessionBean(paramHttpServletRequest);
       List localList = localOrdersManager.my_order_query(localOrders, localPrivilege);
       Map localMap = (Map) localList.get(0);
       String str3 = (String) localMap.get("TraderID");
       int i = 0;
       if (localMap.get("CloseFlag") != null) {
         i = ((BigDecimal) localMap.get("CloseFlag")).intValue();
       }
       if ((str1 != null) && (i != 2)) {
         Order localOrder = new Order();
         localOrder.setCommodityID((String) localMap.get("CommodityID"));
         localOrder.setCustomerID((String) localMap.get("CustomerID"));
         localOrder.setTraderID(str1);
         localOrder.setOrderType(Short.valueOf("4"));
         localOrder.setWithdrawID(localLong);
         String str4 = (String) localMap.get("TRADER_ID");
         if ((str4 == null) || (tradeRMI.getFirmID(str3).equals(localPrivilege.getFirmId()))) {
           paramResponseResult =
               submitOrder(l, localOrder, paramResponseResult, localOrderReturnValue, str2);
         } else {
           paramResponseResult.setRetCode(1);
           paramResponseResult.setMessage(this.properties.getProperty("1"));
         }
       } else if (i == 2) {
         paramResponseResult.setRetCode(1);
         paramResponseResult.setMessage(this.properties.getProperty("-14"));
       } else {
         paramResponseResult.setRetCode(1);
         paramResponseResult.setMessage(this.properties.getProperty("1"));
       }
     }
   } catch (ConnectException localConnectException) {
     this.log.error("change_password rmi conection exception" + localConnectException);
     paramResponseResult.setRetCode(-201);
     paramResponseResult.setMessage(this.properties.getProperty("-201"));
     initRMI();
   } catch (RemoteException localRemoteException) {
     this.log.error("order_wd error:" + localRemoteException.getMessage());
     errorException(localRemoteException);
     paramResponseResult.setRetCode(-202);
     paramResponseResult.setMessage(this.properties.getProperty("-202"));
   } catch (Exception localException) {
     this.log.error("order_wd error:" + localException.getMessage());
     errorException(localException);
     paramResponseResult.setRetCode(-203);
     paramResponseResult.setMessage(this.properties.getProperty("-203"));
   }
   if ("mobile".equals(paramString2)) {
     this.mobileServlet.renderXML(
         paramHttpServletResponse,
         ResponseXml.responseXml(
             str1,
             paramResponseResult.getName(),
             paramResponseResult.getRetCode(),
             paramResponseResult.getMessage()));
   } else {
     renderXML(
         paramHttpServletResponse,
         ResponseXml.responseXml(
             str1,
             paramResponseResult.getName(),
             paramResponseResult.getRetCode(),
             paramResponseResult.getMessage()));
   }
 }