mashangjiandu/src/main/java/cn/com/tenlion/superviseqrcode/controller/QRScanController.java

166 lines
6.3 KiB
Java
Raw Normal View History

2022-12-29 17:08:44 +08:00
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<String, Object> 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<ProblemMngDTO> listProblem(){
Map<String, Object> params = requestParams();
List<ProblemMngDTO> list = problemMngService.list(params);
return list;
}
@GetMapping("list-case")
@ResponseBody
public List<CaseMngDTO> listCase(){
Map<String, Object> params = requestParams();
List<CaseMngDTO> list = caseMngService.list(params);
return list;
}
@GetMapping("list-window-by-case")
@ResponseBody
public List<HallWindowDTO> listWindowByCase(){
Map<String, Object> params = requestParams();
params.put("id", params.get("caseId").toString());
List<HallWindowDTO> list = hallWindowService.listWindowByCase(params);
return list;
}
@PostMapping("save-web-site")
@ResponseBody
public SuccessResult saveWebSite(@RequestBody Map<String, Object> params){
return webSiteReplyService.saveFromQRCode(params);
}
@PostMapping("save-hall")
@ResponseBody
public SuccessResult saveHall(@RequestBody Map<String, Object> params){
params.put("reportSource","大厅");
return reportCaseService.saveFromQRCode(params);
}
@PostMapping("save-hall-window")
@ResponseBody
public SuccessResult saveHallWindow(@RequestBody Map<String, Object> params){
params.put("reportSource","窗口");
return reportCaseService.saveFromQRCode(params);
}
@GetMapping("get-supervise-tips")
@ResponseBody
public Map<String, Object> getSuperviseTips(){
Map<String, Object> params = requestParams();
params.put("tipsId", params.get("tipsId").toString());
List<Map<String, Object>> list = superviseService.getSuperviseTips(params);
if(list != null && list.size() > 0){
return list.get(0);
}
return new HashMap<>(2);
}
}