9b26917f9ef772824d2fc68f76d5550e1b281ba4.svn-base
15.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
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
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
/**
* Copyright © 2015-2018 <a href="#">J-Site</a> All rights reserved.
*/
package com.thinkgem.jeesite.modules.reg.web.bus;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
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.ui.ModelMap;
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.aliyuncs.exceptions.ClientException;
import com.aliyuncs.exceptions.ServerException;
import com.thinkgem.jeesite.common.config.Global;
import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.utils.DateUtils;
import com.thinkgem.jeesite.common.utils.StringUtils;
import com.thinkgem.jeesite.common.web.BaseController;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBasePerson;
import com.thinkgem.jeesite.modules.reg.entity.bus.Kc01;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusBdcqzsdjxx;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusQlr;
import com.thinkgem.jeesite.modules.reg.service.bus.Kc01Service;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusBdcqzsdjxxService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusQlrService;
import com.thinkgem.jeesite.modules.sys.entity.Dict;
import com.thinkgem.jeesite.modules.sys.entity.Office;
import com.thinkgem.jeesite.modules.sys.entity.User;
import com.thinkgem.jeesite.modules.sys.service.DictService;
import com.thinkgem.jeesite.modules.sys.service.OfficeService;
import com.thinkgem.jeesite.modules.sys.utils.DictUtils;
import com.thinkgem.jeesite.modules.sys.utils.UserUtils;
/**
* 网点信息查询Controller
* @author wb
* @version 2018-07-12
*/
@Controller
@RequestMapping(value = "${adminPath}/reg/bus/kc01")
public class Kc01Controller extends BaseController {
@Autowired
private Kc01Service kc01Service;
@Autowired
private OfficeService officeService;
@Autowired
private RegBusBdcqzsdjxxService regBusBdcqzsdjxxService;
@Autowired
private RegBusQlrService regBusQlrService;
@Autowired
private DictService dictService;
@ModelAttribute
public Kc01 get(@RequestParam(required=false) String id) {
Kc01 entity = null;
if (StringUtils.isNotBlank(id)){
entity = kc01Service.get(id);
}
if (entity == null){
entity = new Kc01();
}
return entity;
}
@RequiresPermissions("reg:bus:kc01:view")
@RequestMapping(value = {"list", ""})
public String list(Kc01 kc01, HttpServletRequest request, HttpServletResponse response, Model model) {
User user = UserUtils.getUser();
Office office = officeService.get(user.getCurrentUser().getOffice().getId());
String officeCode = office.getCode();
if(officeCode.contains("S00009009009999")){
kc01.setAkc006(user.getId());
}
Page<Kc01> page = kc01Service.findPage(new Page<Kc01>(request, response), kc01);
model.addAttribute("page", page);
model.addAttribute("officeCode",officeCode);
model.addAttribute("kc01",kc01);
//判断如果是点击右下角弹框则全部设置成已读
if(officeCode.contains("S00009009009999")){
if(StringUtils.isNotBlank(request.getParameter("dj"))){
Kc01 kc01info = new Kc01();
kc01info.setAkc006(user.getId());
kc01info.setAkc015("0");
kc01info.setAkc008("13");
List<Kc01> kc01list = kc01Service.findList(kc01info);
if(kc01list.size() > 0){
for(int i=0;i<kc01list.size();i++){
kc01info = kc01list.get(i);
kc01info.setAkc015("1");
kc01Service.save(kc01info);
}
}
}
}
return "modules/reg/bus/kc01List";
}
@RequiresPermissions("reg:bus:kc01:view")
@RequestMapping(value = "form")
public String form(Kc01 kc01, Model model,HttpServletRequest request) {
String ids = request.getParameter("id");
User user = UserUtils.getUser();
Office office = officeService.get(user.getCurrentUser().getOffice().getId());
String officeCode = office.getCode();
if(StringUtils.isNotBlank(request.getParameter("update"))){
kc01 = kc01Service.get(ids);
kc01.setAkc014(DictUtils.getDictValue(user.getLoginName(), "yhmc", ""));
model.addAttribute("update","1");
model.addAttribute("ids",ids);
}else{
kc01.setAkc014(DictUtils.getDictValue(user.getLoginName(), "yhmc", ""));
kc01.setAkc008("0");
}
if(StringUtils.isNotBlank(request.getParameter("view"))){
kc01 = kc01Service.get(ids);
model.addAttribute("view","1");
}
model.addAttribute("officeCode",officeCode);
model.addAttribute("kc01",kc01);
return "modules/reg/bus/kc01Form";
}
@RequiresPermissions("reg:bus:kc01:edit")
@RequestMapping(value = "save")
public String save(Kc01 kc01, Model model, RedirectAttributes redirectAttributes,HttpServletRequest request) {
//获取机构和用户id
System.out.println(request.getParameter("update"));
User user = UserUtils.getUser();
String akc017 ="";
if(kc01.getAkc017().equals("0")){
akc017 = "权";
}else if(kc01.getAkc017().equals("1")){
akc017 = "证明";
}
if(StringUtils.isBlank(request.getParameter("update"))){
kc01.setAkc007("0");
kc01.setAkc006(user.getId());
kc01.setAkc008("0");
kc01.setAkc009(user.getCurrentUser().getOffice().getId());
kc01.setAkc010(user.getId());
kc01.setAkc011(new Date());
kc01.setAkc013(new Date());
kc01.setAkc015("0");
Map<String,Object> map = new HashMap<String,Object>();
if(StringUtils.isBlank(kc01.getAkc016())){
map.put("akc016","NOTNULL");
}else{
map.put("akc016", kc01.getAkc016());
}
map.put("akc017", akc017);
map.put("akc018", kc01.getAkc018());
List<RegBusBdcqzsdjxx> busBdcqzsdjxxlist = regBusBdcqzsdjxxService.getkc01(map);
if(busBdcqzsdjxxlist.size() >0){
RegBusBdcqzsdjxx busBdcqzsdjxx = busBdcqzsdjxxlist.get(0);
kc01.setAkc003(busBdcqzsdjxx.getBdcqzh());
kc01.setAkc004(busBdcqzsdjxx.getQlrmc());
kc01.setAkc005(busBdcqzsdjxx.getZl());
kc01.setAkc002(busBdcqzsdjxx.getBdcdyh());
kc01Service.save(kc01);
}else{
addMessage(redirectAttributes, "该证号信息在系统中不存在,保存未成功!");
}
}else{
Map<String,Object> mapnew = new HashMap<String,Object>();
if(StringUtils.isNotBlank(kc01.getAkc016())){
mapnew.put("akc016", kc01.getAkc016());
}
mapnew.put("akc017", akc017);
mapnew.put("akc018", kc01.getAkc018());
List<RegBusBdcqzsdjxx> busBdcqzsdjxxnewlist = regBusBdcqzsdjxxService.getkc01(mapnew);
if(busBdcqzsdjxxnewlist.size()>0){
RegBusBdcqzsdjxx busBdcqzsdjxxnew = busBdcqzsdjxxnewlist.get(0);
kc01.setAkc003(busBdcqzsdjxxnew.getBdcqzh());
kc01.setAkc013(new Date());
kc01Service.save(kc01);
addMessage(redirectAttributes, "保存网点信息成功");
}else{
addMessage(redirectAttributes, "该证号信息在系统中不存在,保存未成功!");
}
}
return "redirect:"+Global.getAdminPath()+"/reg/bus/kc01/?repage";
}
/**
* 银行网点信息查询审核
* @param kc01
* @param model
* @param redirectAttributes
* @param request
* @return
*/
@RequiresPermissions("reg:bus:kc01:edit")
@RequestMapping(value = "audit")
@ResponseBody
public ModelMap audit(HttpServletRequest request) {
ModelMap modelMap = new ModelMap();
modelMap.put("success", "0");
try{
String ids = request.getParameter("ids");
Kc01 kc01 = kc01Service.get(ids);
//查询登记信息
RegBusBdcqzsdjxx djxx = new RegBusBdcqzsdjxx();
djxx.setBdcqzh(kc01.getAkc003());
List<RegBusBdcqzsdjxx> djxxlist = regBusBdcqzsdjxxService.findfdList(djxx);
if(djxxlist.size() > 0 ){
djxx = djxxlist.get(0);
//查询权利人
String qlrmc = "";
RegBusQlr qlr = new RegBusQlr();
qlr.setYwh(djxx.getYwh());
List<RegBusQlr> qlrlist = regBusQlrService.findList_1(qlr);
if(qlrlist.size() > 0){
for(int i=0;i<qlrlist.size();i++){
qlrmc += qlrlist.get(i).getQlrmc()+"; ";
}
kc01.setAkc004(qlrmc);
}
kc01.setAkc005(djxx.getZl());
kc01.setAkc003(djxx.getBdcqzh());
kc01.setAkc002(djxx.getBdcdyh());
//查询该银行最大顺序号
String sxh = "";
Kc01 kc01sxh = new Kc01();
kc01sxh.setAkc014(kc01.getAkc014());
sxh = kc01Service.getyhsxh(kc01sxh);
sxh = getStrNum(sxh);
kc01.setAkc012(sxh);
kc01.setAkc008("1");
kc01.setAkc013(new Date());
kc01Service.save(kc01);
modelMap.put("success", "0");
}else{
modelMap.put("success", "1");
modelMap.put("msg", "该权证号信息在系统中不存在,不能进行审核,请联系管理员!");
}
}catch(Exception e){
e.printStackTrace();
modelMap.put("success", "1");
}
return modelMap;
}
/**
* 银行网点信息查询审核不通过
* @param kc01
* @param model
* @param redirectAttributes
* @param request
* @return
*/
@RequiresPermissions("reg:bus:kc01:edit")
@RequestMapping(value = "unaudit")
@ResponseBody
public ModelMap unaudit(HttpServletRequest request) {
ModelMap modelMap = new ModelMap();
modelMap.put("success", "0");
try{
String ids = request.getParameter("ids");
Kc01 kc01 = kc01Service.get(ids);
kc01.setAkc008("3");
kc01Service.save(kc01);
}catch(Exception e){
e.printStackTrace();
modelMap.put("success", "1");
}
return modelMap;
}
/**
* 银行网点信息查询审核不通过
* @param kc01
* @param model
* @param redirectAttributes
* @param request
* @return
*/
@RequiresPermissions("reg:bus:kc01:edit")
@RequestMapping(value = "caudit")
@ResponseBody
public ModelMap caudit(HttpServletRequest request) {
ModelMap modelMap = new ModelMap();
modelMap.put("success", "0");
try{
String ids = request.getParameter("ids");
Kc01 kc01 = kc01Service.get(ids);
kc01.setAkc008("0");
kc01Service.save(kc01);
}catch(Exception e){
e.printStackTrace();
modelMap.put("success", "1");
}
return modelMap;
}
/**
* 运算顺序号
* @param zh
* @return
*/
public static String getStrNum(String sxh) {
if(StringUtils.isBlank(sxh)){
return "0001";
}
String retStr = "";
if(StringUtils.isNotBlank(sxh)){
int nextSerNum = Integer.parseInt(sxh) + 1;
if (nextSerNum < 10) {
retStr = "000" + nextSerNum;
}else if (nextSerNum < 100) {
retStr = "00" + nextSerNum;
}else if (nextSerNum < 1000) {
retStr = "0" + nextSerNum;
}else{
retStr = nextSerNum +"";
}
}
return retStr;
}
@RequiresPermissions("reg:bus:kc01:edit")
@RequestMapping(value = "delete")
public String delete(Kc01 kc01, RedirectAttributes redirectAttributes) {
kc01Service.delete(kc01);
addMessage(redirectAttributes, "删除网点信息成功");
return "redirect:"+Global.getAdminPath()+"/reg/bus/kc01/list";
}
/**
* 银行网点信息查询推送
* @param request
* @return
*/
@RequiresPermissions("reg:bus:kc01:view")
@RequestMapping(value = "queryinfory")
@ResponseBody
public ModelMap queryinfory(HttpServletRequest request) {
//获取机构和用户id
User user = UserUtils.getUser();
Office office = officeService.get(user.getCurrentUser().getOffice().getId());
String officeCode = office.getCode();
ModelMap modelMap = new ModelMap();
modelMap.put("success", "0");
List<Kc01> list = null;
Kc01 kc01 = new Kc01();
//如果是银行网点查询,则只查询kc01表中isaudit字段为已审核的信息
if(officeCode.contains("S00009009009999")){
kc01.setAkc008("13");
kc01.setAkc009(office.getId());
kc01.setAkc015("0");
list = kc01Service.findList(kc01);
}
//如果是市局审核,则只查询kc01表中isaudit字段为未审核的信息
else if(officeCode.contains("S00001001888")){
kc01.setAkc008("0");
list = kc01Service.findList(kc01);
}
if(list !=null && list.size() > 0){
modelMap.put("success", "0");
}else{
modelMap.put("success", "1");
}
return modelMap;
}
/**
* 银行网点信息查询业务办理验证
* @param request
* @return
*/
@RequiresPermissions("reg:bus:kc01:view")
@RequestMapping(value = "slsqqueryinfory")
@ResponseBody
public ModelMap slsqqueryinfory(HttpServletRequest request) {
String akc003 = request.getParameter("akc003");
//获取机构和用户id
User user = UserUtils.getUser();
Office office = officeService.get(user.getCurrentUser().getOffice().getId());
String officeCode = office.getCode();
ModelMap modelMap = new ModelMap();
modelMap.put("success", "0");
Kc01 kc01 = new Kc01();
kc01.setAkc008("1");
kc01.setAkc003(akc003);
List<Kc01> list = kc01Service.findList(kc01);
if(list.size() > 0){
modelMap.put("success", "0");
}else{
modelMap.put("success", "1");
}
return modelMap;
}
/**
* 银行网点信息查询业务办理验证
* @param request
* @return
*/
@RequiresPermissions("reg:bus:kc01:view")
@RequestMapping(value = "printzmdy")
public String printzmdy(HttpServletRequest request,Model model) {
String ids = request.getParameter("ids");
Kc01 kc01 = kc01Service.get(ids);
//获取当前时间
String time = DateUtils.formatDate( new Date(), "yyyy年MM月dd日");
//放数据
Map<String, String> map = new HashMap<String, String>();
map.put("qlrmc", kc01.getAkc004());
map.put("zl", kc01.getAkc005());
map.put("cqzh", kc01.getAkc003());
map.put("shzt", kc01.getAkc008());
map.put("year", time.substring(0, 4));
map.put("time", time);
map.put("sxh", kc01.getAkc014()+kc01.getAkc012());
model.addAttribute("mapinfo", map);
return "modules/reg/bus/kc01Card";
}
/**
* 项目小区导入模板下载
* @param request
* @param response
* @return
*/
@RequestMapping(value = "download")
public String download(HttpServletRequest request,HttpServletResponse response, Model model){
response.setCharacterEncoding("UTF-8");
String filepath = "D:" + File.separator + "download" + File.separator + "install_lodop32.exe";
if (filepath != null) {
OutputStream os = null;
FileInputStream fis = null;
try {
String file = filepath;
if (!(new File(file)).exists()) {
model.addAttribute("msg", "没有找到下载源文件。");
return "modules/reg/bus/kc01List";
}
String filename = file.substring(file.lastIndexOf(File.separator)+1);
os = response.getOutputStream();
response.setHeader("content-disposition", "attachment;filename=" + new String(filename.getBytes("GBK"), "ISO-8859-1"));
response.setContentType("application/octet-stream");//八进制流 与文件类型无关
byte temp[] = new byte[1024];
fis = new FileInputStream(file);
int n = 0;
while ((n = fis.read(temp)) != -1) {
os.write(temp, 0, n);
}
os.flush();
} catch (IOException e) {
model.addAttribute("msg", "出错了,请稍后重试。");
return "modules/reg/base/regBaseXmImport";
} finally {
if (os != null){
try {
os.close();
} catch (IOException e) {
System.out.println("输出流关闭异常");
model.addAttribute("msg", "出错了,请稍后重试。");
return "modules/reg/base/regBaseXmImport";
}
}
if (fis != null){
try {
fis.close();
} catch (IOException e) {
System.out.println("输入流关闭异常");
model.addAttribute("msg", "出错了,请稍后重试。");
return "modules/reg/base/regBaseXmImport";
}
}
}
}
return "modules/reg/bus/kc01List";
}
}