コード例 #1
0
 @RequestMapping(value = "/exportExcel", produces = "text/plain;charset=utf-8")
 public ModelAndView exportExcel(
     Page page,
     HxServiceTicketVO serviceTicketVO,
     HttpServletRequest request,
     String tableField,
     String tableHeader,
     HttpServletResponse response,
     @DateTimeFormat(pattern = "yyyy-MM-dd") Date mod_installDate_st,
     @DateTimeFormat(pattern = "yyyy-MM-dd") Date mod_installDate_end,
     @DateTimeFormat(pattern = "yyyy-MM-dd") Date mod_saleDate_st,
     @DateTimeFormat(pattern = "yyyy-MM-dd") Date mod_saleDate_end,
     @DateTimeFormat(pattern = "yyyy-MM-dd") Date mod_serviceDate_st,
     @DateTimeFormat(pattern = "yyyy-MM-dd") Date mod_serviceDate_end,
     @DateTimeFormat(pattern = "yyyy-MM-dd") Date mod_checkDate_st,
     @DateTimeFormat(pattern = "yyyy-MM-dd") Date mod_checkDate_end,
     @DateTimeFormat(pattern = "yyyy-MM-dd") Date mod_createDate_st,
     @DateTimeFormat(pattern = "yyyy-MM-dd") Date mod_createDate_end)
     throws Exception {
   SysUser sysUser = (SysUser) request.getSession().getAttribute(Constrants.USER_INFO);
   Map<String, Object> map = BeanMapUtils.convertBean(serviceTicketVO);
   map.put("mod_installDate_st", mod_installDate_st);
   map.put("mod_installDate_end", mod_installDate_end);
   map.put("mod_saleDate_st", mod_saleDate_st);
   map.put("mod_saleDate_end", mod_saleDate_end);
   map.put("mod_serviceDate_st", mod_serviceDate_st);
   map.put("mod_serviceDate_end", mod_serviceDate_end);
   map.put("mod_checkDate_st", mod_checkDate_st);
   map.put("mod_checkDate_end", mod_checkDate_end);
   map.put("mod_createDate_st", mod_createDate_st);
   map.put("mod_createDate_end", mod_createDate_end);
   // 普通用户
   map.put("customerType", "01");
   map.put("createOrganization", hxOrganizationService.getChild(sysUser.getCompanyId()));
   page.setParam(map);
   List<Map<String, Object>> list = serviceTicketCreateService.getServiceTicketPageList(page);
   new DecoderUtil<HxServiceTicketVO>().decodeURI(serviceTicketVO);
   String header = URLDecoder.decode(tableHeader, "UTF-8");
   header = header.replaceAll("<br/>", "");
   ViewExcel viewExcel =
       new ViewExcel(
           "服务单导出" + DateUtils.formatDateTime(new Date(), DateUtils.FORMAT_THREE),
           tableField,
           header,
           list);
   return new ModelAndView(viewExcel);
 }
コード例 #2
0
 @RequestMapping(value = "/getServiceTicketPageList", produces = "text/plain;charset=utf-8")
 @ResponseBody
 public String getServiceTicketPageList(
     Page page,
     HxServiceTicketVO serviceTicketVO,
     HttpServletRequest request,
     @DateTimeFormat(pattern = "yyyy-MM-dd") Date mod_installDate_st,
     @DateTimeFormat(pattern = "yyyy-MM-dd") Date mod_installDate_end,
     @DateTimeFormat(pattern = "yyyy-MM-dd") Date mod_saleDate_st,
     @DateTimeFormat(pattern = "yyyy-MM-dd") Date mod_saleDate_end,
     @DateTimeFormat(pattern = "yyyy-MM-dd") Date mod_serviceDate_st,
     @DateTimeFormat(pattern = "yyyy-MM-dd") Date mod_serviceDate_end,
     @DateTimeFormat(pattern = "yyyy-MM-dd") Date mod_checkDate_st,
     @DateTimeFormat(pattern = "yyyy-MM-dd") Date mod_checkDate_end,
     @DateTimeFormat(pattern = "yyyy-MM-dd") Date mod_createDate_st,
     @DateTimeFormat(pattern = "yyyy-MM-dd") Date mod_createDate_end)
     throws Exception {
   Calendar calendar = Calendar.getInstance();
   SysUser sysUser = (SysUser) request.getSession().getAttribute(Constrants.USER_INFO);
   Map<String, Object> map = BeanMapUtils.convertBean(serviceTicketVO);
   map.put("mod_installDate_st", mod_installDate_st);
   if (mod_installDate_end != null) {
     calendar.setTime(mod_installDate_end);
     calendar.set(
         calendar.get(Calendar.YEAR),
         calendar.get(Calendar.MONTH),
         calendar.get(Calendar.DAY_OF_MONTH),
         23,
         59,
         59);
     map.put("mod_installDate_end", calendar.getTime());
   }
   map.put("mod_saleDate_st", mod_saleDate_st);
   if (mod_saleDate_end != null) {
     calendar.setTime(mod_saleDate_end);
     calendar.set(
         calendar.get(Calendar.YEAR),
         calendar.get(Calendar.MONTH),
         calendar.get(Calendar.DAY_OF_MONTH),
         23,
         59,
         59);
     map.put("mod_saleDate_end", calendar.getTime());
   }
   map.put("mod_serviceDate_st", mod_serviceDate_st);
   if (mod_serviceDate_end != null) {
     calendar.setTime(mod_serviceDate_end);
     calendar.set(
         calendar.get(Calendar.YEAR),
         calendar.get(Calendar.MONTH),
         calendar.get(Calendar.DAY_OF_MONTH),
         23,
         59,
         59);
     map.put("mod_serviceDate_end", calendar.getTime());
   }
   map.put("mod_checkDate_st", mod_checkDate_st);
   if (mod_checkDate_end != null) {
     calendar.setTime(mod_checkDate_end);
     calendar.set(
         calendar.get(Calendar.YEAR),
         calendar.get(Calendar.MONTH),
         calendar.get(Calendar.DAY_OF_MONTH),
         23,
         59,
         59);
     map.put("mod_checkDate_end", calendar.getTime());
   }
   map.put("mod_createDate_st", mod_createDate_st);
   if (mod_createDate_end != null) {
     calendar.setTime(mod_createDate_end);
     calendar.set(
         calendar.get(Calendar.YEAR),
         calendar.get(Calendar.MONTH),
         calendar.get(Calendar.DAY_OF_MONTH),
         23,
         59,
         59);
     map.put("mod_createDate_end", calendar.getTime());
   }
   map.put("createMan", sysUser.getUserAccount());
   // 普通用户
   // map.put("customerType", "01");
   map.put("createOrganization", hxOrganizationService.getChild(sysUser.getCompanyId()));
   page.setParam(map);
   List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
   if (!"GMZB".equals(sysUser.getCompanyId())) {
     list = serviceTicketCreateService.getServiceTicketPageList(page);
   } else {
     list = serviceTicketCreateService.getGMZBPageList(page);
   }
   return JsonUtil.writeListToDataGrid(page.getTotalResult(), list);
 }