package cn.com.tenlion.superviseqrcode.controller; import cn.com.tenlion.superviseqrcode.pojo.dtos.casemng.CaseMngDTO; import cn.com.tenlion.superviseqrcode.pojo.dtos.hallmng.HallMngDTO; import cn.com.tenlion.superviseqrcode.pojo.dtos.hallwindow.HallWindowDTO; import cn.com.tenlion.superviseqrcode.pojo.dtos.problemng.ProblemMngDTO; import cn.com.tenlion.superviseqrcode.pojo.dtos.qrcodemng.QRCodeMngDTO; import cn.com.tenlion.superviseqrcode.pojo.dtos.reortcase.ReportCaseDTO; import cn.com.tenlion.superviseqrcode.pojo.dtos.website.WebSiteMngDTO; import cn.com.tenlion.superviseqrcode.service.casemng.ICaseMngService; import cn.com.tenlion.superviseqrcode.service.hallmng.IHallMngService; import cn.com.tenlion.superviseqrcode.service.hallwindow.IHallWindowService; import cn.com.tenlion.superviseqrcode.service.problemmng.IProblemMngService; import cn.com.tenlion.superviseqrcode.service.qrcodemng.IQRCodeMngService; import cn.com.tenlion.superviseqrcode.service.reportcase.IReportCaseService; import cn.com.tenlion.superviseqrcode.service.supervise.ISuperviseService; import cn.com.tenlion.superviseqrcode.service.website.IWebSiteMngService; import cn.com.tenlion.superviseqrcode.service.website.IWebSiteReplyService; import ink.wgink.common.base.DefaultBaseController; import ink.wgink.pojo.result.SuccessResult; import ink.wgink.util.date.DateUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @author xwangs * @create 2022-05-09 4:06 * @description */ @Controller @RequestMapping("qrscan") public class QRScanController extends DefaultBaseController { @Autowired private IQRCodeMngService qrCodeMngService; @Autowired private IWebSiteMngService webSiteMngService; @Autowired private IWebSiteReplyService webSiteReplyService; @Autowired private IProblemMngService problemMngService; @Autowired private IHallMngService hallMngService; @Autowired private IHallWindowService hallWindowService; @Autowired private ICaseMngService caseMngService; @Autowired private IReportCaseService reportCaseService; @Autowired private ISuperviseService superviseService; /** * 扫描二维码 * @return */ @RequestMapping("scan") public ModelAndView scan(){ ModelAndView mv = new ModelAndView(); Map params = requestParams(); String id = params.get("id").toString(); params.put("id", id); QRCodeMngDTO qrCodeMngDTO = qrCodeMngService.get(params); String qrCodeType = qrCodeMngDTO.getQrCodeType(); switch (qrCodeType){ // 平台 case "a1f3b7d7-7dea-4ff1-a1f0-a8d9d541d43a" : params.clear(); params.put("id", qrCodeMngDTO.getWebSiteId()); WebSiteMngDTO webSiteMngDTO = webSiteMngService.get(params); mv.addObject("id", webSiteMngDTO.getId()); mv.addObject("webSiteName", webSiteMngDTO.getWebSiteName()); mv.setViewName("web-site"); break; // 大厅 case "239ffa31-3c86-418f-a6ac-0fd8d14f9b53" : params.clear(); params.put("id", qrCodeMngDTO.getHallId()); HallMngDTO hallMngDTO = hallMngService.get(params); mv.addObject("hallId", hallMngDTO.getId()); mv.addObject("hallName", hallMngDTO.getHallName()); mv.setViewName("hall"); break; // 窗口 case "af02c8ca-d122-4345-a271-e0dcb61c54c4" : params.clear(); params.put("id", qrCodeMngDTO.getHallWindowId()); HallWindowDTO hallWindow = hallWindowService.get(params); mv.addObject("hallWindowId", hallWindow.getId()); mv.addObject("hallWindowName", hallWindow.getWindowName() + hallWindow.getWindowNum()); params.clear(); params.put("id", hallWindow.getBelongHallId()); HallMngDTO hall = hallMngService.get(params); mv.addObject("hallId", hall.getId()); mv.addObject("hallName", hall.getHallName()); mv.setViewName("hall-window"); break; default: break; } return mv; } @GetMapping("list-problem") @ResponseBody public List listProblem(){ Map params = requestParams(); List list = problemMngService.list(params); return list; } @GetMapping("list-case") @ResponseBody public List listCase(){ Map params = requestParams(); List list = caseMngService.list(params); return list; } @GetMapping("list-window-by-case") @ResponseBody public List listWindowByCase(){ Map params = requestParams(); params.put("id", params.get("caseId").toString()); List list = hallWindowService.listWindowByCase(params); return list; } @PostMapping("save-web-site") @ResponseBody public SuccessResult saveWebSite(@RequestBody Map params){ return webSiteReplyService.saveFromQRCode(params); } @PostMapping("save-hall") @ResponseBody public SuccessResult saveHall(@RequestBody Map params){ params.put("reportSource","大厅"); return reportCaseService.saveFromQRCode(params); } @PostMapping("save-hall-window") @ResponseBody public SuccessResult saveHallWindow(@RequestBody Map params){ params.put("reportSource","窗口"); return reportCaseService.saveFromQRCode(params); } @GetMapping("get-supervise-tips") @ResponseBody public Map getSuperviseTips(){ Map params = requestParams(); params.put("tipsId", params.get("tipsId").toString()); List> list = superviseService.getSuperviseTips(params); if(list != null && list.size() > 0){ return list.get(0); } return new HashMap<>(2); } }