WxFeedbackController.java
4.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/**
* Copyright © 2015-2018 <a href="#">J-Site</a> All rights reserved.
*/
package com.thinkgem.jeesite.modules.wechat.web;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.thinkgem.jeesite.common.config.Global;
import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.web.BaseController;
import com.thinkgem.jeesite.common.utils.StringUtils;
import com.thinkgem.jeesite.modules.sys.entity.User;
import com.thinkgem.jeesite.modules.sys.service.OfficeService;
import com.thinkgem.jeesite.modules.sys.utils.UserUtils;
import com.thinkgem.jeesite.modules.wechat.entity.WxFeedback;
import com.thinkgem.jeesite.modules.wechat.service.WxFeedbackService;
/**
* 反馈意见Controller
* @author lzj
* @version 2020-03-19
*/
@Controller
@RequestMapping(value = "${adminPath}/wechat/wxFeedback")
public class WxFeedbackController extends BaseController {
@Autowired
private WxFeedbackService wxFeedbackService;
@Autowired
private OfficeService officeService;
@ModelAttribute
public WxFeedback get(@RequestParam(required=false) String id) {
WxFeedback entity = null;
if (StringUtils.isNotBlank(id)){
entity = wxFeedbackService.get(id);
}
if (entity == null){
entity = new WxFeedback();
}
return entity;
}
@RequiresPermissions("wechat:wxFeedback:view")
@RequestMapping(value = {"list", ""})
public String list(WxFeedback wxFeedback, HttpServletRequest request, HttpServletResponse response, Model model) {
User user = UserUtils.getUser();
String office = user.getOffice().getName();
if(StringUtils.isNotBlank(office)) {
if(office.indexOf("权证") != -1) {
wxFeedback.setKes("10");
}else if(office.indexOf("抵押") != -1) {
wxFeedback.setKes("20");
}else if(office.indexOf("预告") != -1) {
wxFeedback.setKes("30");
}else if(office.indexOf("农林") != -1) {
wxFeedback.setKes("40");
}else if(office.indexOf("更正") != -1) {
wxFeedback.setKes("100");
}else {
String name = user.getName();
if(name.equals("代军")) {
wxFeedback.setKes("60");
}else if(name.equals("王才旺")) {
wxFeedback.setKes("50");
}
}
Page<WxFeedback> page = wxFeedbackService.findPage(new Page<WxFeedback>(request, response), wxFeedback);
model.addAttribute("page", page);
}
return "modules/wechat/wxFeedbackList";
}
@RequiresPermissions("wechat:wxFeedback:view")
@RequestMapping(value = "form")
public String form(WxFeedback wxFeedback, Model model) {
model.addAttribute("wxFeedback", wxFeedback);
return "modules/wechat/wxFeedbackForm";
}
@RequiresPermissions("wechat:wxFeedback:edit")
@RequestMapping(value = "save")
public String save(WxFeedback wxFeedback, Model model, RedirectAttributes redirectAttributes) {
if (!beanValidator(model, wxFeedback)){
return form(wxFeedback, model);
}
wxFeedbackService.save(wxFeedback);
Map map = new HashMap();
try {
map = wxFeedbackService.answer(wxFeedback);
}catch(Exception e){
e.printStackTrace();
map.put("success", false);
map.put("resultMsg", e.getMessage());
}
addMessage(redirectAttributes, "保存反馈意见成功");
return "redirect:"+Global.getAdminPath()+"/wechat/wxFeedback/?repage";
}
@RequiresPermissions("wechat:wxFeedback:edit")
@RequestMapping(value = "open")
public String open(WxFeedback wxFeedback, Model model,HttpServletRequest request, RedirectAttributes redirectAttributes) {
String isopen = request.getParameter("isopen");
wxFeedback.setIsopen(isopen);
wxFeedbackService.save(wxFeedback);
Map map = new HashMap();
try {
map = wxFeedbackService.open(wxFeedback);
}catch(Exception e){
e.printStackTrace();
map.put("success", false);
map.put("resultMsg", e.getMessage());
}
addMessage(redirectAttributes, "保存反馈意见成功");
return "redirect:"+Global.getAdminPath()+"/wechat/wxFeedback/?repage";
}
@RequiresPermissions("wechat:wxFeedback:edit")
@RequestMapping(value = "delete")
public String delete(WxFeedback wxFeedback, RedirectAttributes redirectAttributes) {
wxFeedbackService.delete(wxFeedback);
addMessage(redirectAttributes, "删除反馈意见成功");
return "redirect:"+Global.getAdminPath()+"/wechat/wxFeedback/?repage";
}
}