8a8017f9e3b4e1658dd946a51d5b3f8b58ca3958.svn-base
9.64 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
/**
* Copyright © 2015-2018 <a href="#">J-Site</a> All rights reserved.
*/
package com.thinkgem.jeesite.modules.jy.web.qlr;
import java.io.IOException;
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.http.client.ClientProtocolException;
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.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.thinkgem.jeesite.common.config.Global;
import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.ServiceException;
import com.thinkgem.jeesite.common.web.BaseController;
import com.thinkgem.jeesite.common.utils.DateUtils;
import com.thinkgem.jeesite.common.utils.StringUtils;
import com.thinkgem.jeesite.modules.jy.entity.fw.JyFw;
import com.thinkgem.jeesite.modules.jy.entity.qlr.JyQlr;
import com.thinkgem.jeesite.modules.jy.service.fw.JyFwService;
import com.thinkgem.jeesite.modules.jy.service.qlr.JyQlrService;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBaseH;
import com.thinkgem.jeesite.modules.reg.service.base.RegBaseHService;
import com.thinkgem.jeesite.modules.reg.web.base.RegBaseCController;
import com.thinkgem.jeesite.modules.reg.web.httprest.httpRestService.HttpactivityService;
import com.thinkgem.jeesite.modules.reg.web.httprest.utils.DatatypeUtil;
/**
* 交易房屋权利信息表Controller
* @author lw
* @version 2020-10-27
*/
@Controller
@RequestMapping(value = "${adminPath}/jy/qlr/jyQlr")
public class JyQlrController extends BaseController {
@Autowired
private JyQlrService jyQlrService;
@Autowired
private RegBaseHService regBaseHService;
@Autowired
private JyFwService jyFwService;
@Autowired
private HttpactivityService httpactivityService;
@ModelAttribute
public JyQlr get(@RequestParam(required=false) String id) {
JyQlr entity = null;
if (StringUtils.isNotBlank(id)){
entity = jyQlrService.get(id);
}
if (entity == null){
entity = new JyQlr();
}
return entity;
}
@RequestMapping(value = {"hook"})
public String hook(RegBaseH regBaseH,JyQlr jyQlr, HttpServletRequest request, HttpServletResponse response, Model model) {
if (StringUtils.isBlank(regBaseH.getRights())) {
regBaseH.setRights("012");// 只显示有效数据
} else {
regBaseH.setRights(regBaseH.getRights());// 只显示有效数据
}
Page<RegBaseH> page = regBaseHService.findAllPage(new Page<RegBaseH>(request, response), regBaseH);
page.setLength(5);
model.addAttribute("page", page);
model.addAttribute("regBaseH",regBaseH);
return "modules/jy/qlr/jyQlrTodoHookList";
}
@RequestMapping(value = {"hookJy"})
public String hookJy(JyQlr jyQlr, HttpServletRequest request, HttpServletResponse response, Model model) throws ClientProtocolException, IOException {
RegBaseH regBaseH = new RegBaseH();
regBaseH.setBdcdyh(jyQlr.getBdcdyh());
List<RegBaseH> list = regBaseHService.findAllList(regBaseH);
if(list== null || list.size()<=0) {
throw new ServiceException("未找到需要挂接的不动产单元信息");
}
//Page page = jyQlrService.findFwDataPage(new Page<JyQlr>(request, response), jyQlr);
//model.addAttribute("page", page);
//
Page page = new Page<>(request,response);
Map param_data = Maps.newHashMap();
if(!StringUtils.isEmpty(jyQlr.getZl())) {
param_data.put("zl", jyQlr.getZl());
}
if(!StringUtils.isEmpty(jyQlr.getFybh())) {
param_data.put("fybh", jyQlr.getFybh() );
}
if(!StringUtils.isEmpty(jyQlr.getXmmc())) {
param_data.put("xmmc", jyQlr.getXmmc() );
}
if(!StringUtils.isEmpty(jyQlr.getShbw())) {
param_data.put("shbw", jyQlr.getShbw() );
}
if(!StringUtils.isEmpty(jyQlr.getLdjzmj())) {
param_data.put("ldjzmj", jyQlr.getLdjzmj() );
}
if(!StringUtils.isEmpty(jyQlr.getJzwmc())) {
param_data.put("jzwmc", jyQlr.getJzwmc() );
}
if(!StringUtils.isEmpty(jyQlr.getCh())) {
param_data.put("ch", jyQlr.getCh() );
}
if(!StringUtils.isEmpty(jyQlr.getZrzh())) {
param_data.put("zrzh", jyQlr.getZrzh());
}
if(!StringUtils.isEmpty(jyQlr.getDy())) {
param_data.put("dy", jyQlr.getDy() );
}
if(!StringUtils.isEmpty(jyQlr.getQlrmc())) {
param_data.put("qlr", jyQlr.getQlrmc() );
}
if(!StringUtils.isEmpty(jyQlr.getQlrzjhm())) {
param_data.put("qlrzjh", jyQlr.getQlrzjhm() );
}
if(param_data.size() >0) {
param_data.put("Page", page.getPageNo());
param_data.put("rows", page.getPageSize());
Map json = httpactivityService.postRequest(param_data,"queryTradeEstate");
if(json == null) {
return "";
}
String code = json.get("code") == null?"0":json.get("code").toString();
if(!"200".equals(code)){
throw new ServiceException("响应失败,错误信息:"+(json.get("message")) == null?"错误信息未返回":json.get("message").toString());
}
Map res_map = json.get("data") == null?Maps.newHashMap():(Map)json.get("data");
page.setCount(res_map.get("total") == null?0:Long.parseLong(res_map.get("total").toString()));
page.setList(res_map.get("rows") == null?Lists.newArrayList():(List)res_map.get("rows"));
}
model.addAttribute("jyQlr",jyQlr);
model.addAttribute("page", page);
model.addAttribute("regBaseH",list.get(0));
return "modules/jy/qlr/hookJyPage";
}
@RequestMapping(value = "hookSave")
public String hookSave(JyQlr jyQlr, Model model,HttpServletResponse response, RedirectAttributes redirectAttributes) throws ClientProtocolException, IOException {
Map map = new HashMap();
RegBaseH regBaseH = new RegBaseH();
regBaseH.setBdcdyh(jyQlr.getBdcdyh());
regBaseH.setRights("012");
List<RegBaseH> list = regBaseHService.findAllList(regBaseH);
if(list== null || list.size()<=0) {
throw new ServiceException("未找到需要挂接的不动产单元信息");
}
regBaseH = list.get(0);
RegBaseH h = regBaseHService.get(regBaseH.getId());
if(!StringUtils.isEmpty(h.getFybh())){
Map param_data = Maps.newHashMap();
param_data.put("fybh", h.getFybh());
param_data.put("bdcdyh", h.getBdcdyh());
Map json = httpactivityService.postRequest(param_data,"removeHookRelation");
if(json == null) {
return "";
}
String code = json.get("code") == null?"0":json.get("code").toString();
if(!"200".equals(code)){
throw new ServiceException("删除中间库房屋挂接关系失败:"+(json.get("message")) == null?"错误信息未返回":json.get("message").toString());
}
}
h.setFybh(jyQlr.getFybh());
h.setBtfwbm(jyQlr.getFybh());
regBaseHService.save(h);
Map param_data = Maps.newHashMap();
param_data.put("fybh", jyQlr.getFybh());
param_data.put("bdcdyh", jyQlr.getBdcdyh());
Map json = httpactivityService.postRequest(param_data,"saveHookRelation");
if(json == null) {
return "";
}
String code = json.get("code") == null?"0":json.get("code").toString();
if(!"200".equals(code)){
throw new ServiceException("保存中间库房屋挂接关系失败:"+(json.get("message")) == null?"错误信息未返回":json.get("message").toString());
}
param_data = Maps.newHashMap();
param_data.put("bdcdyh", jyQlr.getBdcdyh());
param_data.put("sfcf", "0".equals(h.getIschafeng())?"否":"是");
param_data.put("sfdy", "0".equals(h.getIsdiya())?"否":"是");
param_data.put("sfyy", "0".equals(h.getIsyiyi())?"否":"是");
param_data.put("sfyx", "3".equals(h.getRights())?"否":"是");
json = httpactivityService.postRequest(param_data,"saveHouseStatus");
code = json.get("code") == null?"0":json.get("code").toString();
if(!"200".equals(code)){
throw new ServiceException("推送中间库房屋状态信息失败:"+(json.get("message")) == null?"错误信息未返回":json.get("message").toString());
}
//addMessage(redirectAttributes, "不动产单元号【"+jyQlr.getBdcdyh()+"】与房源编号【"+jyQlr.getFybh()+"】挂接成功");
map.put("state", true);
return renderString(response, map);
}
@RequiresPermissions("jy:qlr:jyQlr:view")
@RequestMapping(value = {"list", ""})
public String list(JyQlr jyQlr, HttpServletRequest request, HttpServletResponse response, Model model) {
Page<JyQlr> page = jyQlrService.findPage(new Page<JyQlr>(request, response), jyQlr);
model.addAttribute("page", page);
return "modules/jy/qlr/jyQlrList";
}
@RequiresPermissions("jy:qlr:jyQlr:view")
@RequestMapping(value = "form")
public String form(JyQlr jyQlr, Model model) {
model.addAttribute("jyQlr", jyQlr);
return "modules/jy/qlr/jyQlrForm";
}
@RequiresPermissions("jy:qlr:jyQlr:edit")
@RequestMapping(value = "save")
public String save(JyQlr jyQlr, Model model, RedirectAttributes redirectAttributes) {
if (!beanValidator(model, jyQlr)){
return form(jyQlr, model);
}
jyQlrService.save(jyQlr);
addMessage(redirectAttributes, "保存交易房屋权利信息成功");
return "redirect:"+Global.getAdminPath()+"/jy/qlr/jyQlr/?repage";
}
@RequiresPermissions("jy:qlr:jyQlr:edit")
@RequestMapping(value = "delete")
public String delete(JyQlr jyQlr, RedirectAttributes redirectAttributes) {
jyQlrService.delete(jyQlr);
addMessage(redirectAttributes, "删除交易房屋权利信息成功");
return "redirect:"+Global.getAdminPath()+"/jy/qlr/jyQlr/?repage";
}
}