예제 #1
0
  /**
   * 获取报销记录
   *
   * @return
   */
  @RequestMapping(
      value = "getExpenseRecord",
      method = {RequestMethod.GET, RequestMethod.POST})
  public @ResponseBody Object getExpenseRecord(HttpServletRequest request) {

    ResponseResult responseResult = new ResponseResult();
    try {
      // 获取请假申请信息
      String operationType = HttpRequestUtil.getInst().getString("operationType");
      if (StringUtils.isEmpty(operationType)) {
        responseResult.setStatus(-1);
        responseResult.setErrorMsg("参数operationType不能为空!");
        throw new VyiyunException("无效的operationType值!");
      }
      int pageIndex = -1;
      int pageSize = -1;
      String sPageIndex = HttpRequestUtil.getInst().getString("pageIndex");
      String sPageSize = HttpRequestUtil.getInst().getString("pageSize");
      if (StringUtils.isNotEmpty(sPageIndex) && sPageIndex.matches("\\d+")) {
        pageIndex = Integer.parseInt(sPageIndex);
      }
      if (StringUtils.isNotEmpty(sPageSize) && sPageSize.matches("\\d+")) {
        pageSize = Integer.parseInt(sPageSize);
      }
      Expense expense = new Expense();
      expense.setUserId(HttpRequestUtil.getInst().getCurrentWeixinUser().getUserid());
      Map<String, Object> params = new HashMap<String, Object>();
      params.put("orderBy", "CreateTime desc");
      params.put("operationType", operationType);
      responseResult.setValue(
          expenseService.queryExpenseRecord(expense, params, pageIndex, pageSize).getData());
    } catch (Exception e) {
      LOGGER.debug("获取数据失败", e);
      responseResult.setStatus(-1);
      if (e instanceof VyiyunException) {
        responseResult.setErrorMsg(e.getMessage());
      } else {
        responseResult.setErrorMsg("获取数据记录失败,请联系统管理员!");
      }
    }
    return responseResult;
  }
예제 #2
0
  /**
   * 获取报销记录
   *
   * @return
   */
  @RequestMapping(
      value = "getAuditRecord",
      method = {RequestMethod.GET, RequestMethod.POST})
  public @ResponseBody Object getAuditRecord(HttpServletRequest request) {
    ResponseResult responseResult = new ResponseResult();
    try {
      // 获取请假申请信息
      String operationType = HttpRequestUtil.getInst().getString("operationType");
      if (StringUtils.isEmpty(operationType)) {
        responseResult.setStatus(-1);
        responseResult.setErrorMsg("参数operationType不能为空!");
        throw new VyiyunException("无效的operationType值!");
      }

      int pageIndex = -1;
      int pageSize = -1;
      String sPageIndex = HttpRequestUtil.getInst().getString("pageIndex");
      String sPageSize = HttpRequestUtil.getInst().getString("pageSize");
      if (StringUtils.isNotEmpty(sPageIndex) && sPageIndex.matches("\\d+")) {
        pageIndex = Integer.parseInt(sPageIndex);
      }
      if (StringUtils.isNotEmpty(sPageSize) && sPageSize.matches("\\d+")) {
        pageSize = Integer.parseInt(sPageSize);
      }
      WeixinUser weixinUser = HttpRequestUtil.getInst().getCurrentWeixinUser();
      Expense expense = new Expense();
      expense.setUserId(weixinUser.getUserid());
      Map<String, Object> params = new HashMap<String, Object>();
      params.put("orderBy", "CreateTime desc");

      String userName = HttpRequestUtil.getInst().getString("userName");
      String startDate = HttpRequestUtil.getInst().getString("startDate");
      String endDate = HttpRequestUtil.getInst().getString("endDate");
      String expenseNum = HttpRequestUtil.getInst().getString("expenseNum");

      String personType = HttpRequestUtil.getInst().getString("personType");

      if (StringUtils.isNotEmpty(userName)) {
        params.put("uNameLike", userName);
      }
      if (StringUtils.isNotEmpty(expenseNum)) {
        params.put("expenseNumLIke", expenseNum);
      }
      if (StringUtils.isNotEmpty(startDate)) {
        params.put("startDate", DateUtil.stringToDate(startDate, "yyyy-MM-dd"));
      }
      if (StringUtils.isNotEmpty(endDate)) {
        params.put("endDate", DateUtil.stringToDate(endDate, "yyyy-MM-dd"));
      }
      if (StringUtils.isNotEmpty(endDate)) {
        params.put("endDate", DateUtil.stringToDate(endDate, "yyyy-MM-dd"));
      }

      if ("0".equals(personType)) {
        if ("1".equals(operationType)) {
          params.put("operationType", "1");
          responseResult.setValue(
              expenseService.queryAuditRecord(expense, params, pageIndex, pageSize).getData());
        } else if ("2".equals(operationType)) {
          params.put("personType", "0");
          params.put("userId", weixinUser.getUserid());
          responseResult.setValue(
              entityAccountService
                  .queryEntityAccountExpense(params, pageIndex, pageSize)
                  .getData());
        }
      } else if ("2".equals(personType)) {
        if ("1".equals(operationType)) {
          params.put("operationType", "3");
          responseResult.setValue(
              expenseService.queryAuditRecord(expense, params, pageIndex, pageSize).getData());
        } else if ("2".equals(operationType)) {
          params.put("personType", "2");
          params.put("userId", weixinUser.getUserid());
          responseResult.setValue(
              entityAccountService
                  .queryEntityAccountExpense(params, pageIndex, pageSize)
                  .getData());
        }
      }

    } catch (Exception e) {
      LOGGER.debug("获取数据失败", e);
      responseResult.setStatus(-1);
      if (e instanceof VyiyunException) {
        responseResult.setErrorMsg(e.getMessage());
      } else {
        responseResult.setErrorMsg("获取数据记录失败,请联系统管理员!");
      }
    }
    return responseResult;
  }