コード例 #1
0
ファイル: CoreBusiness.java プロジェクト: etc1208/vmapAPI
 @SuppressWarnings("unchecked")
 public static String formXML(JSONArray array, boolean success) {
   StringBuilder sb = new StringBuilder();
   sb.append("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n");
   sb.append("<results>\n");
   sb.append("<success>" + success + "</success>\n");
   sb.append("<total>" + array.size() + "</total>\n");
   sb.append("<rows>");
   JSONObject object = null;
   for (int i = 0; i < array.size(); i++) {
     object = array.getJSONObject(i);
     Iterator<String> o = object.keys();
     sb.append("<unit>\n");
     for (; o.hasNext(); ) {
       String temp = o.next();
       sb.append("<" + temp + ">");
       sb.append(object.getString(temp));
       sb.append("</" + temp + ">\n");
     }
     sb.append("</unit>\n");
   }
   sb.append("</rows>\n");
   sb.append("</results>");
   if (object != null) {
     object.clear();
     object = null;
   }
   return sb.toString();
 }
コード例 #2
0
  public String getSuSheXinXi() {
    int qingshihaoID = Integer.parseInt(this.getRequest().getParameter("qingshihaoID").toString());
    //		long wangDianId=()
    List lstQinShi = renYuanService.QueryQinShi(qingshihaoID);

    JSONArray jsArr = new JSONArray();
    JSONObject jsObj = new JSONObject();
    for (int i = 0; i < lstQinShi.size(); i++) {
      Object[] obj = (Object[]) lstQinShi.get(i);
      jsObj.clear();
      jsObj.put("qingshihaoId", obj[0]);
      jsObj.put("qingshihaoname", obj[1]);
      jsObj.put("xingming", obj[2]);
      jsObj.put("renyuanId", obj[4]);

      jsObj.put("xingbie", obj[5]);
      jsObj.put("shengfenzheng", obj[6]);
      jsObj.put("xuehao", obj[7]);
      jsObj.put("dianhua", obj[8]);

      //			jsObj.put("actionColumn","删除");
      jsArr.add(jsObj);
    }
    HashMap<String, Object> jsMap = new HashMap<String, Object>();
    jsMap.put("rows", jsArr);
    JSObj = JSONObject.fromObject(jsMap);
    return SUCCESS;
  }
コード例 #3
0
 /**
  * @Title: addCartToDb @Description: (添加商品至购物车数据库)
  *
  * @author <a href="*****@*****.**">赖彩妙</a>
  * @date 2015-4-12
  * @version 1.0.0
  * @param request
  * @param newCart
  * @param accountId
  * @param @return
  * @param @throws Exception
  * @return String 返回类型
  * @throws
  */
 private String addCartToDb(Cart newCart, Integer accountId) throws Exception {
   // 根据用户id查询购物车商品
   HeadObject headObject = CommonHeadUtil.geneHeadObject("cartService.findCartListByAccountId");
   JSONObject jsonObject = new JSONObject();
   jsonObject.put("accountId", accountId);
   ResultObject resultObject =
       (ResultObject)
           orderService.doServiceByServer(new RequestObject(headObject, jsonObject)); // 判断失效商品?
   List<Cart> cartList =
       (List<Cart>) JSONArray.toCollection((JSONArray) resultObject.getContent(), Cart.class);
   // 判断购物车中是否已存在该商品,存在则加数量,不存在则加入购物车
   boolean isExist = false;
   for (Cart c : cartList) {
     if (c.getProductId().equals(newCart.getProductId())) // 该商品已存在
     {
       // 修改购物车中商品购买数量
       headObject = CommonHeadUtil.geneHeadObject("cartService.updateQuantityByProAndMem");
       newCart.setQuantity(c.getQuantity() + newCart.getQuantity());
       headObject =
           (HeadObject)
               orderService.doServiceByServer(
                   new RequestObject(headObject, JSONObject.fromObject(newCart)));
       if (headObject.getRetCode().equals(ErrorCode.FAILURE)) {
         return errorMsg;
       }
       isExist = true;
     }
   }
   if (!isExist) {
     if (cartList.size() >= MAX_CART_SIZE) {
       return "购物车已满,请清理后再加入购物车";
     } else {
       // 将购物车数据存入数据库
       headObject = CommonHeadUtil.geneHeadObject("cartService.saveCart");
       jsonObject.clear();
       jsonObject.put("specValueId", newCart.getSpecValueId());
       newCart.setSpecValueId(null);
       newCart.setCartId(null);
       jsonObject.put("newCart", newCart);
       headObject =
           (HeadObject) orderService.doServiceByServer(new RequestObject(headObject, jsonObject));
       if (resultObject.getHead().getRetCode().equals(ErrorCode.FAILURE)) {
         return errorMsg;
       }
     }
   }
   return null;
 }
