1278f1f31471f31c147e662c0bbbacc5df19018e.svn-base
19.1 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
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
package com.thinkgem.jeesite.modules.reg.web.httprest.httpRestController;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import org.activiti.engine.HistoryService;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.ClientProtocolException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.google.common.collect.Maps;
import com.thinkgem.jeesite.common.service.ServiceException;
import com.thinkgem.jeesite.common.utils.DateUtils;
import com.thinkgem.jeesite.common.web.BaseController;
import com.thinkgem.jeesite.modules.act.service.ActProcessService;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBaseZdjbxx;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusBdcqzsdjxx;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusQlr;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusSlsq;
import com.thinkgem.jeesite.modules.reg.entity.bus.YcslSlsq;
import com.thinkgem.jeesite.modules.reg.service.base.RegBaseZdjbxxService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusBdcqzsdjxxService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusCfdjService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusDyaqService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusFdcq1Service;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusFdcq2Service;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusJsydsyqService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusQlrService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusSlsqService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusTdsyqService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusYgdjService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusYwrService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusYydjService;
import com.thinkgem.jeesite.modules.reg.service.bus.YcslSlsqService;
import com.thinkgem.jeesite.modules.reg.utils.RegUtils;
import com.thinkgem.jeesite.modules.reg.web.httprest.httpRestService.DbbwService;
import com.thinkgem.jeesite.modules.reg.web.httprest.httpRestService.HttpactivityService;
import com.thinkgem.jeesite.modules.reg.web.httprest.utils.DatatypeUtil;
import com.thinkgem.jeesite.modules.sys.utils.DictUtils;
import com.thinkgem.jeesite.modules.ycsl.entity.task.YcslTask;
import com.thinkgem.jeesite.modules.ycsl.entity.token.YcslToken;
import com.thinkgem.jeesite.modules.ycsl.entity.xttj.YcslXttj;
import com.thinkgem.jeesite.modules.ycsl.entity.ywbj.YcslYwbj;
import com.thinkgem.jeesite.modules.ycsl.entity.ywzt.YcslYwzt;
import com.thinkgem.jeesite.modules.ycsl.service.task.YcslTaskService;
import com.thinkgem.jeesite.modules.ycsl.service.token.YcslTokenService;
import com.thinkgem.jeesite.modules.ycsl.service.xttj.YcslXttjService;
import com.thinkgem.jeesite.modules.ycsl.service.ywbj.YcslYwbjService;
import com.thinkgem.jeesite.modules.ycsl.service.ywzt.YcslYwztService;
/**
* 一窗受理接口类
*
* @author LENOVO 2018-11-10
*/
@Service
public class HttpRestPush extends BaseController {
@Autowired
private DbbwService dbbwService;
@Autowired
private YcslTaskService YcslTaskService;
@Autowired
private YcslYwztService ycslYwztService;
@Autowired
private YcslTokenService ycslTokenService;
@Autowired
private HttpactivityService httpactivityService;
@Autowired
private YcslXttjService ycslXttjService;
@Autowired
private YcslYwbjService ycslYwbjService;
@Autowired
private RegBusSlsqService regBusSlsqService;
@Autowired
private ActProcessService actProcessService;
@Autowired
private HistoryService historyService;
@Autowired
private RegBusBdcqzsdjxxService regBusBdcqzsdjxxService;
@Autowired
private RegBaseZdjbxxService regBaseZdjbxxService;
@Autowired
private RegBusCfdjService regBusCfdjService;
@Autowired
private RegBusQlrService regBusQlrService;
@Autowired
private RegBusYwrService regBusYwrService;
@Autowired
private RegBusYydjService regBusYydjService;
@Autowired
private RegBusFdcq2Service regBusFdcq2Service;
@Autowired
private RegBusFdcq1Service regBusFdcq1Service;
@Autowired
private RegBusJsydsyqService regBusJsydsyqService;
@Autowired
private RegBusYgdjService regBusYgdjService;
@Autowired
private RegBusDyaqService regBusDyaqService;
@Autowired
private RegBusTdsyqService regBusTdsyqService;
@Autowired
private YcslSlsqService ycslSlsqService;
public void pushDbxx() {
YcslTask task = new YcslTask();
List<YcslTask> tasklst = YcslTaskService.findList(task);
for (YcslTask ycslTask : tasklst) {
ycslTask.setSendbz("1");
YcslTaskService.save(ycslTask);
try {
String msg = pushDataService(ycslTask);
ycslTask.setSendbz("1");
ycslTask.setSendmsg("执行成功:"+msg);
}catch (Exception e) {
ycslTask.setSendbz("0");
ycslTask.setSendmsg("推送一窗失败:"+e.getMessage());
e.printStackTrace();
}
YcslTaskService.save(ycslTask);
}
}
public void pushYwbjxx() {
YcslYwbj ywbj = new YcslYwbj();
ywbj.setSendbjbz("isNull");
List<YcslYwbj> ywbjlst = ycslYwbjService.findList(ywbj);
for (YcslYwbj yw : ywbjlst) {
try {
String msg = pushDataService(yw);
yw.setSendbjbz("1");
yw.setSendbjmsg("执行成功:"+msg);
}catch (Exception e) {
yw.setSendbjbz("0");
yw.setSendbjbz("推送一窗失败:"+e.getMessage());
yw.setErrorbjnum( yw.getErrorbjnum() == null?1: yw.getErrorbjnum()+1);
e.printStackTrace();
}
ycslYwbjService.save(yw);
}
}
public void pushFwzt() {
YcslYwbj ywbj = new YcslYwbj();
ywbj.setSendfwztbz("isNull");
List<YcslYwbj> ywbjlst = ycslYwbjService.findList(ywbj);
for (YcslYwbj yw : ywbjlst) {
try {
Map param_data = Maps.newHashMap();
param_data.put("bdcdyh", yw.getBdcdyh());
param_data.put("sfcf", yw.getSfcf());
param_data.put("sfdy", yw.getSfdy());
param_data.put("sfyy", yw.getSfyy());
param_data.put("sfyx", yw.getSfyx());
Map json = httpactivityService.postRequest(param_data,"saveHouseStatus");
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());
}
yw.setSendfwztbz("1");
yw.setSendfwztmsg("执行成功");
}catch (Exception e) {
yw.setSendfwztbz("0");
yw.setSendfwztbz("推送一窗失败:"+e.getMessage());
yw.setErrorfwztnum( yw.getErrorbjnum() == null?1: yw.getErrorbjnum()+1);
e.printStackTrace();
}
ycslYwbjService.save(yw);
}
}
private String pushDataService(YcslYwbj ywbj) throws ClientProtocolException, IOException {
Map data = Maps.newHashMap();
data.put("bdcdyh",ywbj.getBdcdyh() );
data.put("fybh", ywbj.getFybh());
data.put("bjsj", ywbj.getBjsj());
data.put("proid",ywbj.getProid());
Map json = httpactivityService.postRequest(data,"terminateInfo");
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());
}
return "";
}
public void sendYwzt() {
YcslYwzt ywzt = new YcslYwzt();
List<YcslYwzt> ywztlst = ycslYwztService.findSendList(ywzt);
for (YcslYwzt ycslYwzt : ywztlst) {
try {
String msg =pushDataService(ycslYwzt);
ycslYwzt.setSendbz("1");
ycslYwzt.setSendmsg("执行成功:"+msg);
}catch (Exception e) {
ycslYwzt.setSendbz("0");
ycslYwzt.setSendmsg("推送一窗失败:"+e.getMessage());
e.printStackTrace();
}
ycslYwztService.save(ycslYwzt);
}
}
public void sendSjth() {
YcslXttj xttj = new YcslXttj();
List<YcslXttj> xttjlst = ycslXttjService.findSendList(xttj);
for (YcslXttj ycslXttj : xttjlst) {
try {
String msg = "";
switch (ycslXttj.getTjywzt()) {
case "reg_start":
case "reg_audit":
case "reg_audit3":
case "reg_audit4":
msg =pushDataService(ycslXttj);
break;
case "reg_audit5":
case "reg_audit56":
case "reg_audit6":
case "reg_end":
msg = "";
break;
default:
logger.error("流程状态未知" );
msg = "退件信息流程流程状态未知";
break;
}
ycslXttj.setSendbz("1");
ycslXttj.setSendmsg("执行成功:"+msg);
}catch (Exception e) {
ycslXttj.setSendbz("0");
ycslXttj.setSendmsg("推送一窗失败:"+e.getMessage());
e.printStackTrace();
}
ycslXttjService.save(ycslXttj);
}
}
private String pushDataService(YcslXttj xttj) throws ClientProtocolException, IOException {
Map data = Maps.newHashMap();
//data.put("bdcdyh",xttj.getBdcdyh() );
//data.put("czbz", xttj.getCzbz());
data.put("bhyy", xttj.getYj());
data.put("bhsj", DateUtils.formatDateTime(xttj.getCreateDate()));
data.put("bhr",xttj.getCreateBy().getId());
data.put("ywh", xttj.getProid());
data.put("bhlx", "1");
data.put("qxdm", "3");
Map json = httpactivityService.postRequest(data,"bhSqxx");
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());
}
deleteWWyw(xttj.getYwh());
return "";
}
public void deleteWWyw(String ywh) {
//受理申请
RegBusSlsq regBusSlsq = regBusSlsqService.getByYwh(ywh);
if(regBusSlsq == null || regBusSlsq.getDjxl() == null) {
return;
}
String procInsId = regBusSlsq.getProcInsId();
actProcessService.deleteProcIns(procInsId, "省级代理驳回自动删除");
historyService.deleteHistoricProcessInstance(procInsId);
//判断如果是新增宗地信息的业务,这时需要把新增的宗地也连带删除了
if("201".equals(regBusSlsq.getDjxl()) || "202".equals(regBusSlsq.getDjxl()) || "203".equals(regBusSlsq.getDjxl()) ||
"204".equals(regBusSlsq.getDjxl()) || "208".equals(regBusSlsq.getDjxl())){
RegBusBdcqzsdjxx regBusBdcqzsdjxx = new RegBusBdcqzsdjxx();
regBusBdcqzsdjxx.setYwh(ywh);
List<RegBusBdcqzsdjxx> findList3 = regBusBdcqzsdjxxService.findList(regBusBdcqzsdjxx);
int regBusBdcqzsdjxxCount = findList3.size();
if(regBusBdcqzsdjxxCount>0){
for(int i=0;i<regBusBdcqzsdjxxCount; i++){
regBusBdcqzsdjxx = findList3.get(i);
RegBaseZdjbxx regBaseZdjbxx = new RegBaseZdjbxx();
regBaseZdjbxx.setBdcdyh(regBusBdcqzsdjxx.getBdcdyh());
List<RegBaseZdjbxx> findZdList = regBaseZdjbxxService.findList(regBaseZdjbxx);
if(findZdList.size()>0){
RegBaseZdjbxx regBaseZdjbxx2 = findZdList.get(0);
regBaseZdjbxx2.setIslogout("3");
regBaseZdjbxx2.setIsaudit("1");
regBaseZdjbxxService.save(regBaseZdjbxx2);
//新增宗地基本信息删除,只留下测绘信息
//regBaseZdjbxxService.delete(regBaseZdjbxx2);
}
}
}
}
//权利人、义务人信息表【可能还没有添加,需要判断】
regBusQlrService.deleteywh(ywh);
regBusYwrService.deleteywh(ywh);
//已登记信息表【可能还没有添加,需要判断】
regBusBdcqzsdjxxService.deleteywh(ywh);
//删除ycsl 受理信息
YcslSlsq ycslSlsq = new YcslSlsq();
ycslSlsq.setYwh(regBusSlsq.getProid());
List<YcslSlsq> slsqList = ycslSlsqService.findList(ycslSlsq);
if(slsqList != null && slsqList.size() > 0) {
for (YcslSlsq ycslSlsq2 : slsqList) {
ycslSlsqService.delete(ycslSlsq2);
}
}
//各种权属表8个表【可能还没有添加,需要判断】
regBusFdcq2Service.deleteywh(ywh);
regBusFdcq1Service.deleteywh(ywh);
regBusJsydsyqService.deleteywh(ywh);
regBusYgdjService.deleteywh(ywh);
regBusCfdjService.deleteywh(ywh);
regBusYydjService.deleteywh(ywh);
regBusDyaqService.deleteywh(ywh);
regBusTdsyqService.deleteywh(ywh);
regBusSlsqService.delete(regBusSlsq);
//删除受理申请中附件
RegUtils.deletefjinfo(ywh, regBusSlsq.getFjinfo(), null);
regBusSlsqService.deleteRelationInfo(ywh,regBusSlsq.getDjxl(),null);
}
public void freshToken(String xtid) throws ClientProtocolException, IOException {
Map data = Maps.newHashMap();
data.put("userid",xtid);
Map json = httpactivityService.postRequest(data,"5");
Map reshead = (Map)json.get("head");
Map resdata = (Map)json.get("data");
if(reshead.get("statusCode") == null || !"0000".equals(reshead.get("statusCode").toString())){
throw new ServiceException("响应失败,错误信息:"+(reshead.get("msg")) == null?"错误信息未返回":reshead.get("msg").toString());
}
String tokenkey = DatatypeUtil.getValueByMap(resdata, "token", "");
YcslToken token = new YcslToken();
token.setUserid(xtid);
token.setSyrq(Integer.parseInt(DateUtils.getDate().replaceAll("-", "")));
token.setIsuser("1");
YcslToken dataToken = ycslTokenService.getUserToken(token);
if(dataToken != null && tokenkey.equals(dataToken.getToken())) {
return;
}else {
ycslTokenService.stopToken(token);
}
token.setToken(tokenkey);
ycslTokenService.save(token);
}
private String pushDataService(YcslYwzt ywzt) throws ClientProtocolException, IOException {
Map data = Maps.newHashMap();
data.put("ywh",ywzt.getProid());
data.put("djywh", ywzt.getYwh());
switch (ywzt.getYwzt()) {
case "reg_start":
data.put("step", "ACCEPT");
break;
case "reg_audit":
case "reg_audit3":
data.put("step", "CHECKING");
break;
case "reg_audit4":
data.put("step", "REGISTERING");
break;
case "reg_audit5":
data.put("step", "CERTIFICATING");
break;
case "reg_audit56":
data.put("step", "PAYING");
break;
case "reg_audit6":
data.put("step", "AWARD");
break;
case "reg_end":
data.put("step", "GD");
break;
default:
logger.error("状态推送: 业务号{}流程状态未知",ywzt.getId());
data.put("step", "SUBMIT");
break;
}
Map json = httpactivityService.postRequest(data,"updateYwzt");
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());
}
return "";
}
/**
*登记缮证登薄后将该不动产单元状态推送给一窗
* @throws IOException
* @throws ClientProtocolException
*/
private String pushDataService(YcslTask ycslTask) throws ClientProtocolException, IOException {
Map data = Maps.newHashMap();
switch (ycslTask.getDjxl()) {
case "207":
data = dbbwService.createXml207(ycslTask.getYwh(),ycslTask.getDjxl(),ycslTask.getBdcdyh());
break;
case "302":
data = dbbwService.createXml302(ycslTask.getYwh(),ycslTask.getDjxl(),ycslTask.getBdcdyh());
break;
case "402":
case "403":
case "404":
case "416":
data = dbbwService.createXml402_403_404_416(ycslTask.getYwh(),ycslTask.getDjxl(),ycslTask.getBdcdyh());
break;
case "428":
case "431":
case "213":
case "214":
case "215":
case "316":
case "317":
case "318":
case "433":
case "509":
case "515":
case "606":
case "608":
case "818":
data = dbbwService.createXml428_431_213_214_215_316_317_318_433_509_515_606_608_818(ycslTask.getYwh(),ycslTask.getDjxl(),ycslTask.getBdcdyh());
break;
case "505":
case "506":
data = dbbwService.createXml505(ycslTask.getYwh(),ycslTask.getDjxl(),ycslTask.getBdcdyh());
break;
case "432":
case "510":
case "511":
case "512":
case "513":
case "607":
case "609":
case "803":
case "804":
case "806":
case "807":
case "809":
case "810":
case "811":
case "812":
case "819":
data = dbbwService.createXml803(ycslTask.getYwh(),ycslTask.getDjxl(),ycslTask.getBdcdyh());
break;
case "604":
case "1003":
case "1004":
data = dbbwService.createXml604(ycslTask.getYwh(),ycslTask.getDjxl(),ycslTask.getBdcdyh());
break;
case "703":
case "704":
data = dbbwService.createXml703(ycslTask.getYwh(),ycslTask.getDjxl(),ycslTask.getBdcdyh());
break;
case "902":
case "903":
case "905":
case "906":
case "907":
case "908":
case "910":
case "912":
data = dbbwService.createXml905(ycslTask.getYwh(),ycslTask.getDjxl(),ycslTask.getBdcdyh());
break;
default:
return "登记小类[djlx]" + ycslTask.getDjxl() + "未配置一窗推送";
// break;
}
data.put("proid", ycslTask.getProid());
data.put("fybh", ycslTask.getFybh());
List<RegBusQlr> qlrlst = dbbwService.getQlrByYwh(ycslTask.getYwh());
if (qlrlst == null || qlrlst.size() <= 0) {
throw new ServiceException("系统未找到业务号[ywh]对应的权利人登记信息");
}
String qlrmc ="";
String qlrzjhm ="";
for (int i = 0; i < qlrlst.size(); i++) {
RegBusQlr qlr = qlrlst.get(i);
qlrmc = StringUtils.isEmpty(qlrmc)?qlr.getQlrmc():(qlrmc+";"+qlr.getQlrmc());
qlrzjhm = StringUtils.isEmpty(qlrzjhm)?qlr.getZjh():(qlrzjhm+";"+qlr.getZjh());
}
data.put("qlrmc", qlrmc);
data.put("qlrzjh", qlrzjhm);
data.put("ywlx", DictUtils.getDictLabel( ycslTask.getDjxl(), "reg_bus_djxl", ""));
ycslTask.setXml(DatatypeUtil.getValueByMap(data, "xml", ""));
Map json = httpactivityService.postRequest(data,"sendDb");
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());
}
return "";
}
/**
* 4.1.6 登记系统退件请求
*/
public Map pushDataSjthService(String ywh, String proid,String bj,String comment) {
Map resMap = Maps.newHashMap();
Map data = Maps.newHashMap();
try {
//查询登记信息
RegBusBdcqzsdjxx djxx = new RegBusBdcqzsdjxx();
// List<RegBusBdcqzsdjxx> lst = getDjxxByYwh(ywh,null,null);
// if(lst.size() > 0){
// for(int i=0;i<lst.size();i++){
// djxx = lst.get(i);
// data.put("proid", proid);
// data.put("bdcdyh", djxx.getBdcdyh());
// data.put("czbz", "1");
// data.put("yj",comment);
// }
// }
Map json = httpactivityService.postRequest(data,bj);
Map reshead = (Map)json.get("head");
Map resdata = (Map)json.get("data");
if(reshead.get("regionCode") == null || !"0000".equals(reshead.get("regionCode").toString())){
throw new ServiceException("响应失败,错误信息:"+(reshead.get("msg")) == null?"错误信息未返回":reshead.get("msg").toString());
}
resMap.put("data", data);
} catch (ServiceException ex) {
resMap.put("state", false);
resMap.put("resmsg", "推送一窗失败," + ex.getMessage());
ex.printStackTrace();
} catch (Exception ex) {
resMap.put("state", false);
resMap.put("resmsg", "推送一窗失败,系统错误");
ex.printStackTrace();
}
return resMap;
}
}