package com.bofeng.wx.controller; import com.bofeng.entity.*; import com.bofeng.service.HomeService; import com.bofeng.service.MsReportService; import com.bofeng.service.MsSuspectedService; import com.yvan.Model; import com.yvan.mvc.Pd; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import java.util.List; /** * @Author: xielianghe * @Date: 2020/2/4 15:38 */ @RestController public class MsReportController { @Autowired private HomeService homeService; @Autowired private MsSuspectedService msSuspectedService; @Autowired private MsReportService msReportService; //添加家人 @PostMapping("/home/addRibao.json") public ModelAndView saveUser(HttpServletRequest request) { //UserOpen userOpen = homeService.getUserOpen(); long userId = 1224706869998772226L; String userName = request.getParameter("userName"); String conditionStatus = request.getParameter("conditionStatus"); Integer medical = Integer.parseInt(request.getParameter("medical")); String remarks = request.getParameter("remarks"); msSuspectedService.addSuspected(userName, conditionStatus, medical, remarks, userId); return new ModelAndView("/home/home.ftl"); } //删除家人 @PostMapping("/home/deleteSuspected.json") public ModelAndView deleteSuspected(HttpServletRequest request) { Long suspectedId = Long.parseLong(request.getParameter("suspectedId")); msSuspectedService.deleteSuspected(suspectedId); return new ModelAndView("/home/home.ftl"); } //获取家人 @GetMapping("/home/home/queryRibao") public Model> queryRibao(@Pd(name = "reportId") Long reportId) { return Model.newSuccess(msReportService.getByReportId(reportId)); } //全家报平安 @PostMapping("/home/addReport.json") public ModelAndView addReport(HttpServletRequest request) { //UserOpen userOpen = homeService.getUserOpen(); long userId = 1224706869998772226L; String safetyNum = request.getParameter("safetyNum"); msReportService.addReport(safetyNum, userId); return new ModelAndView("/home/home.ftl"); } //获取家人 @GetMapping("/home/home/queryRibaoReportDate") public Model> queryRibaoReportDate(@Pd(name = "reportDate") String reportDate) { //UserOpen userOpen = homeService.getUserOpen(); long userId = 1224706869998772226L; return Model.newSuccess(msReportService.getByReportReportDate(reportDate, userId)); } }