コード例 #4
0
 public JSONArray getQinShiHao(int loudongId) {
   JSONObject jsObj = new JSONObject();
   List lstWangDian = renYuanService.QueryQinShiHao(loudongId);
   if (lstWangDian.size() == 0) {
     return null;
   } else {
     JSONArray childArr = new JSONArray();
     for (int i = 0; i < lstWangDian.size(); i++) {
       Object[] obj = (Object[]) lstWangDian.get(i);
       jsObj.clear();
       jsObj.put("id", obj[0]);
       jsObj.put("text", obj[1]);
       jsObj.put("attributes", "{'lvl':4}");
       childArr.add(jsObj);
     } // for
     return childArr;
   } // else
 }
コード例 #5
0
 public JSONArray getLouDongAll(int quyuId) {
   JSONObject jsObj = new JSONObject();
   List lstCity = renYuanService.QueryLouDong(quyuId);
   if (lstCity.size() == 0) {
     return null;
   } else {
     JSONArray childArr = new JSONArray();
     for (int i = 0; i < lstCity.size(); i++) {
       Object[] obj = (Object[]) lstCity.get(i);
       jsObj.clear();
       jsObj.put("id", obj[0]);
       jsObj.put("text", obj[1]);
       jsObj.put("attributes", "{'lvl':2}");
       if (getQinShiHao(Integer.parseInt(obj[0].toString())) != null) {
         jsObj.put("state", "closed");
         jsObj.put("children", getQinShiHao(Integer.parseInt(obj[0].toString())));
       } // if
       childArr.add(jsObj);
     } // for
     return childArr;
   } // else
 }
コード例 #6
0
  public String getQuYuAll() {
    List lstProvince = renYuanService.QueryQuYu();
    JSONArray jsArr = new JSONArray();
    JSONObject jsObj = new JSONObject();
    for (int i = 0; i < lstProvince.size(); i++) {
      Object[] obj = (Object[]) lstProvince.get(i);
      jsObj.clear();
      jsObj.put("id", obj[0]);
      jsObj.put("text", obj[1]);
      jsObj.put("attributes", "{'lvl':1}");
      if (getLouDongAll(Integer.parseInt(obj[0].toString())) != null) {
        jsObj.put("state", "closed");
        jsObj.put("children", getLouDongAll(Integer.parseInt(obj[0].toString())));
      }
      jsArr.add(jsObj);
    }

    HashMap<String, Object> jsMap = new HashMap<String, Object>(); // 实例化一个哈希映射对象
    jsMap.put("", jsArr);
    JSArr = jsArr;
    return SUCCESS; // 返回
  }
