MsReportController.java 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. package com.bofeng.wx.controller;
  2. import com.bofeng.entity.*;
  3. import com.bofeng.service.HomeService;
  4. import com.bofeng.service.MsReportService;
  5. import com.bofeng.service.MsSuspectedService;
  6. import com.yvan.Model;
  7. import com.yvan.mvc.Pd;
  8. import org.springframework.beans.factory.annotation.Autowired;
  9. import org.springframework.web.bind.annotation.GetMapping;
  10. import org.springframework.web.bind.annotation.PostMapping;
  11. import org.springframework.web.bind.annotation.RestController;
  12. import org.springframework.web.servlet.ModelAndView;
  13. import javax.servlet.http.HttpServletRequest;
  14. import java.util.List;
  15. /**
  16. * @Author: xielianghe
  17. * @Date: 2020/2/4 15:38
  18. */
  19. @RestController
  20. public class MsReportController {
  21. @Autowired
  22. private HomeService homeService;
  23. @Autowired
  24. private MsSuspectedService msSuspectedService;
  25. @Autowired
  26. private MsReportService msReportService;
  27. //添加家人
  28. @PostMapping("/home/addRibao.json")
  29. public ModelAndView saveUser(HttpServletRequest request) {
  30. //UserOpen userOpen = homeService.getUserOpen();
  31. long userId = 1224706869998772226L;
  32. String userName = request.getParameter("userName");
  33. String conditionStatus = request.getParameter("conditionStatus");
  34. Integer medical = Integer.parseInt(request.getParameter("medical"));
  35. String remarks = request.getParameter("remarks");
  36. msSuspectedService.addSuspected(userName, conditionStatus, medical, remarks, userId);
  37. return new ModelAndView("/home/home.ftl");
  38. }
  39. //删除家人
  40. @PostMapping("/home/deleteSuspected.json")
  41. public ModelAndView deleteSuspected(HttpServletRequest request) {
  42. Long suspectedId = Long.parseLong(request.getParameter("suspectedId"));
  43. msSuspectedService.deleteSuspected(suspectedId);
  44. return new ModelAndView("/home/home.ftl");
  45. }
  46. //获取家人
  47. @GetMapping("/home/home/queryRibao")
  48. public Model<List<MsSuspected>> queryRibao(@Pd(name = "reportId") Long reportId) {
  49. return Model.newSuccess(msReportService.getByReportId(reportId));
  50. }
  51. //全家报平安
  52. @PostMapping("/home/addReport.json")
  53. public ModelAndView addReport(HttpServletRequest request) {
  54. //UserOpen userOpen = homeService.getUserOpen();
  55. long userId = 1224706869998772226L;
  56. String safetyNum = request.getParameter("safetyNum");
  57. msReportService.addReport(safetyNum, userId);
  58. return new ModelAndView("/home/home.ftl");
  59. }
  60. //获取家人
  61. @GetMapping("/home/home/queryRibaoReportDate")
  62. public Model<List<MsSuspected>> queryRibaoReportDate(@Pd(name = "reportDate") String reportDate) {
  63. //UserOpen userOpen = homeService.getUserOpen();
  64. long userId = 1224706869998772226L;
  65. return Model.newSuccess(msReportService.getByReportReportDate(reportDate, userId));
  66. }
  67. }