Пример #1
0
  @Override
  public Base cancelOrder(String orderid) {

    List<Orders> ss = ordersDao.checkByOrderid(orderid);

    for (Orders orders : ss) {
      Integer goodsDetailId = orders.getGoodDetailId();
      Integer subbranchId = orders.getSubbranchId();
      Integer num = orders.getNum();
      String state = "已取消";
      ordersDao.updateOrderType(state, orders.getOrderid());
      goodsDSDao.updateAmount(goodsDetailId, subbranchId, -num);
    }
    Base base = new Base();
    base.setCode(101);
    base.setContent("OK");
    base.setResult("OK");
    //		Integer	goodsDetailId=Integer.parseInt(goods_detail_id);
    //		Integer	subbranchId=Integer.parseInt(subbranch_id);
    //		int	num1=num;
    //		String state="已取消";
    //		int i=   ordersDao.updateOrderType(state,orderid);
    //		System.out.println("ss");
    //		if(i>0){
    //		goodsDSDao.updateAmount(goodsDetailId, subbranchId, -num1);
    //		}

    return base;
  }
Пример #2
0
  @Override
  public void changeOrderStatus(String order_no, String pay_time) {
    List<Orders> ss = ordersDao.checkByOrderid(order_no);

    for (Orders orders : ss) {
      String state = "已支付";
      ordersDao.updateOrderType(state, orders.getOrderid());
    }
    if (ss.size() == 1) {
      userorderDao.insertPayTime(pay_time, order_no);
    }
  }
Пример #3
0
  @Override
  public Base confirmOrder(String orderid) {

    List<Orders> ss = ordersDao.checkByOrderid(orderid);

    for (Orders orders : ss) {
      String state = "交易完成";
      ordersDao.updateOrderType(state, orders.getOrderid());
    }
    Base base = new Base();
    base.setCode(101);
    base.setContent("OK");
    base.setResult("OK");
    return base;
  }
Пример #4
0
  @Transactional
  @SuppressWarnings({"rawtypes", "unused", "unchecked"})
  @Override
  public Base addOrder(
      String user_id,
      String subbranch_id,
      String goods_detail_id,
      String num,
      String state,
      Integer addressid,
      String totalMoney) {

    String[] detailId = goods_detail_id.split(";");
    String[] Number = num.split(";");
    String[] subbranchId = subbranch_id.split(";");
    String[] total_Money = totalMoney.split(";");
    for (int i = 0; i < detailId.length; i++) {
      String[] DetailId = detailId[i].split(",");
      String[] number = Number[i].split(",");
      String[] SubbranchId = subbranchId[i].split(",");
      String[] Total_Money = total_Money[i].split(",");
      String orderid = getOrderids();

      for (int j = 0; j < DetailId.length; j++) {
        if (true) {
          UserOrder userorder = new UserOrder();
          userorder.setOrderid(orderid);
          //			Integer uid = userDao.selectByUid(user_id);
          //				userorder.setUserid(uid);
          userorder.setUserid(user_id);
          Orders orders = new Orders();
          orders.setOrderid(orderid);
          orders.setGoodDetailId(Integer.parseInt(DetailId[j]));
          orders.setAddressid(addressid);
          orders.setNum(Integer.parseInt(number[j]));
          orders.setTotalMoney(Total_Money[j]);
          orders.setState(state);
          orders.setData(new Date());
          orders.setSubbranchId(Integer.parseInt(SubbranchId[j]));

          if (this.adduserorder(userorder, orderid)) {
            ordersDao.insert(orders);
            this.changeamount(
                Integer.parseInt(DetailId[j]),
                Integer.parseInt(SubbranchId[j]),
                Integer.parseInt(number[j]));
            baselist.add("OK");
          } else {
            baselist.add("Error");
          }

        } else {
          baselist.add("Error");
        }
      }
    }
    Base base = new Base();
    BaseList listbase = new BaseList();
    listbase.setList(baselist);
    base.setContent(listbase);
    base.setResult("OK");
    return base;
  }