@RequestMapping(value = {"/whm/report/material/export.html"})
 public ModelAndView list(
     ExportMaterialReportBean bean, HttpServletRequest request, HttpServletResponse response) {
   ModelAndView mav = new ModelAndView("/whm/report/material/export");
   if (bean.getToDate() != null) {
     bean.setToDate(DateUtils.move2TheEndOfDay(new Timestamp(bean.getToDate().getTime())));
   }
   String crudaction = bean.getCrudaction();
   if (crudaction != null && StringUtils.isNotBlank(crudaction)) {
     try {
       ExportMaterialReportDTO exportMaterialReport =
           this.exportmaterialbillService.reportExportMaterial(bean);
       if (crudaction.equalsIgnoreCase("report")) {
         mav.addObject("exportMaterialReport", exportMaterialReport);
       }
       if (crudaction.equalsIgnoreCase("export")) {
         mav.addObject("exportMaterialReport", exportMaterialReport);
         exportReport2Excel(bean, exportMaterialReport, request, response);
       }
     } catch (Exception e) {
       log.error(e.getMessage(), e);
     }
   }
   addData2ModelMaterial(mav, bean);
   mav.addObject(Constants.LIST_MODEL_KEY, bean);
   return mav;
 }
  @RequestMapping(value = {"/whm/report/used/material.html"})
  public ModelAndView list(
      SearchUsedMaterialBean bean, HttpServletRequest request, HttpServletResponse response) {
    ModelAndView mav = new ModelAndView("/whm/used/material");
    bean.setLoginWarehouseID(SecurityUtils.getPrincipal().getWarehouseID());
    if (bean.getToExportedDate() != null) {
      bean.setToExportedDate(
          DateUtils.move2TheEndOfDay(new Timestamp(bean.getToExportedDate().getTime())));
    }
    String crudaction = bean.getCrudaction();
    if (crudaction != null && StringUtils.isNotBlank(crudaction)) {
      try {
        if (bean.getCrudaction() != null && "report".equals(bean.getCrudaction())) {
          SummaryUsedMaterialDTO result = this.exportmaterialService.reportUsedMaterial(bean);
          mav.addObject("result", result);
        }

        if (bean.getCrudaction() != null && "export".equals(bean.getCrudaction())) {
          SummaryUsedMaterialDTO result = this.exportmaterialService.reportUsedMaterial(bean);
          mav.addObject("result", result);
          exportUsedMaterial2Excel(bean, result, request, response);
        }
      } catch (Exception e) {
        log.error(e.getMessage(), e);
      }
    }
    addData2ModelMaterial(mav);
    mav.addObject(Constants.LIST_MODEL_KEY, bean);
    return mav;
  }