123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282 |
- package com.bofeng.wx.controller;
- import com.bofeng.dao.RbMapper;
- import com.bofeng.dao.UptownMapper;
- import com.bofeng.entity.*;
- import com.bofeng.excel.ExcelUtils;
- import com.bofeng.service.HomeService;
- import com.bofeng.service.QzTaskReplyService;
- import com.bofeng.service.QzTaskService;
- import com.bofeng.service.RbService;
- import com.fasterxml.jackson.core.JsonProcessingException;
- import com.google.common.collect.Lists;
- import com.google.common.collect.Maps;
- import com.yvan.Model;
- import com.yvan.ModelOps;
- import com.yvan.PageDb;
- import com.yvan.mvc.Pd;
- import com.yvan.platform.Conv;
- import com.yvan.platform.JsonWapper;
- import com.yvan.platform.YvanUtil;
- import com.yvan.springmvc.HttpParameterParser;
- import io.swagger.annotations.ApiOperation;
- import lombok.SneakyThrows;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.ui.ModelMap;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.RestController;
- import org.springframework.web.servlet.ModelAndView;
- import javax.servlet.http.HttpServletResponse;
- import java.util.List;
- import java.util.Map;
- @RestController
- public class YeWeiHuiController {
- @Autowired
- private QzTaskService qzTaskService;
- @Autowired
- private RbService rbService;
- @Autowired
- private QzTaskReplyService qzTaskReplyService;
- @Autowired
- private HomeService homeService;
- @Autowired
- private UptownMapper uptownMapper;
- @Autowired
- private RbMapper rbMapper;
- @GetMapping("/yeweihui/home.html")
- public ModelAndView yeweihui(ModelMap model,@RequestParam(value = "userId") Long userId, @RequestParam(value = "showQZ", required = false, defaultValue = "-") String showQZ) {
- // List<QzTask> taskList = qzTaskService.selectAll(1225321682867105793L);
- // List<sysUptownUnit> rbList = rbService.selectAll(1225321682867105793L);
- List<QzTask> taskList = qzTaskService.selectAll(userId);
- List<sysUptownUnit> rbList = rbService.selectAll(userId);
- model.put("taskList", YvanUtil.toJsonPretty(taskList));
- model.put("rbList", YvanUtil.toJsonPretty(rbList));
- model.put("user_id", "\""+userId+"\"");
- model.put("showQZ", "\""+showQZ+"\"");
- return new ModelAndView("/yeweihui/home.ftl", model);
- }
- @GetMapping("/yeweihui/qiuzhuDetail.html")
- public ModelAndView qiuzhudetail(@Pd(name = "taskId") Long taskId,@Pd(name = "userId") Long userId, ModelMap model) throws JsonProcessingException {
- QzTask task = qzTaskService.queryByTaskId(taskId);
- // A业委会,B居委会,C物业,D志愿者
- StringBuffer target = new StringBuffer();
- if (task.getTaskTarget().equals("A")) {
- target.append("业委会");
- }
- else if (task.getTaskTarget().equals("B")) {
- if (target.length() > 0) {
- target.append("、居委会");
- }
- else {
- target.append("居委会");
- }
- }
- else if (task.getTaskTarget().equals("C")) {
- if (target.length() > 0) {
- target.append("、物业");
- }
- else {
- target.append("物业");
- }
- }
- else if (task.getTaskTarget().equals("D")) {
- if (target.length() > 0) {
- target.append("、志愿者");
- }
- else {
- target.append("志愿者");
- }
- }
- task.setTaskTarget(target.toString());
- model.put("taskJson", new JsonWapper(task));
- model.put("task", task);
- model.put("userId", "\""+userId+"\"");
- return new ModelAndView("/yeweihui/qiuzhuDetail.ftl", model);
- }
- @PostMapping("/yeweihui/qiuzhu/queryTasksByStatus.json")
- public Model queryTasksByStatus(@Pd(name = "status") Integer status) {
- List<QzTask> taskList = qzTaskService.queryQzTaskByStatus(status);
- return Model.newSuccess(taskList);
- }
- @PostMapping("/yeweihui/qiuzhu/reply/add.json")
- public ModelOps replyQiuzhuInsert(QzTaskReply qzTaskReply) {
- Integer success = qzTaskReplyService.insertQzTaskReply(qzTaskReply);
- if (success > 0) {
- return ModelOps.newSuccess();
- }
- else {
- return ModelOps.newFail("操作失败");
- }
- }
- @PostMapping("/yeweihui/qiuzhu/reply/querybytaskid.json")
- public Model replyQiuzhuQueryByTaskId(@Pd(name = "taskId") Long taskId) {
- List<QzTaskReply> reply = qzTaskReplyService.queryQzTaskReplyByTaskId(taskId);
- return Model.newSuccess(reply);
- }
- @PostMapping("/yeweihui/qiuzhu/list.json")
- public Model queryByHouseNumber(String houseNumber, @Pd(name = "status") Integer status) {
- if (houseNumber.length() <= 0) {
- return Model.newSuccess(qzTaskService.queryQzTaskByStatus(status));
- }
- List<QzTask> list = qzTaskService.queryByHouseNumber(houseNumber, status);
- return Model.newSuccess(list);
- }
- @GetMapping("/yeweihui/ribao.html")
- public ModelAndView yeweihuiRibao(ModelMap model) {
- // List<QzTask> taskList = qzTaskService.selectAll();
- //
- // model.put("taskList", YvanUtil.toJsonPretty(taskList));
- return new ModelAndView("/yeweihui/ribao.ftl", model);
- }
- @GetMapping("/yeweihui/ribaoDy")
- public Model<List<SysUptownHouse>> yeweihuiRibaoDy(Long str) {
- // String[] split = str.split("&");
- List<SysUptownHouse> rbList = rbService.selectXq(str);
- return Model.newSuccess(rbList);
- }
- @GetMapping("/yeweihui/ribaoXq.html")
- public ModelAndView yeweihuiRibaoYcXq(ModelMap model) {
- Map<String, Object> queryParam = Maps.newLinkedHashMap();
- queryParam.put("userId", "12345677");
- queryParam.put("statistics", "M");
- return new ModelAndView("/yeweihui/ribaoXq.ftl", model);
- }
- @GetMapping("/yeweihui/ribaoDyYcXq")
- public Model<List<MsSuspected>> yeweihuiRibaoYcXq(Long houseId) {
- List<MsSuspected> rbList = rbService.selectYcXq(houseId);
- return Model.newSuccess(rbList);
- }
- @GetMapping("/yeweihui/ribaohuiz.html")
- public ModelAndView yeweihuiRibaohuiz(ModelMap model) {
- return new ModelAndView("/yeweihui/ribaohuiz.ftl", model);
- }
- @GetMapping("/epi/yeweihui/ribaohuiz")
- public Model<Map<String, Object>> yeweihuiRibaohuiz(Long userCreate,String reportDate) {
- // Long userCreate = 1225321682867105793L;
- List<Uptown> uptowns = rbMapper.selectUptown(userCreate);
- if (uptowns!=null && uptowns.size()>0) {
- Long upId = uptowns.get(0).getUptownId();
- Map<String, Integer> map1 = rbMapper.selecthuiz(upId,reportDate);
- Map<String, Integer> map2 = rbMapper.selectyicahng(upId,reportDate);
- Map<String, Integer> map3 = rbMapper.selecthuiz1(upId);
- Map<String, Object> reMap = Maps.newHashMap();
- reMap.put("uptownName", uptowns.get(0).getUptownName());
- List<Integer> nums = Lists.newArrayList();
- nums.add(Conv.NI(map3.get("houseCount")));
- nums.add(Conv.NI(map1.get("reportCount")));
- nums.add(Conv.NI(map2.get("yichangCount")));
- nums.add(Conv.NI(map1.get("safetyNum")));
- nums.add(Conv.NI(map1.get("suspectedNum")));
- reMap.put("nums", nums);
- return Model.newSuccess(reMap);
- }
- return Model.newFail("没有数据");
- }
- @ApiOperation("导出正常家庭上报明细")
- @GetMapping("/whepi/epi/yeweihui/exportRiBao")
- @SneakyThrows
- public void exportRiBao(@Pd(name = "uptownId") Long uptownId,
- @Pd(name = "date") String date,
- HttpServletResponse resp) {
- Uptown uptown = uptownMapper.selectById(uptownId);
- if (uptown!=null && uptown.getUptownId()>0) {
- Long upId = uptown.getUptownId();
- String fileName = uptown.getUptownName();
- fileName += "上报信息-";
- fileName += date;
- List<ExcelRiBao> list = rbMapper.selectExcelRiBao(upId,date);
- ExcelUtils.writeSheet(ExcelRiBao.class, list).export(resp, fileName);
- }
- }
- @ApiOperation("导出凌云家庭上报明细")
- @GetMapping("/whepi/epi/lun/exportRiBao")
- @SneakyThrows
- public void lunExportRiBao(@Pd(name = "date") String date,
- HttpServletResponse resp) {
- List<Uptown> uptowns = rbMapper.selectUptownByName("金湖家园");
- if (uptowns!=null && uptowns.size()>0) {
- Long upId = uptowns.get(0).getUptownId();
- String fileName = uptowns.get(0).getUptownName();
- fileName += "上报信息-";
- fileName += date;
- List<ExcelRiBaoLY> list = rbMapper.selectExcelRiBaoLY(upId,date);
- ExcelUtils.writeSheet(ExcelRiBaoLY.class, list).export(resp, fileName);
- }
- }
- @ApiOperation("导出小区家庭上报明细")
- @GetMapping("/whepi/epi/yeweihui/EXR")
- @SneakyThrows
- public void exportRiBaoByXiaoQu(@Pd(name = "uptownId") Long uptownId,
- @Pd(name = "date") String date,
- HttpServletResponse resp) {
- Uptown uptown = uptownMapper.selectById(uptownId);
- if (uptown!=null && uptown.getUptownId()>0) {
- Long upId = uptown.getUptownId();
- String fileName = uptown.getUptownName();
- fileName += "上报信息-";
- fileName += date;
- List<ExcelRiBaoPrivate> list = rbMapper.selectExcelRiBaoPrivate(upId,date);
- ExcelUtils.writeSheet(ExcelRiBaoPrivate.class, list).export(resp, fileName);
- }
- }
- @GetMapping("/yeweihui/tgPublish.html")
- public ModelAndView tuangouPublish(@Pd(name = "userId") Long userId, ModelMap model) throws JsonProcessingException {
- model.put("userId", "\""+userId+"\"");
- return new ModelAndView("/yeweihui/tgPublish.ftl", model);
- }
- @PostMapping("/whepi/getAllUptown")
- public Model<List<Uptown>> getAllUptown(HttpParameterParser parser, PageDb pageDb) {
- return Model.newSuccess(pageDb, uptownMapper.getUptowns(pageDb, parser.getMap()));
- }
- }
|