EciServiceImpl.java
32.5 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
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
package com.pashanhoo.qys.service.impl;
import cn.hutool.core.util.ArrayUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.zxing.EncodeHintType;
import com.pashanhoo.common.EciHttpUtil;
import com.pashanhoo.common.Result;
import com.pashanhoo.qys.entity.ElecLicenseInfoDo;
import com.pashanhoo.qys.mapper.ElecLicenseInfoMapper;
import com.pashanhoo.qys.service.EciService;
import com.pashanhoo.qys.service.SysFileService;
import com.pashanhoo.zhj.mapper.RegBusBdcqzsdjxxMapper;
import net.glxn.qrgen.core.image.ImageType;
import net.glxn.qrgen.javase.QRCode;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils;
import org.ofdrw.converter.ImageMaker;
import org.ofdrw.reader.OFDReader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.*;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.SimpleDateFormat;
import java.util.*;
@Service
public class EciServiceImpl extends ServiceImpl<ElecLicenseInfoMapper, ElecLicenseInfoDo> implements EciService {
private static Logger logger = LoggerFactory.getLogger(EciServiceImpl.class);
@Value("${app.hostUrl}")
private String hostUrl;
@Value("${app.bdcdjzmlc}")
private String bdcdjzmlc;
@Value("${app.bdcqzslc}")
private String bdcqzslc;
@Value("${app.areacode}")
private String areacode;
@Value("${app.eciPath}")
private String eciPath;
@Autowired
private RegBusBdcqzsdjxxMapper regBusBdcqzsdjxxMapper;
@Autowired
private ElecLicenseInfoMapper elecLicenseInfoMapper;
@Autowired
private EciHttpUtil eciHttpUtil;
@Autowired
private SysFileService sysFileService;
@Override
public void accessCreateContract() {
try{
List<Map> list=assemblyInfo();
if(list!=null && list.size()>0){
for (int i = 0; i < list.size(); i++) {
//=========创建合同t==============
ElecLicenseInfoDo elecLicenseInfo=createContract(list.get(i));
if(null==elecLicenseInfo || !"0".equals(elecLicenseInfo.getErr_state())){
continue;
}
//=========合同详情==============
ElecLicenseInfoDo details=accessDetails(elecLicenseInfo);
if(null==details || !"0".equals(details.getErr_state())){
continue;
}
//=========证照下载==============
ElecLicenseInfoDo download=accessDownload(details);
if(null==download || !"0".equals(download.getErr_state())){
continue;
}
//=========ofd转换==============
ElecLicenseInfoDo ofdzh=convertElec(download);
if(null==ofdzh || !"0".equals(ofdzh.getErr_state())){
continue;
}
//修改电子证书标识
elecLicenseInfoMapper.updateEciInfo(ofdzh.getBizId());
}
}
}catch (Exception ex){
ex.printStackTrace();
}
}
@Override
public Result createContractForHandle(String zsbs, String qlrzjh, String bh) {
List<Map> list=createInfoByHandle(zsbs,qlrzjh,bh);
if(list!=null && list.size()>0){
for (int i = 0; i < list.size(); i++) {
createContract(list.get(i));
}
}
return Result.ok();
}
@Override
public Result accessDetailsForHandle(String biz_id) {
ElecLicenseInfoDo elecLicenseInfoDo=this.getById(biz_id);
if(elecLicenseInfoDo!=null){
accessDetails(elecLicenseInfoDo);
}
return Result.ok();
}
@Override
public Result accessDownloadForHandle(String biz_id) {
ElecLicenseInfoDo elecLicenseInfoDo=this.getById(biz_id);
if(elecLicenseInfoDo!=null){
accessDownload(elecLicenseInfoDo);
}
return Result.ok();
}
@Override
public Result convertElecForHandle(String biz_id) {
ElecLicenseInfoDo elecLicenseInfoDo=this.getById(biz_id);
if(elecLicenseInfoDo!=null){
convertElec(elecLicenseInfoDo);
elecLicenseInfoMapper.updateEciInfo(biz_id);
}
return Result.ok();
}
/**
*插入电子证照表记录
* @param tjcs
* @param documentParam
* @param backjson
* @param jbxxmap
*/
public ElecLicenseInfoDo insertEciInfo(String tjcs,String documentParam, Map backjson,Map jbxxmap){
ElecLicenseInfoDo elecLicenseInfoDo=new ElecLicenseInfoDo();
elecLicenseInfoDo.setTjcs(tjcs);
elecLicenseInfoDo.setDocumentParam(documentParam);
elecLicenseInfoDo.setZsbh((String) jbxxmap.get("BH"));
elecLicenseInfoDo.setQlrmc((String) jbxxmap.get("QLRMC"));
elecLicenseInfoDo.setZjh((String) jbxxmap.get("ZJH"));
if(backjson.isEmpty()){
elecLicenseInfoDo.setErr_state("1");
}else{
if ((Integer)backjson.get("code")==0) {
Long contractId = Long.valueOf((String) backjson.get("contractId"));
//合同ID入库
elecLicenseInfoDo.setContractId(contractId);
elecLicenseInfoDo.setErr_state("0");
if("207".equals(jbxxmap.get("DJLX"))){
regBusBdcqzsdjxxMapper.updateBdcqzsjbxxInfoByYwh((String) jbxxmap.get("YWH"));
}else{
regBusBdcqzsdjxxMapper.updateBdcqzsjbxxInfo((String) jbxxmap.get("ID"));
}
}else{
elecLicenseInfoDo.setErr_state("1");
}
}
elecLicenseInfoDo.setYwh((String) jbxxmap.get("YWH"));
if(((String)jbxxmap.get("BDCQZH")).contains("证明")){
elecLicenseInfoDo.setHtlx("1");
}else{
elecLicenseInfoDo.setHtlx("2");
}
elecLicenseInfoDo.setZsbs((String) jbxxmap.get("ID"));
elecLicenseInfoDo.setEwmimage(getImage((String) jbxxmap.get("ID"),(String) jbxxmap.get("QLRMC"),(String) jbxxmap.get("ZJH")));
//返回结果入库
elecLicenseInfoDo.setFhjg(JSON.toJSONString(backjson));
//未下载
elecLicenseInfoDo.setSfxz("2");
//未转换
elecLicenseInfoDo.setSfzh("2");
this.save(elecLicenseInfoDo);
return elecLicenseInfoDo;
}
/**
*修改电子证照表记录
* @param tjcs
* @param documentParam
* @param backjson
* @param
*/
public ElecLicenseInfoDo updateEciInfo(String tjcs,String documentParam, Map backjson,ElecLicenseInfoDo elecLicenseInfoDo){
elecLicenseInfoDo.setTjcs(tjcs);
elecLicenseInfoDo.setDocumentParam(documentParam);
if(backjson.isEmpty()){
elecLicenseInfoDo.setErr_state("1");
}else{
if ((Integer)backjson.get("code")==0) {
Long contractId = Long.valueOf((String) backjson.get("contractId"));
//合同ID入库
elecLicenseInfoDo.setContractId(contractId);
elecLicenseInfoDo.setErr_state("0");
regBusBdcqzsdjxxMapper.updateBdcqzsjbxxInfo(elecLicenseInfoDo.getZsbs());
}else{
elecLicenseInfoDo.setErr_state("1");
}
}
//返回结果入库
elecLicenseInfoDo.setFhjg(JSON.toJSONString(backjson));
//未下载
elecLicenseInfoDo.setSfxz("2");
//未转换
elecLicenseInfoDo.setSfzh("2");
this.updateById(elecLicenseInfoDo);
return elecLicenseInfoDo;
}
/**
* 生成文件流
* @param jbxxId
* @return
*/
public byte[] getImage(String jbxxId,String qlr,String zjh){
byte[] data=null;
try{
String imageurl="https://www.hzbdcdj.com/api?scene="+jbxxId+"&qlr="+ URLEncoder.encode(qlr,"UTF-8")+"&zjh="+zjh;
logger.info("55555555============"+imageurl);
ByteArrayOutputStream out= QRCode.from(imageurl).withHint(EncodeHintType.MARGIN, 0).to(ImageType.PNG).withSize(240, 240).stream();
data = out.toByteArray();
}catch (Exception ex){
ex.printStackTrace();
}
return data;
}
/**
* 根据基本信息id生成二维码图片加密字符串
* @param jbxxId
* @return
*/
public String getBase64ewm(String jbxxId,String qlr,String zjh){
byte[] data=getImage(jbxxId,qlr,zjh);
String base64ewm =Base64.encodeBase64String(data);
return base64ewm;
}
/**
* 创建合同
* @param map
*/
public ElecLicenseInfoDo createContract(Map map){
String url=hostUrl + "/contract/createbycategory";
ElecLicenseInfoDo elecLicenseInfo=null;
try{
String ywh = (String) map.get("YWH");
Map jsonMap = new HashMap();
jsonMap.put("sn", ywh);
jsonMap.put("send", "true");
jsonMap.put("creatorName", "");
jsonMap.put("creatorContact", "");
jsonMap.put("tenantName", "汉中市不动产登记交易服务中心");
String zsbh= (String) map.get("BH");//去掉汉字的证书编号,数字组合
Map<String, String> documentMap = new HashMap<String, String>();
String bdcqzh = (String) map.get("BDCQZH");
if (bdcqzh.contains("证明")) {
jsonMap.put("subject", "不动产登记证明");
jsonMap.put("categoryId", bdcdjzmlc);
List<String> ywrmcList=elecLicenseInfoMapper.getYwrMcByCOnditon(ywh,(String) map.get("BDCDYH"));
documentMap.put("bdczmh", zsbh);
documentMap.put("zmqlhsx",getzmsx((String) map.get("DJLX"),(String) map.get("BDCDYH")));
documentMap.put("ywr", StringUtils.join(ywrmcList.toArray(), ","));
documentMap.put("qt", map.get("QT")==null ? "无": (String) map.get("QT"));
} else {
jsonMap.put("subject", "不动产登记证书");
jsonMap.put("categoryId", bdcqzslc);
documentMap.put("bdcqzh",zsbh);
if("2".equals(map.get("GYFS"))){
documentMap.put("gyqk", map.get("GYQK")==null ? "": map.get("GYQK")+"比例:"+map.get("QLBL")+"%");
}else{
documentMap.put("gyqk", map.get("GYQK")==null ? "": (String) map.get("GYQK"));
}
documentMap.put("qllx", map.get("QLLX")==null ? "": (String) map.get("QLLX"));
documentMap.put("qlxz", map.get("QLXZ")==null ? "": (String) map.get("QLXZ"));
documentMap.put("yt", map.get("YT")==null ? "": (String) map.get("YT"));
documentMap.put("mj", map.get("MJ")==null ? "0"+"㎡": map.get("MJ")+"㎡");
documentMap.put("syqx", map.get("SYQX")==null ? "": (String) map.get("SYQX"));
documentMap.put("qlqtzk", map.get("QLQTZK")==null ? "": (String) map.get("QLQTZK"));
}
List list2 = new ArrayList();
Map map2 = new HashMap();
map2.put("type", "CORPORATE");
map2.put("name", "汉中市不动产登记交易服务中心");
map2.put("serialNo", "1");
list2.add(map2);
List list1 = new ArrayList();
Map map1 = new HashMap();
map1.put("tenantType", "CORPORATE");
map1.put("tenantName", "汉中市不动产登记交易服务中心");
map1.put("serialNo", "1");
map1.put("actions", list2);
list1.add(map1);
jsonMap.put("signatories", list1);
documentMap.put("djsj", map.get("Y")==null ? "":(String) map.get("Y"));
documentMap.put("y", map.get("Y")==null ? "":(String) map.get("Y"));
documentMap.put("m", map.get("M")==null ? "":(String) map.get("M"));
documentMap.put("d", map.get("D")==null ? "":(String) map.get("D"));
documentMap.put("qlr", map.get("QLRMC")==null ? "":(String) map.get("QLRMC"));
documentMap.put("zl", map.get("ZL")==null ? "":(String) map.get("ZL"));
documentMap.put("bdcdyh", map.get("BDCDYH")==null ? "":(String) map.get("BDCDYH"));
if(map.get("FJ")!=null){
documentMap.put("fj", "业务号:"+ywh+";"+map.get("FJ"));
}else{
documentMap.put("fj", "业务号:"+ywh+";");
}
documentMap.put("qx", "汉台区");
String base64ewm =getBase64ewm((String) map.get("ID"),(String) map.get("QLRMC"),(String) map.get("ZJH"));
Map ewmMap = new HashMap();
ewmMap.put("fileName", map.get("ID")+".png");
ewmMap.put("value", "data:image/png;base64,"+base64ewm);
documentMap.put("ewm", JSON.toJSONString(ewmMap));
List<Map> arryList = new ArrayList<Map>();
for (Map.Entry<String, String> entry : documentMap.entrySet()) {
convert(arryList, entry.getKey(), entry.getValue());
}
jsonMap.put("documentParams", arryList);
String inparam=JSON.toJSONString(jsonMap);
Map jsonObject =eciHttpUtil.doPostForNew(url, inparam);
elecLicenseInfo =new ElecLicenseInfoDo();
elecLicenseInfo.setYwh((String) map.get("YWH"));
elecLicenseInfo.setZsbs((String) map.get("ID"));
elecLicenseInfo.setZsbh(zsbh);
elecLicenseInfo.setZjh((String) map.get("ZJH"));
elecLicenseInfo =elecLicenseInfoMapper.getElecLicenseInfo(elecLicenseInfo);
if(elecLicenseInfo==null){
//电子证照表记录
elecLicenseInfo=insertEciInfo(inparam,JSON.toJSONString(documentMap),jsonObject,map);
}else{
elecLicenseInfo=updateEciInfo(inparam,JSON.toJSONString(documentMap),jsonObject,elecLicenseInfo);
}
}catch (Exception ex){
ex.printStackTrace();
}
return elecLicenseInfo;
}
public void convert(List arryList,String name,String value){
Map map=new HashMap();
map.put("name",name);
map.put("value",value);
arryList.add(map);
}
public ElecLicenseInfoDo accessDetails(ElecLicenseInfoDo waitForDetail) {
ElecLicenseInfoDo elecLicenseInfoDo=null;
try {
Long contractId = waitForDetail.getContractId();
String url = hostUrl+ "/contract/detail?contractId=" + contractId;
logger.info("请求合同详情接口url:" + url);
Map jsonObject = eciHttpUtil.doGetForNew(url);
if(jsonObject.isEmpty()){
waitForDetail.setErr_state("2");
}else{
Integer code = (Integer) jsonObject.get("code");
logger.info("合同详情接口请求结果:" + jsonObject);
if (code==0) {
Map obj1= (Map) jsonObject.get("contract");
List list= (List) obj1.get("documents");
Map map= (Map) list.get(0);
waitForDetail.setErr_state("0");
waitForDetail.setDocumentId((String) map.get("id"));
}else{
waitForDetail.setErr_state("2");
}
}
//文档ID入库
this.updateById(waitForDetail);
elecLicenseInfoDo=waitForDetail;
} catch (Exception e) {
e.printStackTrace();
}
return elecLicenseInfoDo;
}
/**
* 下载合同方法
* @return
*/
public ElecLicenseInfoDo accessDownload(ElecLicenseInfoDo waitForDownload) {
ElecLicenseInfoDo downloadInfo=null;
try{
String documentId = waitForDownload.getDocumentId();
String bh=waitForDownload.getZsbh();
String htlx=waitForDownload.getHtlx();
String backUrl[] = eciHttpUtil.download(documentId,bh,htlx,areacode);
if (ArrayUtil.isNotEmpty(backUrl)) {
//入库ofd文件地址
waitForDownload.setSfxz("1");
waitForDownload.setOfdWjdz(backUrl[0]);
if(backUrl.length>1){
waitForDownload.setMinio_ofd_url(backUrl[1]);
}
waitForDownload.setErr_state("0");
}else{
waitForDownload.setErr_state("3");
}
this.updateById(waitForDownload);
downloadInfo=waitForDownload;
}catch (Exception ex){
ex.printStackTrace();
}
return downloadInfo;
}
public ElecLicenseInfoDo convertElec(ElecLicenseInfoDo waitForConvert) {
//转换后文件输出路径
ElecLicenseInfoDo convert=null;
try {
String ofdPath = waitForConvert.getOfdWjdz();
String id=waitForConvert.getDocumentId();
String bh=waitForConvert.getZsbh();
String htlx=waitForConvert.getHtlx();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy");
String dateDir = simpleDateFormat.format(new Date());
String url=ofdToImg(ofdPath,eciPath+"ECI\\"+areacode+"\\"+ htlx+dateDir+bh+"\\",id);
if(StringUtils.isNotBlank(url)){
InputStream imageStream=new FileInputStream(new File(url));
MultipartFile multipartFile = new MockMultipartFile(
"File", id+ImageType.JPG,
"text/plain",
imageStream);
String miniofilePath=areacode+"/"+ htlx+dateDir+bh+"/"+id+".jpg";
String minioPath=sysFileService.uploadFileMinio(multipartFile,miniofilePath);
waitForConvert.setMinio_jpg_url(minioPath);
waitForConvert.setSfzh("1");
waitForConvert.setJpgWjdz(url);
waitForConvert.setErr_state("0");
}else{
waitForConvert.setErr_state("4");
}
this.updateById(waitForConvert);
convert=waitForConvert;
} catch (Exception e) {
e.printStackTrace();
}
return convert;
}
/**
* 将ofd转换为图片
* @param
* @param imgPath 目标文件路径
*/
public String ofdToImg(String ofdPath, String imgPath,String id) {
File savePath = new File(imgPath);
if (!savePath.exists()) {
savePath.mkdirs();
}
// 1. 文件输入路径
Path src = Paths.get(ofdPath);
// 2. 加载指定目录字体(非必须)
// FontLoader.getInstance().scanFontDir(new File("src/test/resources/fonts"));
// 3. 创建转换转换对象,设置 每毫米像素数量(Pixels per millimeter)
try(OFDReader reader = new OFDReader(src);) {
ImageMaker imageMaker = new ImageMaker(reader, 15);
for (int i = 0; i < imageMaker.pageSize(); i++) {
// 4. 指定页码转换图片
BufferedImage image = imageMaker.makePage(i);
Path dist = Paths.get( imgPath+ id + ".jpg");
// 5. 存储为指定格式图片
ImageIO.write(image, "JPG", dist.toFile());
return imgPath + id + ".jpg";
}
} catch (IOException e) {
e.printStackTrace();
}
return "";
}
/**
*根据缮证类型决定生成对应的权利相关信息
*/
public List<Map> assemblyInfo(){
List<Map> oldlist=regBusBdcqzsdjxxMapper.getBdcqzsjbxxInfo();
List<Map> list=new ArrayList<Map>();
if(oldlist!=null && oldlist.size()>0) {
for (int i = 0; i < oldlist.size(); i++) {
Map map = oldlist.get(i);
if ("207".equals(map.get("DJLX"))) {
Map firstmap = AssemblyFirstRegist(map);
list.add(firstmap);
continue;
}
String bh = (String) map.get("BH");
String zsbh[] = bh.split(",");
if (zsbh != null && zsbh.length > 0) {
String qlqtzk = (String) map.get("QLQTZK");
Map qrlInfoMap = regBusBdcqzsdjxxMapper.getQlrInfoByYwh((String) map.get("YWH"));
if (qrlInfoMap != null) {
String allQlrmc = (String) qrlInfoMap.get("QLRMC");
String allZjh = (String) qrlInfoMap.get("ZJH");
String allQlbl = (String) qrlInfoMap.get("QLBL");
String allGyfs = (String) qrlInfoMap.get("GYFS");
if (StringUtils.isNotBlank(allQlrmc)) {
for (int k = 0; k < zsbh.length; k++) {
String qlr[] = allQlrmc.split(",");
String zjh[] = allZjh.split(",");
Map hashMap = new HashMap(map);
if(StringUtils.isNotBlank(allGyfs)){
String gyfs[] = allGyfs.split(",");
hashMap.put("GYFS", gyfs[k]);
if("2".equals(gyfs[k])){
if(StringUtils.isNotBlank(allQlbl)){
String qlbl[] = allQlbl.split(",");
hashMap.put("QLBL", qlbl[k]);
}
}
}
hashMap.put("QLRMC", qlr[k]);
hashMap.put("BH", zsbh[k]);
hashMap.put("ZJH", zjh[k]);
List list1 = Arrays.asList(qlr);
List arrList = new ArrayList(list1);
arrList.remove(qlr[k]);
String gyr = StringUtils.join(arrList.toArray(), ",");
String qlqtzkNew=qlqtzk;
if (StringUtils.isNotBlank(qlqtzk)) {
if(((String)map.get("BDCDYH")).contains("GX") || ((String)map.get("ZL")).contains("柴房") ){
qlqtzkNew=qlqtzk.substring(qlqtzk.indexOf(";")+1);
}
String[] qlzkInfo = qlqtzkNew.split(";");
if("1003".equals(map.get("DJLX")) || "1004".equals(map.get("DJLX")) || "416".equals(map.get("DJLX"))){
if(((String)map.get("BDCDYH")).contains("GX") || ((String)map.get("ZL")).contains("柴房") ){
qlqtzkNew=qlzkInfo[0]+";"+qlzkInfo[1]+";"+qlzkInfo[2]+";"+qlzkInfo[3]+";"+qlzkInfo[4]+";"+qlzkInfo[5]+";共有情况: " + hashMap.get("GYQK");
}else{
qlqtzkNew=qlzkInfo[0]+";"+qlzkInfo[1]+";"+qlzkInfo[2]+";"+qlzkInfo[3]+";"+qlzkInfo[4]+";"+qlzkInfo[5]+";"+qlzkInfo[6]+";共有情况: " + hashMap.get("GYQK");
}
}else{
for (int j = 0; j < qlzkInfo.length; j++) {
if (qlzkInfo[j].contains("共有情况")) {
qlzkInfo[j] = "共有情况: " + hashMap.get("GYQK");
}
}
qlqtzkNew=StringUtils.join(qlzkInfo, ";");
}
if (arrList != null && arrList.size() > 0) {
hashMap.put("QLQTZK", qlqtzkNew + ";共有人:" + gyr);
} else {
hashMap.put("QLQTZK", qlqtzkNew);
}
if(StringUtils.isNotBlank((String)map.get("FJ"))) {
hashMap.put("FJ", (String) map.get("FJ"));
}
}
list.add(hashMap);
}
}
}
}
}
}
return list;
}
/**
* 手动版创建合同组件信息
* @return
*/
public List<Map> createInfoByHandle(String zsbs,String qlrzjh,String bh){
List<Map> list=new ArrayList<Map>();
Map map=regBusBdcqzsdjxxMapper.getBdcqzsJbxxById(zsbs);
if(map!=null){
if("207".equals(map.get("DJLX"))){
Map firstmap=AssemblyFirstRegist(map);
list.add(firstmap);
return list;
}
Map qrlInfoMap=regBusBdcqzsdjxxMapper.getQlrInfoByYwh((String) map.get("YWH"));
String allQlrmc=(String)qrlInfoMap.get("QLRMC");
if(StringUtils.isNotBlank(allQlrmc)){
String allZjh=(String)qrlInfoMap.get("ZJH");
if(StringUtils.isNotBlank(allZjh)){
String zjh[]=allZjh.split(",");
String qlqtzk=(String)map.get("QLQTZK");
for (int k = 0; k < zjh.length; k++) {
if(StringUtils.equals(qlrzjh,zjh[k])){
String qlr[]=allQlrmc.split(",");
Map hashMap=new HashMap(map);
hashMap.put("QLRMC",qlr[k]);
hashMap.put("BH",bh);
hashMap.put("ZJH",qlrzjh);
List list1= Arrays.asList(qlr);
List arrList = new ArrayList(list1);
arrList.remove(qlr[k]);
String gyr=StringUtils.join(arrList.toArray(),",");
if(StringUtils.isNotBlank(qlqtzk)){
if(((String)map.get("BDCDYH")).contains("GX") || ((String)map.get("ZL")).contains("柴房") ){
qlqtzk=qlqtzk.substring(qlqtzk.indexOf(";")+1);
}
String[] qlzkInfo = qlqtzk.split(";");
if("1003".equals(map.get("DJLX")) || "1004".equals(map.get("DJLX"))){
qlqtzk=qlzkInfo[0]+";"+qlzkInfo[1]+";"+qlzkInfo[2]+";"+qlzkInfo[3]+";"+qlzkInfo[4]+";"+qlzkInfo[5]+";"+qlzkInfo[6]+";共有情况: " + hashMap.get("GYQK");
}else{
for (int j = 0; j < qlzkInfo.length; j++) {
if (qlzkInfo[j].contains("共有情况")) {
qlzkInfo[j] = "共有情况: " + hashMap.get("GYQK");
}
}
qlqtzk=StringUtils.join(qlzkInfo, ";");
}
if (arrList != null && arrList.size() > 0) {
hashMap.put("QLQTZK", qlqtzk + ";共有人:" + gyr);
} else {
hashMap.put("QLQTZK", qlqtzk);
}
if(StringUtils.isNotBlank((String)map.get("FJ"))) {
hashMap.put("FJ", (String) map.get("FJ"));
}
}
list.add(hashMap);
}
}
}
}
}
return list;
}
public String getzmsx(String djxl,String bdcdyh){
//证明权利或事项
if(djxl.equals("214") || djxl.equals("215")
|| djxl.equals("213") || djxl.equals("209")
|| djxl.equals("315") || djxl.equals("605")
|| djxl.equals("430") || djxl.equals("316")
|| djxl.equals("606") || djxl.equals("431")
|| djxl.equals("427") || djxl.equals("428")
|| djxl.equals("317") || djxl.equals("318")
|| djxl.equals("608") || djxl.equals("433")
|| djxl.equals("422") || djxl.equals("217")){
if(djxl.equals("213") || djxl.equals("316")
|| djxl.equals("606") || djxl.equals("431")
|| djxl.equals("427") || djxl.equals("428")){
return "在建工程抵押权";
}else {
return "抵押权";
}
}else {
//预抵押变更事项可以修改期房和现房的预抵押所以应取上一笔的预抵押信息,获取上一笔抵押登记小类
if (djxl.equals("818") || djxl.equals("607")
|| djxl.equals("432")){
Map rightsInfo= regBusBdcqzsdjxxMapper.getRightsInfo(bdcdyh);
if(rightsInfo!=null){
return regBusBdcqzsdjxxMapper.getInfoByValue((String) rightsInfo.get("REMARKS"),"reg_bus_djxl");
}
}else {
if(djxl.equals("609") || djxl.equals("812") || djxl.equals("809") || djxl.equals("810") || djxl.equals("811")){
return regBusBdcqzsdjxxMapper.getInfoByValue("803","reg_bus_djxl");
}else{
return regBusBdcqzsdjxxMapper.getInfoByValue(djxl,"reg_bus_djxl");
}
}
}
return "";
}
/**
* 组装首次登记业务
*/
public Map AssemblyFirstRegist(Map map){
List<Map> list=regBusBdcqzsdjxxMapper.getBdcqzsjbxxInfoByYwh((String) map.get("YWH"));
//获取所有的面积集合
Double mjs = 0.0;
if(list!=null && list.size()>0){
for(int i = 0; i<list.size(); i++){
if(list.get(i).get("MJ") != null){
mjs += Double.parseDouble((String) list.get(i).get("MJ"));
}
}
BigDecimal bmj = new BigDecimal(mjs);
mjs = bmj.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
}
Map zdjbxxMap=regBusBdcqzsdjxxMapper.getZdjbxxByZddm(((String) map.get("BDCDYH")).substring(0, 19));
String zdmj ="0";
if(zdjbxxMap!=null){
zdmj = zdjbxxMap.get("ZDMJ").toString();
}
Map zrzmap=regBusBdcqzsdjxxMapper.getZrzInfo(((String) map.get("BDCDYH")).substring(0, 24)+"0000");
if(zrzmap!=null){
if("2".equals(zrzmap.get("ZDFTFS"))){
map.put("MJ", "独用宗地面积"+zdmj+"㎡/房屋建筑面积"+mjs+"㎡");
}else {
map.put("MJ", "共用宗地面积"+zdmj+"㎡/房屋建筑面积"+mjs+"㎡");
}
}
String qtzk = (String) map.get("QLQTZK");
if(qtzk != null){
String[] str = qtzk.split(";");
qtzk= str[1]+";"+str[4]+"层"+";"+str[6].substring(0, 15)+";";
map.put("QLQTZK",qtzk);
}
String zl = zdjbxxMap.get("ZL")+(String)zrzmap.get("XMMC")+zrzmap.get("GZWMC");
map.put("ZL", zl);
map.put("BDCDYH",zrzmap.get("BDCDYH"));
map.put("ZTS", "本次登记包含"+list.size()+"(套、间)");
Map qrlInfoMap=regBusBdcqzsdjxxMapper.getQlrInfoByYwh((String) map.get("YWH"));
if(qrlInfoMap!=null){
if(StringUtils.isNotBlank((String)map.get("FJ"))){
String FJ=(String)map.get("FJ");
map.put("FJ",FJ.replace("“", "“").replace("”", "”"));
}
map.put("ZJH",qrlInfoMap.get("ZJH"));
}
return map;
}
}