コード例 #7
0
  /**
   * @Title: addCartdata @Description: (判断加入购物车的数据是否合法)
   *
   * @author <a href="*****@*****.**">赖彩妙</a>
   * @date 2015-4-11
   * @version 1.0.0
   * @param request
   * @param goodsId
   * @param quantity
   * @param specValueId
   * @param productIdString
   * @param accountId
   * @param @return
   * @param @throws Exception
   * @return String 返回类型
   * @throws
   */
  private String addCartdata(
      String goodsIdString,
      String quantityString,
      String specValueId,
      String productIdString,
      Integer accountId,
      String appointment)
      throws Exception {
    Integer quantity = 1;
    if (quantityString != null && !"".equals(quantityString.trim())) {
      quantity = Integer.parseInt(quantityString);
    }
    if (quantity == null || quantity < 1) {
      quantity = 1;
    }
    HeadObject headObject;
    ResultObject resultObject;
    JSONObject jsonObject;
    Integer productId;
    ProductImgDTO product;
    GoodsWithBLOBs goodsWithBLOBs = null;
    Integer goodsId;
    if (productIdString != null && !"".equals(productIdString.trim())) {
      productId = Integer.parseInt(productIdString);
      // 查询商品对象
      headObject = CommonHeadUtil.geneHeadObject("goodsService.selectByProductId");
      resultObject =
          (ResultObject) itemService.doServiceByServer(new RequestObject(headObject, productId));
      goodsWithBLOBs = (GoodsWithBLOBs) resultObject.getContent();

      // 查询货品对象
      headObject = CommonHeadUtil.geneHeadObject("productService.findByProductId");
      resultObject =
          (ResultObject) itemService.doServiceByServer(new RequestObject(headObject, productId));

    } else {
      if (goodsIdString != null && !"".equals(goodsIdString.trim())) {
        goodsId = Integer.parseInt(goodsIdString.trim());
        // 根据商品id查询商品对象
        headObject = CommonHeadUtil.geneHeadObject("goodsService.selectByGoodsId");
        jsonObject = new JSONObject();
        jsonObject.put("goodsId", goodsId);
        resultObject =
            (ResultObject) itemService.doServiceByServer(new RequestObject(headObject, jsonObject));
        goodsWithBLOBs =
            (GoodsWithBLOBs)
                JSONObject.toBean((JSONObject) resultObject.getContent(), GoodsWithBLOBs.class);
        if (goodsWithBLOBs != null && goodsWithBLOBs.getGoodsId() != null) // 商品存在,状态
        {
          // 根据分类id查询该商品是否有规格
          headObject = CommonHeadUtil.geneHeadObject("categoryService.getCatSpecByCatId");
          jsonObject.clear();
          jsonObject.put("catId", goodsWithBLOBs.getCatId());
          resultObject =
              (ResultObject)
                  itemService.doServiceByServer(new RequestObject(headObject, jsonObject));
          List<CatSpecShip> catSpecShipList =
              (List<CatSpecShip>)
                  JSONArray.toCollection(
                      JSONArray.fromObject(resultObject.getContent()), CatSpecShip.class);
          String specInfo = null;
          if (catSpecShipList != null && catSpecShipList.size() >= 1) {
            // 根据用户选择的商品规格查询规格对象
            List<Integer> specValueIdList =
                (List<Integer>)
                    JSONArray.toCollection(JSONArray.fromObject(specValueId), Integer.class);
            if (specValueIdList != null && specValueIdList.size() >= 1) {
              headObject = CommonHeadUtil.geneHeadObject("specService.selectSpecAndValueById");
              resultObject =
                  (ResultObject)
                      itemService.doServiceByServer(
                          new RequestObject(headObject, JSONArray.fromObject(specValueIdList)));
              List<SpecQryDTO> specQryDTOList =
                  (List<SpecQryDTO>)
                      JSONArray.toCollection(
                          JSONArray.fromObject(resultObject.getContent()), SpecQryDTO.class);
              if (specQryDTOList != null && specQryDTOList.size() >= 1) {
                StringBuffer sb = new StringBuffer();
                for (int i = 0; i < specQryDTOList.size(); i++) {
                  sb.append(specQryDTOList.get(i).getSpecName());
                  sb.append(":");
                  sb.append(specQryDTOList.get(i).getSpecValueName());
                  sb.append(",");
                }
                specInfo = sb.toString();
              } else {
                return "商品规格不存在";
              }
            } else {
              return "请选择商品规格";
            }
          } else {
            // 该商品没有规格 查询product对象
          }
          // 查询product对象
          headObject = CommonHeadUtil.geneHeadObject("productService.selectBySpecInfoAndGoodsId");
          resultObject =
              (ResultObject)
                  itemService.doServiceByServer(
                      new RequestObject(
                          headObject,
                          specInfo != null
                              ? JSONObject.fromObject(
                                  "{goodsId:\"" + goodsId + "\",specInfo:\"" + specInfo + "\"}")
                              : JSONObject.fromObject("{goodsId:\"" + goodsId + "\"}")));
        } else {
          return "该商品不存在";
        }
      } else {
        return "该商品不存在";
      }
    }
    Integer storeId = null;
    if (resultObject != null && resultObject.getContent() != null) {
      product = (ProductImgDTO) resultObject.getContent();
      //			System.out.println("controller...productId.."+product.getProductId());
      if (product != null && product.getProductId() != null && product.getProductId() != 0) {
        if ("1".equals(product.getDisabled()) || "1".equals(goodsWithBLOBs.getDisabled())) {
          return "很抱歉,该货品不存在";
        }

        if ("0".equals(product.getMarketable()) || "0".equals(goodsWithBLOBs.getMarketable())) {
          return "很抱歉,该货品已下架";
        }

        if (product.getStoreInt() <= 0) {
          return "该货品库存不足";
        } else {
          quantity = product.getStoreInt() < quantity ? product.getStoreInt() : quantity;
        }
        String specDesc = product.getSpecDesc();
        if (specDesc != null && !"".equals(specDesc)) {
          String[] specItems = specDesc.split(",");
          if (specItems != null && specItems.length >= 1) {
            for (int i = specItems.length - 1; i >= 0; i--) {
              if (specItems[i].split(":")[0].split("\\|")[1].equals("分店")) {
                storeId = Integer.parseInt(specItems[i].split(":")[1].split("\\|")[0]);
                break;
              }
            }
          }
        }
      } else {
        return "该货品不存在";
      }
    } else {
      return "该货品不存在";
    }
    if (!(storeId != null && storeId != 0)) {
      storeId = goodsWithBLOBs.getStoreId();
    }
    // 查询分店
    if (storeId != null && storeId != 0) {
      List<Integer> storeIdList = new ArrayList<Integer>();
      storeIdList.add(storeId);
      headObject = CommonHeadUtil.geneHeadObject("storeService.selectByStoreIdList3");
      resultObject =
          (ResultObject)
              memberService.doServiceByServer(new RequestObject(headObject, storeIdList));
      List<Store> storeList = null;
      if (resultObject.getContent() != null) {
        storeList =
            com.alibaba.fastjson.JSONArray.parseArray(
                resultObject.getContent().toString(), Store.class);
      }
      if (storeList != null) {
        if ("1".equals(storeList.get(0).getLimitGoodsdown())
            || "1".equals(storeList.get(0).getLimitStore())
            || "1".equals(storeList.get(0).getLimitStoredown())
            || "1".equals(storeList.get(0).getDisabled())
            || "1".equals(storeList.get(0).getStatus())
            || "1".equals(storeList.get(0).getShopstatus())) {
          return "很抱歉,该货品已下架";
        }
      }
    }
    newCart =
        new Cart(
            null,
            product.getGoodsId(),
            product.getProductId(),
            goodsWithBLOBs.getCompanyId(),
            storeId,
            specValueId != null && !"".equals(specValueId)
                ? specValueId.substring(1, specValueId.length() - 1)
                : "",
            quantity,
            (int) (System.currentTimeMillis() / 1000),
            appointment);
    return "";
  }
