/**
   * 根据查询条件分页查询出符合条件的商品订单信息
   *
   * @author 左香勇 2014-9-9
   * @update
   * @return String 返回跳转到指定页面的字符串
   * @since vmaque 1.5
   */
  public String toconSumerOrderManager() {

    String pageId = request.getParameter("pageid"); // pageid
    String state = request.getParameter("state");

    PageData pageData = new PageData();
    pageData.setId(pageId);

    PageData paData = pageManageFacade.findPageDataById(pageData);

    PageInfoExtraData pageInfoExtraData = new PageInfoExtraData();

    pageInfoExtraData.setPageId(pageId);

    PageInfoExtraData piData = pageInfoExtraFacade.searchByPageId(pageInfoExtraData);

    conSumerOrderData.setPageId(pageId);
    if (state != null && !"".equals(state)) {
      conSumerOrderData.setState(Integer.parseInt(state));
    }

    // 查询订单分页信息
    List<ConsumerOrderGoodsinfoData> list =
        orderManagerFacade.getConSumerOrderGoodsInfoDataList(pageRoll, conSumerOrderData);

    // 查询各订单统计信息,并存储到map中
    Map<String, Integer> orderNumMap = new HashMap<String, Integer>();

    orderNumMap.put("type0", orderManagerFacade.serachOrderNum(pageId, 0));
    orderNumMap.put("type1", orderManagerFacade.serachOrderNum(pageId, 1));
    orderNumMap.put("type2", orderManagerFacade.serachOrderNum(pageId, 2));
    // 把查询到的订单传到前台
    request.setAttribute("orderNumMap", orderNumMap);
    // 把查询的分页订单集合传到前台
    request.setAttribute("listOrderManager", list);
    String path = ReadDomain.readProperties();
    request.setAttribute("path", path);
    // 把page访问路径传到前台
    if (piData != null && !"".equals(piData)) {
      if (piData.getDomain() != null && !"".equals(piData.getDomain())) {
        this.request.setAttribute("pageUrl", piData.getDomain());
      }
    }
    // 把page名称传到前台
    if (paData.getName() != null && !"".equals(paData.getName())) {
      this.request.setAttribute("pageName", paData.getName());
    }
    // 把pageid传到前台
    request.setAttribute("pageid", pageId);
    // 把当前订单状态传到前台
    request.setAttribute("state", state);

    return "toconSumerOrderManager";
  }
  /**
   * 确定发货流程
   *
   * @author 左香勇 <br>
   *     2014-9-12
   * @update
   * @since vmaque 1.5
   */
  public void updateConsumerOrder() {
    conSumerOrderData.setState(2); // 已发货

    conSumerOrderData.setLogisticsCompany(
        URLDecoder.decode(conSumerOrderData.getLogisticsCompany()));
    orderManagerFacade.updateConsumerOrder(conSumerOrderData);
  }
  /**
   * 跳转到后台微站订单统计管理
   *
   * @author 左香勇 <br>
   *     2014-9-13
   * @update
   * @return String 返回跳转到指定页面的字符串
   * @since vmaque 1.5
   */
  public String tobackOrderManager() {

    UserData userData = new UserData();

    String loginAccount = request.getParameter("loginAccount");
    String state = request.getParameter("state"); // 订单状态

    if (loginAccount != null && !loginAccount.equals("")) {
      userData.setLoginMail(loginAccount);
      userData.setLoginMoble(loginAccount);
    }
    if (state != null && !"".equals(state)) {
      conSumerOrderData.setState(Integer.parseInt(state));
    }

    List<ConsumerOrderGoodsinfoData> listOrder =
        orderManagerFacade.getConSumerOrderGoodsInfoDataListBack(
            pageRoll, conSumerOrderData, userData);

    request.setAttribute("listOrder", listOrder);

    request.setAttribute("conSumerOrderData", conSumerOrderData);

    request.setAttribute("userData", userData);

    request.setAttribute("state", state);

    return "tobackOrderManager";
  }
 /**
  * 支付成功 修改订单状态 且返回订单所对象的page<br>
  *
  * @author 冯鑫<br>
  *     2014-9-13
  * @update
  * @param
  * @return
  * @exception/throws
  * @see OrderManagerAction#paySuccessWithOrderChangeState
  * @since vmaque2.0
  */
 public void paySuccessWithOrderChangeState() {
   String fileName = "domain.properties";
   String path = ResouceUtil.getProperty(fileName, "path"); // 读取红包系统的路径
   PageInfoExtraData pageInfoExtraData =
       orderManagerFacade.paySuccessWithOrderChangeState(conSumerOrderData);
   json = path + pageInfoExtraData.getDomain();
 }
  /**
   * 生成订单,跳转到支付宝支付页面<br>
   *
   * @author 冯鑫<br>
   *     2014-9-12
   * @throws IOException
   * @update 侯杨
   * @see OrderManagerAction#toPayOrder
   * @since vmaque1.5
   */
  public String toPayOrder() throws IOException {
    String price = request.getParameter("price");
    String paytype = request.getParameter("paytype"); // 支付方式
    // 商品总价赋值
    conSumerUserData.setPayType(Integer.parseInt(paytype));
    commodityConfigData.setConfigPrice(Double.parseDouble(price));
    conSumerOrderData =
        orderManagerFacade.createOrder(
            commodityConfigData, conSumerUserData, pageDomainName, goodsNum);
    GoodsInfoData goodsInfoData = new GoodsInfoData();
    goodsInfoData.setId(commodityConfigData.getGoodsInfoData().getId());
    goodsInfoData = goodsInfoFacade.getGoodsInfoData(goodsInfoData);
    String alipayForm;

    conSumerOrderData.setPrice(Double.parseDouble(price));
    if (price.equals("0")) {
      request.setAttribute("ordercode", conSumerOrderData.getOrderCode());
      if (conSumerUserData.getRedPackageId() != null
          && !"".equals(conSumerUserData.getRedPackageId())) {
        request.setAttribute("redpackageId", conSumerUserData.getRedPackageId());
        request.setAttribute("cId", conSumerUserData.getcId());
        request.setAttribute("sId", conSumerUserData.getsId());
      }
      return "payForSuccess_order";
    }
    // 如果为1 则是pc支付
    if ("1".equals(pcFlag)) {
      alipayForm = this.getAlipayForm(conSumerOrderData, goodsInfoData); // 支付的表单getAlipayForm_Phone
    } else {
      alipayForm = this.getAlipayForm_Phone(conSumerOrderData, goodsInfoData);
    }
    request.setAttribute("alipayForm", alipayForm);
    return "toPayJsp";
  }
 /**
  * 根据微信ip查询消费者的地址 电话 名字等信息<br>
  *
  * @author 侯杨 <br>
  *     2014年11月24日
  * @update
  * @throws IOException
  * @see OrderManagerAction#payfor_orderGood()
  * @since vmaque2.0
  */
 public void payfor_orderGood() throws IOException {
   // 声明消费者集合
   List<ConSumerUserData> conSumerUserDatas = new ArrayList<ConSumerUserData>();
   conSumerUserDatas = orderManagerFacade.getConSumerUserDatasByOpenId(conSumerUserData);
   if (conSumerUserDatas.size() > 0) {
     JSONArray data = JSONArray.fromObject(conSumerUserDatas);
     response.getWriter().print(data);
   } else {
     response.getWriter().print("1");
   }
 }
 /**
  * 对订单进行付款或者取消订单操作<br>
  *
  * @author 侯杨 <br>
  *     2014年12月08日
  * @update
  * @throws IOException
  * @see OrderManagerAction#payOrclosed_weixin()
  * @since vmaque2.0
  */
 public String payOrclosed_weixin() throws IOException {
   // 操作码 1为付款 2 为取消订单
   String alipayForm;
   String op = request.getParameter("op");
   // 微信id
   String openid = request.getParameter("openid");
   // 订单编号
   String code = request.getParameter("code");
   String callback = request.getParameter("jsoncallback");
   if (op == null || "".equals(op) || code == null || "".equals(code)) {
     String returnJsonStr = callback + "({\"SUCCESS\": false, \"MESSAGE\": \"获取数据失败\"})";
     request.setAttribute("result", returnJsonStr);
     return "closedOrder";
   }
   conSumerOrderData.setOrderCode(code);
   if (op.equals("1")) {
     ConsumerOrderGoodsinfoData orderGoodsinfoData =
         orderManagerFacade.findConSumerOrderGoodsInfoByOrderId(conSumerOrderData);
     GoodsInfoData goodsInfoData = new GoodsInfoData();
     goodsInfoData.setId(orderGoodsinfoData.getGoodsInfId());
     // 查询商品信息
     GoodsInfoData infoData = goodsInfoFacade.getGoodsInfoData(goodsInfoData);
     conSumerOrderData.setPrice(orderGoodsinfoData.getConSumerOrderData().getPrice());
     alipayForm = this.getAlipayForm_PhoneWeixin(conSumerOrderData, infoData);
   } else {
     // 取消订单
     alipayForm = orderManagerFacade.closedConSumerOrderDataWeixin(conSumerOrderData);
   }
   if ("success".equals(alipayForm)) {
     String returnJsonStr = callback + "({\"SUCCESS\": true})";
     request.setAttribute("result", returnJsonStr);
     return "closedOrder";
   } else if ("erro".equals(alipayForm)) {
     String returnJsonStr = callback + "({\"SUCCESS\": false})";
     request.setAttribute("result", returnJsonStr);
     return "closedOrder";
   } else {
     request.setAttribute("alipayForm", alipayForm);
     return "toPayJsp";
   }
 }
  /**
   * 跳转到后台用户订单显示详情页面,并准备所需数据
   *
   * @author 左香勇 <br>
   *     2014-9-15
   * @update
   * @return String 返回跳转到指定页面的字符串
   * @since vmaque 1.5
   */
  public String tobackOrderManagerInfo() {

    String id = request.getParameter("id");

    ConsumerOrderGoodsinfoData consumerOrderGoodsinfoData =
        orderManagerFacade.getConSumerOrderGoodsInfoDataById(id);

    String path = ReadDomain.readProperties();
    request.setAttribute("path", path);
    request.setAttribute("cogData", consumerOrderGoodsinfoData);

    return "tobackOrderManagerInfo";
  }
  /**
   * 生成订单,跳转到微信支付<br>
   *
   * @author 侯杨<br>
   *     2015-01-13
   * @throws IOException
   * @update
   * @see OrderManagerAction#toweixinPayOrder
   * @since vmaque2.0
   */
  public void toweixinPayOrder() throws IOException {
    String price = request.getParameter("price");
    String paytype = request.getParameter("paytype"); // 支付方式
    // 商品总价赋值
    conSumerUserData.setPayType(Integer.parseInt(paytype));
    commodityConfigData.setConfigPrice(Double.parseDouble(price));
    conSumerOrderData =
        orderManagerFacade.createOrder(
            commodityConfigData, conSumerUserData, pageDomainName, goodsNum);
    GoodsInfoData goodsInfoData = new GoodsInfoData();
    goodsInfoData.setId(commodityConfigData.getGoodsInfoData().getId());
    goodsInfoData = goodsInfoFacade.getGoodsInfoData(goodsInfoData);

    conSumerOrderData.setPrice(Double.parseDouble(price));
    conSumerOrderData.setGoodsName(goodsInfoData.getGoodsName());
    if (conSumerOrderData != null) {
      conSumerOrderData.setConSumerUserData(conSumerUserData);
      JSONObject object = JSONObject.fromObject(conSumerOrderData);
      response.getWriter().print(object);
    } else {
      response.getWriter().print("1");
    }
  }
 /**
  * 付款成功<br>
  *
  * @author 侯杨 <br>
  *     2014年12月08日
  * @update
  * @throws IOException
  * @see OrderManagerAction#paySuccess_weixin()
  * @since vmaque2.0
  */
 public void paySuccess_weixin() {
   orderManagerFacade.payConSumerOrderDataSuccessWeixin(conSumerOrderData);
 }