@Override
  public String orderPayment(String orderId, int orderType) {

    try {
      boolean bool = false;
      if (orderType == 1) {
        bool =
            commonDao.executeBySql(
                "UPDATE tb_order_list SET STATUS = '03' WHERE orderId ='"
                    + orderId
                    + "' and STATUS ='01' and validflag=1",
                null);
      } else {
        /* 如果开放立刻开团模式,状态需要改为05 */
        bool =
            commonDao.executeBySql(
                "UPDATE tb_order_list SET STATUS = '04' WHERE orderId ='"
                    + orderId
                    + "' and STATUS ='01' and validflag=1",
                null);
      }
      if (bool) {
        return "success";
      }
      return "failed";
    } catch (Exception e) {
      e.printStackTrace();
      return e.getMessage();
    }
  }
  /** 撤销需要还原库存 团购撤销需要未开团状态, */
  @Override
  public String cancelOrder(String orderId) {

    Order_list orderList =
        (Order_list)
            commonDao
                .findByHql("from Order_list where orderId=? and validflag = 1", orderId)
                .get(0);
    List<Order_detail> detailsList = detailService.getOrderdetailByMethod(2, null, orderId);
    Integer count = 0;
    for (Order_detail order_detail : detailsList) {
      count = (int) order_detail.getQuantity();
      if (orderList.getOrderType() == 1) {
        productService.updateStockNumber(order_detail.getProductId(), count);
      } else if (orderList.getOrderType() == 2) {
        groupBuyService.updateStockNumber(order_detail.getProductId(), count);
      }
    }
    try {
      boolean bool =
          commonDao.executeBySql(
              "UPDATE tb_order_list SET STATUS = '02' WHERE orderId IN ('"
                  + orderId
                  + "') and STATUS ='01' and validflag=1",
              null);
      if (bool) {
        return "success";
      }
      return "failed";
    } catch (Exception e) {
      e.printStackTrace();
      return e.getMessage();
    }
  }
Пример #3
0
  @Override
  public boolean deleteState(String stateId) {

    boolean bool = false;
    String sql = "update tb_state set validflag=0 where stateId in (" + stateId + ")";
    bool = commonDao.executeBySql(sql);
    return bool;
  }
  @Override
  public boolean deleteOrderList(String orderId, HttpServletRequest request) {

    boolean bool = false;
    try {
      String sql =
          "update tb_order_list set validflag=0,lastUpdateTime=?,operid=? where orderId in ("
              + orderId
              + ")";
      detailService.deleteOrderDetail(orderId);
      bool = detailDao.executeBySql(sql, new Date(), PublicUtil.getOper(request).getOperId());
    } catch (Exception e) {
      e.printStackTrace();
    }
    return bool;
  }
 @Override
 public String applyRefund(String orderId) {
   try {
     boolean bool =
         commonDao.executeBySql(
             "UPDATE tb_order_list SET STATUS = '09' WHERE orderId IN ('"
                 + orderId
                 + "') and STATUS ='08' and validflag=1",
             null);
     if (bool) {
       return "success";
     }
     return "failed";
   } catch (Exception e) {
     e.printStackTrace();
     return e.getMessage();
   }
 }