コード例 #8
0
  /**
   * @Title: orderAdd @Description: (提交订单)
   *
   * @author <a href="*****@*****.**">赖彩妙</a>
   * @date 2015-4-18
   * @version 1.0.0
   * @param request
   * @param response
   * @param @return
   * @param @throws Exception
   * @return Object 返回类型
   * @throws
   */
  @ResponseBody
  @RequestMapping("/submitOrder")
  public Object submitOrder(String data, HttpServletRequest request) throws Exception {
    log.info("start[CartController.submitOrder]");
    // 获取请求参数
    JSONObject jsonData = JSONObject.fromObject(data);
    MemberListDo memberListDo =
        APICommonUtil.getMemberListDo((String) request.getAttribute("sessionid"));

    //  		//测试
    //  		memberListDo = new MemberListDo();
    //  		memberListDo.setAccountType("100");
    //  		memberListDo.setMemberId("62");
    //  		memberListDo.setAccountId(152);
    //  		memberListDo.setLoginName("YOYO");

    // 订单号
    ResultObject resultObject = null;
    HeadObject headObject = null;
    JSONObject jsonObject = new JSONObject();
    // 查询当前登陆的member对象
    if (memberListDo == null || !memberListDo.getAccountType().equals("100")) {
      return new ResultObject(
          new HeadObject(ErrorCode.FAILURE), JSONObject.fromObject("{result:false,isBuyer:false}"));
    }
    // 用户已登录
    String storeIdString = jsonData.getJSONArray("storeIds").toString();
    String payment = (String) CommonUtil.getJsonValue(jsonData, "payment");

    String proIdsString = jsonData.getJSONArray("proIdListString").toString();
    String remark = jsonData.getString("remark");
    String quantityListString = jsonData.getJSONArray("quantityListString").toString();
    Integer point =
        StringUtil.isNotEmpty((String) CommonUtil.getJsonValue(jsonData, "point"))
            ? Integer.parseInt((String) CommonUtil.getJsonValue(jsonData, "point"))
            : 0;
    String appointmentStr = (String) CommonUtil.getJsonValue(jsonData, "appointmens");
    String goodsIdsStr = (String) CommonUtil.getJsonValue(jsonData, "goodsIds");

    List<Integer> storeIdList = null;
    payment =
        (payment != null && ("到店支付".equals(payment) || "在线支付".equals(payment))) ? payment : "在线支付";
    if (StringUtil.isEmpty(storeIdString)) {
      return new ResultObject(
          new HeadObject(ErrorCode.FAILURE), JSONObject.fromObject("{result:false,msg:'请选择门店'}"));
    }
    storeIdList =
        (List<Integer>) JSONArray.toCollection(JSONArray.fromObject(storeIdString), Integer.class);
    if (null == storeIdList || storeIdList.size() <= 0) {
      return new ResultObject(
          new HeadObject(ErrorCode.FAILURE), JSONObject.fromObject("{result:false,msg:'请选择门店'}"));
    }
    List<Integer> proIdList = null;
    if (StringUtil.isEmpty(proIdsString)) {
      return new ResultObject(
          new HeadObject(ErrorCode.FAILURE), JSONObject.fromObject("{result:false,msg:'该货品不存在'}"));
    }
    proIdList =
        (List<Integer>) JSONArray.toCollection(JSONArray.fromObject(proIdsString), Integer.class);
    if (null == proIdList || proIdList.size() <= 0) {
      return new ResultObject(
          new HeadObject(ErrorCode.FAILURE), JSONObject.fromObject("{result:false,msg:'该货品不存在'}"));
    }
    Member member = this.selectMember(memberListDo.getAccountId());
    if (point > member.getPointUseable().intValue()) {
      return new ResultObject(
          new HeadObject(ErrorCode.FAILURE),
          JSONObject.fromObject("{result:false,msg:'可用积分小于兑换积分'}"));
    }
    List<Integer> quantityList =
        (List<Integer>)
            JSONArray.toCollection(JSONArray.fromObject(quantityListString), Integer.class);
    // 根据proIdList查询购物车对象
    headObject = CommonHeadUtil.geneHeadObject("cartService.findMemberCartListByProIdList");
    Map<String, Object> cartParam = new HashMap<String, Object>();
    cartParam.put("proIdList", proIdList);
    cartParam.put("memberId", Integer.valueOf(memberListDo.getMemberId()));
    resultObject =
        (ResultObject) orderService.doServiceByServer(new RequestObject(headObject, cartParam));
    List<CartListDTO> cartList =
        (List<CartListDTO>)
            JSONArray.toCollection(
                JSONArray.fromObject(resultObject.getContent()), CartListDTO.class);
    if (null != cartList && cartList.size() > 0) {
      for (CartListDTO cartListDTO : cartList) {
        if ("1".equals(cartListDTO.getLimitGoodsdown())
            || "1".equals(cartListDTO.getLimitStore())
            || "1".equals(cartListDTO.getLimitStoredown())
            || "1".equals(cartListDTO.getShopStatus())
            || "1".equals(cartListDTO.getStatus())
            || "1".equals(cartListDTO.getDisabled())) {
          return new ResultObject(
              new HeadObject(ErrorCode.FAILURE),
              JSONObject.fromObject("{result:false,isLogin:true,msg:\"很抱歉,该订单中存在失效货品\"}"));
        }
      }
    }
    if (cartList != null && cartList.size() >= 1) {
      // 查询店铺
      storeIdList.clear();
      for (int i = 0; i < cartList.size(); i++) {
        storeIdList.add(cartList.get(i).getStoreId());
      }
      headObject = CommonHeadUtil.geneHeadObject("storeService.selectByStoreIdList3");
      resultObject =
          (ResultObject)
              memberService.doServiceByServer(new RequestObject(headObject, storeIdList));
      List<Store> storeList = null;
      if (resultObject.getContent() != null) {
        storeList =
            com.alibaba.fastjson.JSONArray.parseArray(
                resultObject.getContent().toString(), Store.class);
      }
      if (storeList != null) {
        for (int i = 0; i < storeList.size(); i++) {
          if ("1".equals(storeList.get(i).getLimitGoodsdown())
              || "1".equals(storeList.get(i).getLimitStore())
              || "1".equals(storeList.get(i).getLimitStoredown())
              || "1".equals(storeList.get(i).getShopstatus())
              || "1".equals(storeList.get(i).getStatus())
              || "1".equals(storeList.get(i).getDisabled())) {
            return new ResultObject(
                new HeadObject(ErrorCode.FAILURE),
                JSONObject.fromObject("{result:false,isLogin:true,msg:'很抱歉,该订单中存在失效货品'}"));
          }
        }
      }

      for (int i = 0; i < cartList.size(); i++) {
        if ("0".equals(cartList.get(i).getgMarketable())
            || "1".equals(cartList.get(i).getgDisabled())
            || "0".equals(cartList.get(i).getpMarketable())
            || "1".equals(cartList.get(i).getpDisabled())) {
          return new ResultObject(
              new HeadObject(ErrorCode.FAILURE),
              JSONObject.fromObject("{result:false,isLogin:true,msg:'很抱歉,该订单中存在失效货品'}"));
        }
        for (int j = 0; j < proIdList.size(); j++) {
          if (proIdList.get(j).equals(cartList.get(i).getProductId())) {
            if (quantityList.get(j) > cartList.get(i).getStore()) {
              return new ResultObject(
                  new HeadObject(ErrorCode.FAILURE),
                  JSONObject.fromObject("{result:false,isLogin:true,msg:'很抱歉,该订单中存在货品库存不足'}"));
            } else {
              cartList.get(i).setQuantity(quantityList.get(j));
            }
          }
        }

        String specDesc = cartList.get(i).getSpecDesc();
        if (specDesc != null && !"".equals(specDesc)) {
          String[] specItems = specDesc.split(",");
          if (specItems != null && specItems.length >= 1) {
            for (int j = specItems.length - 1; j >= 0; j--) {
              if (specItems[j].split(":")[0].split("\\|")[1].equals("分店")) {
                cartList
                    .get(i)
                    .setStoreId(Integer.parseInt(specItems[j].split(":")[1].split("\\|")[0]));
                cartList.get(i).setStoreName(specItems[j].split(":")[1].split("\\|")[1]);
                break;
              }
            }
          }
        }
        cartList.get(i).setMemberId(Integer.valueOf(memberListDo.getMemberId()));
      }
    }

    // 判断请求来源是否来自移动端
    String checkFrom =
        jsonData.getString("fphoneostype") != null
                && jsonData.getString("fphoneostype").equals("5000")
            ? "appAndroid"
            : "appIOS";
    // 存入数据库
    if (null == cartList || cartList.size() <= 0) {
      // 删除购物车数据
      headObject = CommonHeadUtil.geneHeadObject("cartService.deleteCartByProIdAndMemberId");
      jsonObject.clear();
      jsonObject.put("memberId", memberListDo.getMemberId());
      jsonObject.put("proIdList", proIdList);
      orderService.doServiceByServer(new RequestObject(headObject, jsonObject));
      resultObject =
          new ResultObject(
              new HeadObject(ErrorCode.SUCCESS), JSONObject.fromObject("{result:true}"));
      resultObject =
          new ResultObject(
              new HeadObject(ErrorCode.FAILURE),
              JSONObject.fromObject("{result:false,msg:'订单提交失败,该订单中的货品不存在'}"));
    }

    for (CartListDTO cartListDTO : cartList) {
      headObject = CommonHeadUtil.geneHeadObject("goodsTimePriceService.findGoodsTimePrice");
      Map<String, Object> param = new HashMap<String, Object>();
      if (StringUtil.isNotEmpty(cartListDTO.getAppointment())) {
        int index =
            cartListDTO.getAppointment().indexOf("|") == -1
                ? cartListDTO.getAppointment().length()
                : cartListDTO.getAppointment().indexOf("|");
        param.put("priceDate", cartListDTO.getAppointment().substring(0, index));
      } else {
        param.put("priceDate", new Date());
      }
      param.put("goodsId", cartListDTO.getGoodsId());
      resultObject =
          (ResultObject) itemService.doServiceByServer(new RequestObject(headObject, param));
      if (null != resultObject.getContent()) {
        GoodsTimePrice goodsTimePrice = (GoodsTimePrice) resultObject.getContent();
        cartListDTO.setGoodsPrice(goodsTimePrice.getPrice().doubleValue());
      }
    }
    jsonObject.clear();
    jsonObject.put("member", member);
    jsonObject.put("cartList", cartList);
    jsonObject.put("payment", payment);
    jsonObject.put("checkFrom", checkFrom);
    jsonObject.put("ip", request.getRemoteAddr());
    jsonObject.put("remark", remark);
    jsonObject.put("memberName", memberListDo.getLoginName());
    jsonObject.put("point", point);
    synchronized (this) {
      headObject = CommonHeadUtil.geneHeadObject("cartService.saveOrder");
      resultObject =
          (ResultObject) orderService.doServiceByServer(new RequestObject(headObject, jsonObject));
      if (resultObject.getHead().getRetCode().equals(ErrorCode.FAILURE)) {
        return new ResultObject(
            new HeadObject(ErrorCode.SUCCESS),
            JSONObject.fromObject(
                "{result:false,msg:'订单提交失败," + resultObject.getHead().getRetMsg() + "'}"));
      } else {
        for (CartListDTO c : cartList) {
          headObject = CommonHeadUtil.geneHeadObject("productService.decreStore");
          jsonObject.clear();
          jsonObject.put("productId", c.getProductId());
          jsonObject.put("quantity", c.getQuantity());
          itemService.doServiceByServer(new RequestObject(headObject, jsonObject));
        }

        headObject = CommonHeadUtil.geneHeadObject("cartService.deleteCartByProIdAndMemberId");
        jsonObject.clear();
        jsonObject.put("memberId", memberListDo.getMemberId());
        jsonObject.put("proIdList", proIdList);
        orderService.doServiceByServer(new RequestObject(headObject, jsonObject));

        try {
          String[] appointments = appointmentStr.split(",");
          String[] goodsIds = goodsIdsStr.split(",");
          for (int j = 0; j < goodsIds.length; j++) {
            String key =
                goodsIds[j]
                    + "_"
                    + appointments[j].replace("-", "").replace(":", "").replace("|", "_");
            String count = redisService.get(key.toString());
            if (StringUtil.isEmpty(count)) {
              count = "1";
            } else {
              count = String.valueOf(Integer.valueOf(count) + 1);
            }
            redisService.set(key.toString(), count, 60 * 60 * 24);
          }
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
      return new ResultObject(new HeadObject(ErrorCode.SUCCESS), null);
    }
  }