Exemplo n.º 1
0
 @ClearInterceptor
 public void islogin() {
   JSONObject result = new JSONObject();
   // 验证是否登陆
   if (StringUtil.isBlank(getUserIds())) {
     result.put("isLogin", false);
     result.put("error", "请先登录");
     renderJson(result.toString());
     return;
   }
   result.put("isLogin", true);
   renderJson(result.toString());
 }
Exemplo n.º 2
0
  public void card_add() {
    Store store = getSessionAttr("store");

    Integer pageNum = getParaToInt("pageNum");
    Integer pageSize = getParaToInt("pageSize");

    if (pageNum == null || pageNum.intValue() < 1) {
      pageNum = 1; // 默认第一页
    }
    if (pageSize == null || pageSize.intValue() < 0) {
      pageSize = 30; // 默认每页显示10条
    } else if (pageSize.intValue() > 100) {
      pageSize = 30; // 最大100条
    }

    Map<String, Object> params = new HashMap<String, Object>();
    params.put("storeId", store.getStr("id"));

    // 定义查询参数
    String date = getPara("date");
    String beginTime = getPara("beginTime");
    String endTime = getPara("endTime");

    if (StringUtil.isBlank(date)) {
      date = "0";
    }

    Date now = new Date();

    switch (date) {
      case "1":
        Calendar date_temp = Calendar.getInstance();
        date_temp.setTime(now);
        date_temp.set(Calendar.DATE, date_temp.get(Calendar.DATE) - 1);

        Date yesterday = date_temp.getTime();
        beginTime = DateUtil.format(yesterday, DateUtil.pattern_y_m_d);
        endTime = DateUtil.format(yesterday, DateUtil.pattern_y_m_d);
        break;
      case "2":
        if (StringUtil.isBlank(beginTime)) {
          beginTime = DateUtil.format(now, DateUtil.pattern_y_m_d);
        }

        if (StringUtil.isBlank(endTime)) {
          endTime = DateUtil.format(now, DateUtil.pattern_y_m_d);
        }
        break;
      default:
        beginTime = DateUtil.format(now, DateUtil.pattern_y_m_d);
        endTime = DateUtil.format(now, DateUtil.pattern_y_m_d);
        break;
    }

    params.put("date", date);
    params.put("beginTime", beginTime);
    params.put("endTime", endTime);
    params.put("operator", getPara("employee"));

    // 1.加载员工列表
    List<EmployeeYun> employeeYunList = EmployeeYun.dao.findListByStore(store.getStr("id"));
    setAttr("employeeYunList", employeeYunList);

    Page<CardYun> page = CardYun.dao.findPageByDate(pageNum, pageSize, params);
    setAttr("page", page);
    setAttr("params", params);
    setAttr("page_params", paramsToStr(params));
    render("/store/admin/yun/report/card/card_add_report.html");
  }