209ce8e4854b0476bcbd530578b196de507315a6.svn-base
13.6 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
/**
* Copyright © 2015-2018 <a href="#">J-Site</a> All rights reserved.
*/
package com.thinkgem.jeesite.modules.reg.web.bus;
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.commons.beanutils.BeanUtils;
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.reg.entity.base.RegBasePerson;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusHisBdcqzsdjxx;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusHisHouseBdcqzsdjxx;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusHisHouseQlr;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusHisHouseYwr;
import com.thinkgem.jeesite.modules.reg.service.base.RegBasePersonService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusHisBdcqzsdjxxService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusHisHouseBdcqzsdjxxService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusHisHouseYwrService;
import com.thinkgem.jeesite.modules.sys.utils.DictUtils;
/**
* 房屋历史数据录入义务人添加Controller
* @author wb
* @version 2016-04-17
*/
@Controller
@RequestMapping(value = "${adminPath}/reg/bus/regBusHisHouseYwr")
public class RegBusHisHouseYwrController extends BaseController {
@Autowired
private RegBusHisHouseYwrService regBusHisHouseYwrService;
@Autowired
private RegBasePersonService regBasePersonService;
@Autowired
private RegBusHisHouseBdcqzsdjxxService regBusHisHouseBdcqzsdjxxService;
@Autowired
private RegBusHisBdcqzsdjxxService regBusHisBdcqzsdjxxService;
@ModelAttribute
public RegBusHisHouseYwr get(@RequestParam(required=false) String id) {
RegBusHisHouseYwr entity = null;
if (StringUtils.isNotBlank(id)){
entity = regBusHisHouseYwrService.get(id);
}
if (entity == null){
entity = new RegBusHisHouseYwr();
}
return entity;
}
@RequiresPermissions("reg:bus:regBusHisHouseYwr:view")
@RequestMapping(value = {"list", ""})
public String list(RegBusHisHouseYwr regBusHisHouseYwr, HttpServletRequest request, HttpServletResponse response, Model model) {
System.out.println(request.getParameter("YWH"));
if(StringUtils.isNotBlank(request.getParameter("YWH"))){
regBusHisHouseYwr.setYwh(request.getParameter("YWH"));
model.addAttribute("LSH",regBusHisHouseYwr.getYwh().substring(2));
}
//WinOpen标示
if(StringUtils.isNotBlank(request.getParameter("WO"))){
model.addAttribute("WO", "1");
}
if(StringUtils.isNotBlank(request.getParameter("td"))){
model.addAttribute("WO", "");
model.addAttribute("WWO", "1");
model.addAttribute("td", "1");
model.addAttribute("H", "1");
}
if(StringUtils.isNotBlank(request.getParameter("xg"))){
model.addAttribute("xg", "1");
}
if(StringUtils.isNotBlank(request.getParameter("LISTVIEWS"))){
model.addAttribute("LISTVIEWS", "1");
}
if(StringUtils.isNotBlank(request.getParameter("H"))){
model.addAttribute("H", "1");
}
Page<RegBusHisHouseYwr> page = regBusHisHouseYwrService.findPage(new Page<RegBusHisHouseYwr>(request, response), regBusHisHouseYwr);
model.addAttribute("page", page);
return "modules/reg/bus/regBusHisHouseYwrList";
}
/**
* 中间库列表
* @param regBusHisHouseYwr
* @param request
* @param response
* @param model
* @return
*/
@RequiresPermissions("reg:bus:regBusHisHouseYwr:view")
@RequestMapping(value = "zjklist")
public String zjklist(RegBusHisHouseYwr regBusHisHouseYwr, HttpServletRequest request, HttpServletResponse response, Model model) {
if(StringUtils.isNotBlank(request.getParameter("YWH"))){
regBusHisHouseYwr.setYwh(request.getParameter("YWH"));
}
Page<RegBusHisHouseYwr> page = regBusHisHouseYwrService.findywrzjkPage(new Page<RegBusHisHouseYwr>(request, response), regBusHisHouseYwr);
//WinOpen标示
if(StringUtils.isNotBlank(request.getParameter("WO"))){
model.addAttribute("WO", "1");
}
if(StringUtils.isNotBlank(request.getParameter("xg"))){
model.addAttribute("xg", "1");
}
if(StringUtils.isNotBlank(request.getParameter("zjk"))){
model.addAttribute("zjk", "1");
}
if(StringUtils.isNotBlank(request.getParameter("LISTVIEWS"))){
model.addAttribute("LISTVIEWS", "1");
}
model.addAttribute("page", page);
return "modules/reg/bus/regBusHisHouseYwrList";
}
@RequiresPermissions("reg:bus:regBusHisHouseYwr:view")
@RequestMapping(value = "form")
public String form(RegBusHisHouseYwr regBusHisHouseYwr, Model model, HttpServletRequest request) {
if(StringUtils.isBlank(request.getParameter("optype"))){
model.addAttribute("SXH", getQlrmcOrderNumber(request.getParameter("YWH")));
}
if(StringUtils.isNotBlank(request.getParameter("YWH"))){
String ywh = request.getParameter("YWH");
regBusHisHouseYwr.setYwh(ywh);
}
if(StringUtils.isNotBlank(request.getParameter("ids"))){
model.addAttribute("idss",request.getParameter("ids"));
}
System.out.println(request.getParameter("H"));
if(StringUtils.isNotBlank(request.getParameter("H"))){
model.addAttribute("H",request.getParameter("H"));
}
String qxdm = DictUtils.getDictLabel(Global.getAreaCode(), "reg_bus_xq","");
model.addAttribute("regBusHisHouseYwr", regBusHisHouseYwr);
return "modules/reg/bus/regBusHisHouseYwrForm";
}
@RequiresPermissions("reg:bus:regBusHisHouseYwr:view")
@RequestMapping(value = "showform")
public String showform(RegBusHisHouseYwr regBusHisHouseYwr, Model model, HttpServletRequest request) {
if(StringUtils.isNotBlank(request.getParameter("YWH"))){
String ywh = request.getParameter("YWH");
regBusHisHouseYwr.setYwh(ywh);
}
if(StringUtils.isNotBlank(request.getParameter("ids"))){
model.addAttribute("idss",request.getParameter("ids"));
regBusHisHouseYwr = regBusHisHouseYwrService.get(request.getParameter("ids"));
}
System.out.println(request.getParameter("H"));
if(StringUtils.isNotBlank(request.getParameter("H"))){
model.addAttribute("H",request.getParameter("H"));
}
model.addAttribute("show","1");
model.addAttribute("regBusHisHouseYwr", regBusHisHouseYwr);
return "modules/reg/bus/regBusHisHouseYwrForm";
}
@RequiresPermissions("reg:bus:regBusHisHouseYwr:view")
@RequestMapping(value = "ywrform")
public String ywrform(RegBusHisHouseYwr regBusHisHouseYwr, Model model, HttpServletRequest request) {
Map<String,String> map = new HashMap<String,String>();
//计算当前顺序号【注意:只有新增时才需要这个值】
if(StringUtils.isBlank(request.getParameter("optype"))){
model.addAttribute("SXH", getQlrmcOrderNumber(request.getParameter("YWH")));
}
if(StringUtils.isNotBlank(request.getParameter("YWH"))){
String ywh = request.getParameter("YWH");
regBusHisHouseYwr.setYwh(ywh);
}
if(StringUtils.isNotBlank(request.getParameter("H"))){
model.addAttribute("H",request.getParameter("H"));
}
if(StringUtils.isNotBlank(request.getParameter("idss"))){
model.addAttribute("idss",request.getParameter("idss"));
}
String ids = request.getParameter("ids");
RegBasePerson person = new RegBasePerson();
person = regBasePersonService.get(ids);
regBusHisHouseYwr.setZjzl(person.getZjzl());
regBusHisHouseYwr.setZjh(person.getZjh());
regBusHisHouseYwr.setQlrmc(person.getRymc());
regBusHisHouseYwr.setDz(person.getDz());
regBusHisHouseYwr.setHjszss(person.getHjszss());
regBusHisHouseYwr.setXb(person.getXb());
regBusHisHouseYwr.setDh(person.getDh());
regBusHisHouseYwr.setSshy(person.getSshy());
regBusHisHouseYwr.setYb(person.getYb());
regBusHisHouseYwr.setGzdw(person.getGzdw());
regBusHisHouseYwr.setDzyj(person.getDzyj());
regBusHisHouseYwr.setDlrmc(person.getDlrymc());
regBusHisHouseYwr.setDljgmc(person.getDljg());
regBusHisHouseYwr.setDlrdh(person.getDlrydh());
regBusHisHouseYwr.setBz(person.getBz());
regBusHisHouseYwr.setQlrlx(person.getRylx());
regBusHisHouseYwr.setHjszss(person.getHjszss());
regBusHisHouseYwr.setPcode(person.getPcode());
regBusHisHouseYwr.setFzjg(person.getFzjg());
regBusHisHouseYwr.setSfczr(DictUtils.getDictValue("是", "yes_no",""));
regBusHisHouseYwr.setId("");
model.addAttribute("pcode", person.getPcode());
model.addAttribute("maps", map);
model.addAttribute("regBusHisHouseYwr", regBusHisHouseYwr);
return "modules/reg/bus/regBusHisHouseYwrForm";
}
@RequiresPermissions("reg:bus:regBusHisHouseYwr:edit")
@RequestMapping(value = "save")
public String save(RegBusHisHouseYwr regBusHisHouseYwr, Model model,HttpServletRequest request, RedirectAttributes redirectAttributes) {
String tz = "";
if(StringUtils.isNotBlank(request.getParameter("H"))){
tz = request.getParameter("H");
}
String LSH = regBusHisHouseYwr.getYwh();
//通过id获取房屋大表和权利人表数据如果存在数据直接更新
RegBusHisHouseYwr ywr = new RegBusHisHouseYwr();
ywr.setYwh(regBusHisHouseYwr.getYwh());
ywr.setZjh(regBusHisHouseYwr.getZjh());
List<RegBusHisHouseYwr> ywrlist = regBusHisHouseYwrService.findList(ywr);//获取权利人子表数据
if(ywrlist.size()>0){
ywr = ywrlist.get(0);
regBusHisHouseYwr.setSxh(ywrlist.get(0).getSxh());
regBusHisHouseYwr.setId(ywrlist.get(0).getId());
}
if(tz.equals("1")){
//预告登记反写大表义务人
RegBusHisHouseBdcqzsdjxx djxx = new RegBusHisHouseBdcqzsdjxx();
djxx.setYwh(LSH);
List<RegBusHisHouseBdcqzsdjxx> list = regBusHisHouseBdcqzsdjxxService.findList(djxx);
if(list.size() > 0){
djxx = list.get(0);
djxx.setYwr(regBusHisHouseYwr.getQlrmc());
djxx.setYwrzjh(regBusHisHouseYwr.getZjh());
djxx.setYwrzjzl(regBusHisHouseYwr.getZjzl());
regBusHisHouseBdcqzsdjxxService.save(djxx);
}
regBusHisHouseYwrService.save(regBusHisHouseYwr);
}
//抵押
if(tz.equals("2")){
String ids = request.getParameter("idss");
String[] idList = ids.split(";");
for(String hisId : idList){
RegBusHisHouseBdcqzsdjxx hisdjxx = regBusHisHouseBdcqzsdjxxService.get(hisId);
RegBusHisHouseYwr newYwr = new RegBusHisHouseYwr();
newYwr = regBusHisHouseYwr;
newYwr.setBdcdyh(hisdjxx.getBdcdyh());
newYwr.setId("");
//首先获取权利人 ID个数
int ywrmcOrderNumber = 1;
RegBusHisHouseYwr ywr2 = new RegBusHisHouseYwr();
ywr2.setYwh(LSH);
ywr2.setBdcdyh(hisdjxx.getBdcdyh());
List<RegBusHisHouseYwr> ywrlist_1 = regBusHisHouseYwrService.findList(ywr2);
int count = ywrlist_1.size();
if(count > 0){
ywrmcOrderNumber = ywrlist_1.size() + 1;
}
newYwr.setSxh(String.valueOf(ywrmcOrderNumber));
RegBusHisHouseYwr newYwr_1 = new RegBusHisHouseYwr();
newYwr_1.setBdcdyh(hisdjxx.getBdcdyh());
newYwr_1.setYwh(LSH);
newYwr_1.setPcode(regBusHisHouseYwr.getPcode());
List<RegBusHisHouseYwr> listywr = regBusHisHouseYwrService.findList(newYwr_1);
if(listywr.size() > 0){
newYwr.setId(listywr.get(0).getId());
}
regBusHisHouseYwrService.save(newYwr);
}
}
if(tz.equals("3")){
regBusHisHouseYwrService.save(regBusHisHouseYwr);
}
//土地历史入口抵押
String td = "";
if(tz.equals("4")){
regBusHisHouseYwrService.save(regBusHisHouseYwr);
td = "1";
}
System.out.println(regBusHisHouseYwr.getYwh()+"****"+LSH);
addMessage(redirectAttributes, "保存历史数据录入义务人添加成功");
return "redirect:"+Global.getAdminPath()+"/reg/bus/regBusHisHouseYwr/list?WO=1&LISTVIEWS=1&YWH="+regBusHisHouseYwr.getYwh()+"&td="+td;
}
@RequiresPermissions("reg:bus:regBusHisHouseYwr:edit")
@RequestMapping(value = "delete")
public String delete(RegBusHisHouseYwr regBusHisHouseYwr, RedirectAttributes redirectAttributes) {
RegBusHisHouseYwr regBushishouseywr1 = new RegBusHisHouseYwr();
regBushishouseywr1.setYwh(regBusHisHouseYwr.getYwh());
List<RegBusHisHouseYwr> regBusywrlist = regBusHisHouseYwrService.findList(regBushishouseywr1);
if(regBusywrlist.size() > 0){
regBushishouseywr1 = regBusywrlist.get(regBusywrlist.size()-1);
if(Integer.parseInt(regBushishouseywr1.getSxh()) > Integer.parseInt(regBusHisHouseYwr.getSxh())){//判断当前顺序号是否是最大顺序号
addMessage(redirectAttributes, "请先删除最大顺序号权利人!");
}else{
if(StringUtils.isNotBlank(regBusHisHouseYwr.getId())){
regBusHisHouseYwrService.delete(regBusHisHouseYwr);
addMessage(redirectAttributes, "删除房屋历史数据录入义务人添加成功");;
}
}
}
return "redirect:"+Global.getAdminPath()+"/reg/bus/regBusHisHouseYwr/?YWH="+regBusHisHouseYwr.getYwh();
}
/***
* @Title: getQlrmcOrderNumber
* @Description: 通过业务号获取当前权利人在此业务中的顺序号
* @param @param ywhStr
* @param @return 设定文件
* @return String 返回类型
* @throws
*/
public int getQlrmcOrderNumber(String ywhStr){
int ywrmcOrderNumber = 1;//默认为001
if(StringUtils.isBlank(ywhStr)){
return ywrmcOrderNumber;
}
//首先获取权利人 ID个数
RegBusHisHouseYwr qlr = new RegBusHisHouseYwr();
qlr.setYwh(ywhStr);
List<RegBusHisHouseYwr> qlrlist = regBusHisHouseYwrService.findList(qlr);
int count = qlrlist.size();
if(count > 0){
ywrmcOrderNumber = qlrlist.size() + 1;
}
return ywrmcOrderNumber;
}
}