ComplaintQuestionInfoController.java 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. package com.iamberry.rst.controllers.cm;
  2. import com.iamberry.rst.core.cm.ComplaintQuestionInfo;
  3. import com.iamberry.rst.core.cm.ComplaintSmallClassInfo;
  4. import com.iamberry.rst.core.cm.ComplaintTypeInfo;
  5. import com.iamberry.rst.faces.cm.ComplaintQuestionInfoService;
  6. import com.iamberry.rst.faces.cm.ComplaintSmallClassInfoService;
  7. import com.iamberry.rst.faces.cm.ComplaintTypeInfoService;
  8. import com.iamberry.wechat.tools.ResponseJson;
  9. import org.apache.shiro.authz.annotation.RequiresPermissions;
  10. import org.springframework.beans.factory.annotation.Autowired;
  11. import org.springframework.stereotype.Controller;
  12. import org.springframework.web.bind.annotation.RequestMapping;
  13. import org.springframework.web.bind.annotation.ResponseBody;
  14. import org.springframework.web.servlet.ModelAndView;
  15. import javax.servlet.http.HttpServletRequest;
  16. import java.util.List;
  17. /**
  18. * Created by wxm
  19. * 问题
  20. */
  21. @Controller
  22. @RequestMapping("/admin/complaintQuestion")
  23. public class ComplaintQuestionInfoController {
  24. /**
  25. * 邮寄地址id
  26. */
  27. private Integer backOutQuestionId = 5;
  28. @Autowired
  29. private ComplaintTypeInfoService complaintTypeInfoService;
  30. @Autowired
  31. private ComplaintSmallClassInfoService complaintSmallClassInfoService;
  32. @Autowired
  33. private ComplaintQuestionInfoService complaintQuestionInfoService;
  34. /**
  35. * 查询所有问题类型
  36. *
  37. * @return
  38. */
  39. @ResponseBody
  40. @RequestMapping(value = "/list_complaintType")
  41. public ResponseJson listComplaintTypeInfo(HttpServletRequest request) {
  42. ComplaintTypeInfo complaintTypeInfo = new ComplaintTypeInfo();
  43. String complaintConsultingTypeOther = request.getParameter("complaintConsultingType");
  44. //咨询类型
  45. if (complaintConsultingTypeOther != null && !"".equals(complaintConsultingTypeOther)) {
  46. Integer complaintConsultingType = Integer.valueOf(complaintConsultingTypeOther);
  47. complaintTypeInfo.setComplaintConsultingType(complaintConsultingType);
  48. }
  49. List<ComplaintTypeInfo> complaintTypeInfoList = complaintTypeInfoService.listComplaintTypeInfo(complaintTypeInfo);
  50. if (complaintTypeInfoList == null || complaintTypeInfoList.size() < 1) {
  51. return new ResponseJson(500, "查询失败", 500);
  52. } else {
  53. ResponseJson rj =new ResponseJson(200, "查询成功", 200);
  54. rj.addResponseKeyValue("complaintTypeInfoList", complaintTypeInfoList);
  55. return rj;
  56. }
  57. }
  58. /**
  59. * 查询所有问题小类
  60. *
  61. * @return
  62. */
  63. @ResponseBody
  64. @RequestMapping(value = "/list_complaintSmallClass")
  65. public ResponseJson listComplaintSmallClassInfo(HttpServletRequest request,ComplaintSmallClassInfo complaintSmallClassInfo) {
  66. List<ComplaintSmallClassInfo> complaintSmallClassInfoList = complaintSmallClassInfoService.listComplaintSmallClassInfo(complaintSmallClassInfo);
  67. if (complaintSmallClassInfoList == null || complaintSmallClassInfoList.size() < 1) {
  68. return new ResponseJson(500, "查询失败", 500);
  69. } else {
  70. ResponseJson rj =new ResponseJson(200, "查询成功", 200);
  71. rj.addResponseKeyValue("complaintSmallClassInfoList", complaintSmallClassInfoList);
  72. return rj;
  73. }
  74. }
  75. /**
  76. * 查询所有问题
  77. *
  78. * @return
  79. */
  80. @ResponseBody
  81. @RequestMapping(value = "/list_complaintQuestion")
  82. public ResponseJson listComplaintQuestion(HttpServletRequest request,ComplaintQuestionInfo complaintQuestionInfo) {
  83. List<ComplaintQuestionInfo> complaintQuestionInfoList = complaintQuestionInfoService.listComplaintQuestionInfo(complaintQuestionInfo);
  84. if (complaintQuestionInfoList == null || complaintQuestionInfoList.size() < 1) {
  85. return new ResponseJson(500, "查询失败", 500);
  86. } else {
  87. ResponseJson rj =new ResponseJson(200, "查询成功", 200);
  88. rj.addResponseKeyValue("complaintQuestionInfoList", complaintQuestionInfoList);
  89. return rj;
  90. }
  91. }
  92. /**
  93. * 保存问题
  94. *
  95. * @return
  96. */
  97. @ResponseBody
  98. @RequestMapping(value = "/save_question")
  99. public ResponseJson saveQuestion(HttpServletRequest request,ComplaintQuestionInfo complaintQuestionInfo) {
  100. Integer flag;
  101. if(complaintQuestionInfo.getQuestionId() == null || "".equals(complaintQuestionInfo.getQuestionId())){
  102. complaintQuestionInfo.setQuestionState(1);
  103. complaintQuestionInfo.setQuestionIsQcDetect(0);
  104. complaintQuestionInfo = complaintQuestionInfoService.insertBackInfo(complaintQuestionInfo);
  105. }else{
  106. complaintQuestionInfo.setSmallClassId(null); //不能修改小类类型
  107. flag = complaintQuestionInfoService.updateQuestionById(complaintQuestionInfo);
  108. if (flag < 1) {
  109. return new ResponseJson(500, "问题修改失败!", 500);
  110. }
  111. }
  112. ResponseJson rj =new ResponseJson(200, "问题保存成功", 200);
  113. rj.addResponseKeyValue("questionId", complaintQuestionInfo.getQuestionId());
  114. return rj;
  115. }
  116. /**
  117. * 修改是否已解决总数
  118. *
  119. * @return
  120. */
  121. @ResponseBody
  122. @RequestMapping(value = "/update_question_num")
  123. public ResponseJson updateQuestionNum(HttpServletRequest request, ComplaintQuestionInfo complaintQuestionInfo){
  124. ResponseJson msg = new ResponseJson();
  125. if(complaintQuestionInfo == null){
  126. msg.setResultCode(500);
  127. msg.setReturnCode(500);
  128. return msg;
  129. }
  130. Integer num = complaintQuestionInfoService.updateQuestionById(complaintQuestionInfo);
  131. if (num < 1) {
  132. msg.setResultCode(500);
  133. msg.setReturnCode(500);
  134. } else {
  135. msg.setResultCode(200);
  136. msg.setReturnCode(200);
  137. }
  138. return msg;
  139. }
  140. /**
  141. * 查询客诉问题
  142. *
  143. * @return
  144. */
  145. @ResponseBody
  146. @RequestMapping(value = "/get_question")
  147. public ResponseJson getQuestion(HttpServletRequest request, Integer questionId){
  148. ResponseJson msg = new ResponseJson();
  149. if(questionId == null){
  150. msg.setResultCode(500);
  151. msg.setReturnCode(500);
  152. return msg;
  153. }
  154. ComplaintQuestionInfo complaintQuestionInfo = complaintQuestionInfoService.getQuestionById(questionId);
  155. if (complaintQuestionInfo == null) {
  156. msg.setResultCode(500);
  157. msg.setReturnCode(500);
  158. } else {
  159. msg.setResultCode(200);
  160. msg.setReturnCode(200);
  161. msg.addResponseKeyValue("complaintQuestionInfo",complaintQuestionInfo);
  162. }
  163. return msg;
  164. }
  165. /**
  166. * 查询退回短信客诉问题
  167. *
  168. * @return
  169. */
  170. @ResponseBody
  171. @RequestMapping(value = "/get_back_out_question")
  172. public ResponseJson getBackOutQuestion(HttpServletRequest request){
  173. ResponseJson msg = new ResponseJson();
  174. ComplaintQuestionInfo complaintQuestionInfo = complaintQuestionInfoService.getQuestionById(backOutQuestionId);
  175. if (complaintQuestionInfo == null) {
  176. msg.setResultCode(500);
  177. msg.setReturnCode(500);
  178. } else {
  179. msg.setResultCode(200);
  180. msg.setReturnCode(200);
  181. msg.addResponseKeyValue("complaintQuestionInfo",complaintQuestionInfo);
  182. }
  183. return msg;
  184. }
  185. }