123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337 |
- 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.*;
- 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 RiBaoYwhController {
- @Autowired
- private QzTaskService qzTaskService;
- @Autowired
- private RbService rbService;
- @Autowired
- private QzTaskReplyService qzTaskReplyService;
- @Autowired
- private HomeService homeService;
- @Autowired
- private JmTuangouService jmTuangouService;
- @Autowired
- private UptownMapper uptownMapper;
- @Autowired
- private RbMapper rbMapper;
- @Autowired
- private RiBaoService riBaoService;
- // 查询业委会日报首页小区及统计数据
- @GetMapping("/ywh/getRibaoYwh")
- public Model<UptownUnit> getRibaoYwh(@Pd(name = "userId") Long userId) {
- return Model.newSuccess(riBaoService.getRibaoYwh(userId));
- }
- // 查询业委会日报首页小区对应栋列表
- @GetMapping("/ywh/queryRibaoYwhDongList")
- public Model<List<UptownUnit>> queryRibaoYwhDongList(@Pd(name = "uptownId") Long uptownId) {
- List<UptownUnit> listSuspected = riBaoService.queryRibaoYwhDongList(uptownId);
- return Model.newSuccess(listSuspected);
- }
- // 查询业委会日报某一栋小区单元数据 根据queryRibaoYwhDongList获取栋数据作为参数传递给此接口
- @GetMapping("/ywh/queryDanYuanList")
- public Model<List<UptownUnit>> queryDanYuanList(@Pd(name = "uptownId") Long uptownId, @Pd(name = "ridgepole") Long ridgepole) {
- List<UptownUnit> listSuspected = riBaoService.queryDanYuanList(uptownId, ridgepole);
- return Model.newSuccess(listSuspected);
- }
- // 查询业委会日报某一栋门牌数据 根据queryDanYuanList获取单元数据作为参数传递给此接口
- // uptownId:小区id; ridgepole:栋;unitId:单元id
- @GetMapping("/ywh/queryMenPaiList")
- public Model<List<UptownUnit>> queryMenPaiList(@Pd(name = "uptownId") Long uptownId, @Pd(name = "ridgepole") Long ridgepole, @Pd(name = "unitId") Long unitId) {
- List<UptownUnit> listSuspected = riBaoService.queryMenPaiList(uptownId, ridgepole, unitId);
- return Model.newSuccess(listSuspected);
- }
- @GetMapping("/ywh/home.html")
- public ModelAndView yeweihui(ModelMap model, @RequestParam(value = "userId") Long userId, @RequestParam(value = "show", required = false, defaultValue = "-") String show) {
- // 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("show", "\"" + show + "\"");
- return new ModelAndView("/yeweihui/home.ftl", model);
- }
- @GetMapping("/ywh/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("/ywh/qiuzhu/queryTasksByStatus.json")
- public Model queryTasksByStatus(@Pd(name = "status") Integer status) {
- List<QzTask> taskList = qzTaskService.queryQzTaskByStatus(status);
- return Model.newSuccess(taskList);
- }
- @PostMapping("/ywh/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("/ywh/qiuzhu/reply/querybytaskid.json")
- public Model replyQiuzhuQueryByTaskId(@Pd(name = "taskId") Long taskId) {
- List<QzTaskReply> reply = qzTaskReplyService.queryQzTaskReplyByTaskId(taskId);
- return Model.newSuccess(reply);
- }
- @PostMapping("/ywh/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("/ywh/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("/ywh/ribaoDy")
- public Model<List<SysUptownHouse>> yeweihuiRibaoDy(Long str) {
- // String[] split = str.split("&");
- List<SysUptownHouse> rbList = rbService.selectXq(str);
- return Model.newSuccess(rbList);
- }
- @GetMapping("/ywh/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("/ywh/ribaoDyYcXq")
- public Model<List<MsSuspected>> yeweihuiRibaoYcXq(Long houseId) {
- List<MsSuspected> rbList = rbService.selectYcXq(houseId);
- return Model.newSuccess(rbList);
- }
- @GetMapping("/ywh/ribaohuiz.html")
- public ModelAndView yeweihuiRibaohuiz(ModelMap model) {
- return new ModelAndView("/yeweihui/ribaohuiz.ftl", model);
- }
- @GetMapping("/ywh/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("/ywh/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("/ywh/lun/exportRiBao")
- @SneakyThrows
- public void lunExportRiBao(@Pd(name = "date") String date,
- HttpServletResponse resp) {
- Uptown uptown = uptownMapper.selectById("1238790987234");
- Long upId = uptown.getUptownId();
- String fileName = uptown.getUptownName();
- fileName += "上报信息-";
- fileName += date;
- List<ExcelRiBaoLY> list = rbMapper.selectExcelRiBaoLY(upId, date);
- ExcelUtils.writeSheet(ExcelRiBaoLY.class, list).export(resp, fileName);
- }
- @ApiOperation("导出小区家庭上报明细")
- @GetMapping("/ywh/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("/ywh/tgPublish.html")
- public ModelAndView tgPublish(@Pd(name = "userId") Long userId, ModelMap model) throws JsonProcessingException {
- model.put("userId", "\"" + userId + "\"");
- return new ModelAndView("/yeweihui/tgPublish.ftl", model);
- }
- @PostMapping("/ywh/tgPublish.json")
- public Model tuangouPublish(JmTuangou jmTuangou) {
- Integer success = jmTuangouService.tuangouPublish(jmTuangou);
- if (success == 1) {
- return Model.newSuccess("操作成功");
- } else {
- return Model.newFail("操作失败");
- }
- }
- @PostMapping("/ywh/tuangou/list/query.json")
- public Model queryTuangouListByTitle(@Pd(name = "userId") Long userId, @Pd(name = "title", required = false) String title) {
- List<JmTuangou> list = jmTuangouService.queryTuangouListByTitle(userId, title);
- return Model.newSuccess(list);
- }
- @PostMapping("/ywh/tuangou/mylist/query.json")
- public Model queryTuangouMyListByTitle(@Pd(name = "userId") Long userId, @Pd(name = "title", required = false) String title) {
- List<JmTuangou> myList = jmTuangouService.queryTuangouMyListByTitle(userId, title);
- return Model.newSuccess(myList);
- }
- @PostMapping("/ywh/getAllUptown")
- public Model<List<Uptown>> getAllUptown(HttpParameterParser parser, PageDb pageDb) {
- return Model.newSuccess(pageDb, uptownMapper.getUptowns(pageDb, parser.getMap()));
- }
- }
|