b9294a8a50de9a81a934d24c4494dc58f4e995cb.svn-base
6.33 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/**
* Copyright © 2015-2018 <a href="#">J-Site</a> All rights reserved.
*/
package com.thinkgem.jeesite.modules.reg.web.base;
import java.util.HashMap;
import java.util.List;
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.bind.annotation.ResponseBody;
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.reg.entity.base.RegBaseFdcqxm;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBaseH;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBaseZrz;
import com.thinkgem.jeesite.modules.reg.service.base.RegBaseFdcqxmService;
import com.thinkgem.jeesite.modules.reg.service.base.RegBaseHService;
import com.thinkgem.jeesite.modules.reg.service.base.RegBaseZrzService;
/**
* 项目内多幢房屋Controller
* @author lj
* @version 2018-03-13
*/
@Controller
@RequestMapping(value = "${adminPath}/reg/base/regBaseFdcqxm")
public class RegBaseFdcqxmController extends BaseController {
@Autowired
private RegBaseFdcqxmService regBaseFdcqxmService;
@Autowired
private RegBaseZrzService regBaseZrzService;
@Autowired
private RegBaseHService regBaseHService;
@ModelAttribute
public RegBaseFdcqxm get(@RequestParam(required=false) String id) {
RegBaseFdcqxm entity = null;
if (StringUtils.isNotBlank(id)){
entity = regBaseFdcqxmService.get(id);
}
if (entity == null){
entity = new RegBaseFdcqxm();
}
return entity;
}
@RequiresPermissions("reg:base:regBaseFdcqxm:view")
@RequestMapping(value = {"list", ""})
public String list(RegBaseFdcqxm regBaseFdcqxm, HttpServletRequest request, HttpServletResponse response, Model model) {
Page<RegBaseFdcqxm> page = regBaseFdcqxmService.findPage(new Page<RegBaseFdcqxm>(request, response), regBaseFdcqxm);
model.addAttribute("page", page);
return "modules/reg/base/regBaseFdcqxmList";
}
//项目多幢添加导航页
@RequestMapping(value = {"guideList"})
public String guideList(RegBaseFdcqxm regBaseFdcqxm, HttpServletRequest request, HttpServletResponse response, Model model) {
model.addAttribute("YWH", request.getParameter("YWH"));
model.addAttribute("DJLX", request.getParameter("DJLX"));
regBaseFdcqxm.setIsaudit("1");
Page<RegBaseFdcqxm> page = regBaseFdcqxmService.findPage(new Page<RegBaseFdcqxm>(request, response), regBaseFdcqxm);
model.addAttribute("page", page);
return "modules/reg/base/regBaseFdcqxmGuideList";
}
@RequiresPermissions("reg:base:regBaseFdcqxm:view")
@RequestMapping(value = "form")
public String form(RegBaseFdcqxm regBaseFdcqxm, Model model,HttpServletRequest request) {
model.addAttribute("regBaseFdcqxm", regBaseFdcqxm);
model.addAttribute("views", request.getParameter("views"));
return "modules/reg/base/regBaseFdcqxmForm";
}
@RequiresPermissions("reg:base:regBaseFdcqxm:edit")
@RequestMapping(value = "save")
public String save(RegBaseFdcqxm regBaseFdcqxm, Model model, RedirectAttributes redirectAttributes) {
regBaseFdcqxm.setIsaudit("0");
regBaseFdcqxmService.save(regBaseFdcqxm);
addMessage(redirectAttributes, "保存项目内多幢房屋成功");
return "redirect:"+Global.getAdminPath()+"/reg/base/regBaseFdcqxm/?repage";
}
@RequiresPermissions("reg:base:regBaseFdcqxm:edit")
@RequestMapping(value = "delete")
public String delete(RegBaseFdcqxm regBaseFdcqxm, RedirectAttributes redirectAttributes) {
regBaseFdcqxmService.delete(regBaseFdcqxm);
addMessage(redirectAttributes, "删除项目内多幢房屋成功");
return "redirect:"+Global.getAdminPath()+"/reg/base/regBaseFdcqxm/?repage";
}
@RequestMapping(value = "audit")
public String audit(RegBaseFdcqxm regBaseFdcqxm, RedirectAttributes redirectAttributes) {
regBaseFdcqxm.setIsaudit("1");
regBaseFdcqxmService.save(regBaseFdcqxm);
addMessage(redirectAttributes, "审核项目内多幢房屋成功");
return "redirect:"+Global.getAdminPath()+"/reg/base/regBaseFdcqxm/?repage";
}
@RequestMapping(value = "unaudit")
public String unaudit(RegBaseFdcqxm regBaseFdcqxm, RedirectAttributes redirectAttributes) {
regBaseFdcqxm.setIsaudit("0");
regBaseFdcqxmService.save(regBaseFdcqxm);
addMessage(redirectAttributes, "审核项目内多幢房屋成功");
return "redirect:"+Global.getAdminPath()+"/reg/base/regBaseFdcqxm/?repage";
}
/**
* 选择fdcqxm后验证是否可用
* @param regBaseFdcqxm
* @param id
* @return
*/
@RequestMapping(value = "canbeused")
@ResponseBody
public Map<String, String> canbeused(RegBaseFdcqxm regBaseFdcqxm , String id) {
Map<String, String> map = new HashMap<String, String>();
map.put("result", "0");//默认0,满足条件;1不满足条件
RegBaseZrz regBaseZrz = new RegBaseZrz();
regBaseZrz.setXmid(id);
List<RegBaseZrz> zrzList = regBaseZrzService.findList(regBaseZrz);
if(zrzList.size()>0){
for(int i=0;i<zrzList.size();i++){
regBaseZrz = zrzList.get(i);
if(!("1".equals(regBaseZrz.getIsaudit()))){
map.put("msg", "幢("+regBaseZrz.getGzwmc()+")信息未审核或已被引用,请核实。");
map.put("result", "1");
}else{
RegBaseH regBaseH = new RegBaseH();
regBaseH.setBdcdyh(regBaseZrz.getBdcdyh().substring(0, 24));
List<RegBaseH> hlistemp = regBaseHService.findAllList(regBaseH);
regBaseH.setRights("0");
regBaseH.setIsaudit("1");
List<RegBaseH> hlistemp1 = regBaseHService.findAllList(regBaseH);
if(hlistemp.size()>0){
if(hlistemp.size()!=hlistemp1.size()){
map.put("msg", "存在未审核或已引用户信息,请核实。");
map.put("result", "1");
}
}else{
map.put("msg", "请添加户信息。");
map.put("result", "1");
}
}
}
}else{
map.put("msg", "请添加幢信息!");
map.put("result", "1");
}
return map;
}
}