1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| @Api(tags="历史预约记录管理") @Controller @RequestMapping(value = "visitorRecordManager") public class VisitorRecordController { @Autowired private VisitorRecordService smartUserService;
@ApiOperation(value="按照编号删除预约信息",notes="按照编号删除预约信息") @ApiImplicitParam(name="id",value="预约编号",paramType="path",required=true) @ResponseBody @PostMapping("/delVisitorRecord/{id}") public Response<String> delUser(@PathVariable("id")Long id){ smartUserService.deleteUserById(id); return Response.ok("success"); }
@GetMapping("/visitorList") public ModelAndView visitorList(@RequestParam(name = "pageNum",defaultValue = "1") int pageNum, @RequestParam(name = "pageSize", defaultValue = "10") int pageSize, String appointmentTime, ModelAndView modelAndView) { PageInfo<VisitorRecord> data= smartUserService.getAllByPage(pageNum, pageSize,appointmentTime); modelAndView.addObject("page",data); modelAndView.setViewName("visitorRecord/visitor-list"); return modelAndView; }
@GetMapping("/exportExcel") public void exportExcel(HttpServletResponse response) { try{ List<List<String>> rows =new ArrayList<>(); List<String> row1 = CollUtil.newArrayList("访客姓名", "访客手机号", "被访人姓名", "被访人电话", "预约日期", "访问事由"); rows.add(row1); List<VisitorRecord> list=smartUserService.getAll(); for(VisitorRecord vr:list){ rows.add(CollUtil.newArrayList(vr.getVisitorName(), vr.getPhone(),vr.getUserPhone(),vr.getUserName(),vr.getAppointmentTime(),vr.getReasons())); } ExcelWriter writer = ExcelUtil.getWriter(); writer.write(rows); response.setContentType("application/vnd.ms-excel;charset=utf-8"); response.setHeader("Content-Disposition","attachment;filename="+ DateUtils.getTime3()+"visitorRecord.xls"); ServletOutputStream out=response.getOutputStream(); writer.flush(out);
|