YeWeiHuiController.java 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. package com.bofeng.wx.controller;
  2. import com.bofeng.entity.QzTask;
  3. import com.bofeng.entity.QzTaskReply;
  4. import com.bofeng.entity.SysUptownHouse;
  5. import com.bofeng.entity.sysUptownUnit;
  6. import com.bofeng.service.QzTaskReplyService;
  7. import com.bofeng.service.QzTaskService;
  8. import com.bofeng.service.RbService;
  9. import com.fasterxml.jackson.core.JsonProcessingException;
  10. import com.google.common.collect.Maps;
  11. import com.yvan.Model;
  12. import com.yvan.ModelOps;
  13. import com.yvan.mvc.Pd;
  14. import com.yvan.platform.JsonWapper;
  15. import com.yvan.platform.YvanUtil;
  16. import org.apache.ibatis.annotations.Param;
  17. import org.springframework.beans.factory.annotation.Autowired;
  18. import org.springframework.ui.ModelMap;
  19. import org.springframework.web.bind.annotation.GetMapping;
  20. import org.springframework.web.bind.annotation.PostMapping;
  21. import org.springframework.web.bind.annotation.RequestParam;
  22. import org.springframework.web.bind.annotation.RestController;
  23. import org.springframework.web.servlet.ModelAndView;
  24. import java.util.List;
  25. import java.util.Map;
  26. @RestController
  27. public class YeWeiHuiController {
  28. @Autowired
  29. private QzTaskService qzTaskService;
  30. @Autowired
  31. private RbService rbService;
  32. @Autowired
  33. private QzTaskReplyService qzTaskReplyService;
  34. @GetMapping("/yeweihui/home.html")
  35. public ModelAndView yeweihui(ModelMap model,@RequestParam(value = "userId", required = false,defaultValue = "0") Long userId) {
  36. Map<String, Object> queryParam = Maps.newLinkedHashMap();
  37. queryParam.put("userId", "12345677");
  38. queryParam.put("statistics", "M");
  39. List<QzTask> taskList = qzTaskService.selectAll();
  40. List<sysUptownUnit> rbList = rbService.selectAll(1224706869998772226L);
  41. model.put("taskList", YvanUtil.toJsonPretty(taskList));
  42. model.put("rbList", YvanUtil.toJsonPretty(rbList));
  43. return new ModelAndView("/yeweihui/home.ftl", model);
  44. }
  45. @GetMapping("/yeweihui/qiuzhuDetail.html")
  46. public ModelAndView qiuzhudetail(@Pd(name = "taskId") Long taskId, ModelMap model) throws JsonProcessingException {
  47. QzTask task = qzTaskService.queryByTaskId(taskId);
  48. // A业委会,B居委会,C物业,D志愿者
  49. StringBuffer target = new StringBuffer();
  50. if (task.getTaskTarget().equals("A")) {
  51. target.append("业委会");
  52. }
  53. else if (task.getTaskTarget().equals("B")) {
  54. if (target.length() > 0) {
  55. target.append("、居委会");
  56. }
  57. else {
  58. target.append("居委会");
  59. }
  60. }
  61. else if (task.getTaskTarget().equals("C")) {
  62. if (target.length() > 0) {
  63. target.append("、物业");
  64. }
  65. else {
  66. target.append("物业");
  67. }
  68. }
  69. else if (task.getTaskTarget().equals("D")) {
  70. if (target.length() > 0) {
  71. target.append("、志愿者");
  72. }
  73. else {
  74. target.append("志愿者");
  75. }
  76. }
  77. task.setTaskTarget(target.toString());
  78. model.put("taskJson", new JsonWapper(task));
  79. model.put("task", task);
  80. return new ModelAndView("/yeweihui/qiuzhuDetail.ftl", model);
  81. }
  82. @PostMapping("/yeweihui/qiuzhu/queryTasksByStatus.json")
  83. public Model queryTasksByStatus(@Pd(name = "status") Integer status) {
  84. // List<QzTask> taskList = qzTaskService.queryQzTask(status);
  85. return Model.newSuccess(null);
  86. }
  87. @PostMapping("/yeweihui/qiuzhu/reply/add.json")
  88. public ModelOps replyQiuzhuInsert(QzTaskReply qzTaskReply) {
  89. Integer success = qzTaskReplyService.insertQzTaskReply(qzTaskReply);
  90. if (success > 0) {
  91. return ModelOps.newSuccess();
  92. }
  93. else {
  94. return ModelOps.newFail("操作失败");
  95. }
  96. }
  97. @PostMapping("/yeweihui/qiuzhu/reply/querybytaskid.json")
  98. public Model replyQiuzhuQueryByTaskId(@Pd(name = "taskId") Long taskId) {
  99. List<QzTaskReply> reply = qzTaskReplyService.queryQzTaskReplyByTaskId(taskId);
  100. return Model.newSuccess(reply);
  101. }
  102. @PostMapping("/yeweihui/qiuzhu/list.json")
  103. public Model queryByHouseNumber(@Pd(name = "houseNumber") String houseNumber, @Pd(name = "status") Integer status) {
  104. List<QzTask> list = qzTaskService.queryByHouseNumber(houseNumber, status);
  105. return Model.newSuccess(list);
  106. }
  107. @GetMapping("/yeweihui/ribao.html")
  108. public ModelAndView yeweihuiRibao(ModelMap model) {
  109. // List<QzTask> taskList = qzTaskService.selectAll();
  110. //
  111. // model.put("taskList", YvanUtil.toJsonPretty(taskList));
  112. return new ModelAndView("/yeweihui/ribao.ftl", model);
  113. }
  114. @GetMapping("/yeweihui/ribaoDy")
  115. public Model<List<SysUptownHouse>> yeweihuiRibaoDy(String str) {
  116. String[] split = str.split("&");
  117. List<SysUptownHouse> rbList = rbService.selectXq(split[0],split[1],Long.parseLong(split[2]));
  118. return Model.newSuccess(rbList);
  119. }
  120. }