cbd3293070f95373a4e0523c13f7a1a1586ee55a.svn-base 108 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 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765
/**

 * Copyright © 2015-2018 ODM All rights reserved.
 */
package com.thinkgem.jeesite.modules.reg.web.bus;

import java.io.File;
import java.io.IOException;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonMappingException;
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.utils.DateUtils;
import com.thinkgem.jeesite.common.utils.JsonUtil;
import com.thinkgem.jeesite.common.utils.StringUtils;
import com.thinkgem.jeesite.common.web.BaseController;
import com.thinkgem.jeesite.modules.reg.bus.entity.RegBusBtqlr;
import com.thinkgem.jeesite.modules.reg.bus.service.RegBusBtqlrService;
import com.thinkgem.jeesite.modules.reg.dao.bus.RegBusQlrRelationYwhDao;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBaseH;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBasePerson;
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.RegBusDyaq;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusFdcq2;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusQlr;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusQlrRelationYwh;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusSlsq;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusYgdj;
import com.thinkgem.jeesite.modules.reg.service.base.RegBaseHService;
import com.thinkgem.jeesite.modules.reg.service.base.RegBasePersonService;
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.RegBusDyaqService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusFdcq2Service;
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.RegBusYgdjService;
import com.thinkgem.jeesite.modules.reg.utils.RegUtils;
import com.thinkgem.jeesite.modules.sys.entity.RegBusInterHis;
import com.thinkgem.jeesite.modules.sys.entity.User;
import com.thinkgem.jeesite.modules.sys.service.InterSiService;
import com.thinkgem.jeesite.modules.sys.utils.DictUtils;
import com.thinkgem.jeesite.modules.sys.utils.UserUtils;

/**
 * 权利人信息维护Controller
 * 
 * @author xuyg
 * @version 2015-10-15
 */
@Controller
@RequestMapping(value = "${adminPath}/reg/bus/regBusQlr")
public class RegBusQlrController extends BaseController {
	@Autowired
	private RegBusQlrService regBusQlrService;
	@Autowired
	private RegBusDyaqService regBusDyaqService;
	@Autowired
	private RegBusQlrRelationYwhDao regBusQlrRelationYwhDao;
	@Autowired
	private RegBusBdcqzsdjxxService regBusBdcqzsdjxxService;
	@Autowired
	private RegBusYgdjService regBusYgdjService;
	@Autowired
	private RegBusFdcq2Service regBusFdcq2Service;
	@Autowired
	private RegBusSlsqService regBusSlsqService;
	@Autowired
	private RegBasePersonService regBasePersonService;
	@Autowired
	private RegBaseZdjbxxService regBaseZdjbxxService;
	@Autowired
	private RegBusBtqlrService regBusBtqlrService;
	@Autowired
	private RegBaseHService regBaseHService;
	@Autowired
	private InterSiService siService;

	@ModelAttribute
	public RegBusQlr get(@RequestParam(required = false) String id) {
		RegBusQlr entity = null;
		if (StringUtils.isNotBlank(id)) {
			entity = regBusQlrService.get(id);
		}
		if (entity == null) {
			entity = new RegBusQlr();
		}
		return entity;
	}

	@RequiresPermissions("reg:bus:regBusQlr:view")
	@RequestMapping(value = { "list", "" })
	public String list(RegBusQlr regBusQlr, HttpServletRequest request, HttpServletResponse response, Model model) {
		// 变更类型时,控制宗地基本信息页面上的显示情况
		if (StringUtils.isNotBlank(request.getParameter("SXBGLX"))) {
			model.addAttribute("SXBGLX", request.getParameter("SXBGLX"));
		}
		// QLRXXXZ
		if (StringUtils.isNotBlank(request.getParameter("QLRXXXZ"))) {
			model.addAttribute("QLRXXXZ", "1");
		}
		// 初审以后的环节只能查看不能修改删除
		if (StringUtils.isNotBlank(request.getParameter("LISTVIEWS"))) {
			model.addAttribute("LISTVIEWS", "1");
		}
		if (StringUtils.isNotBlank(request.getParameter("ywh"))) {
			model.addAttribute("YWH", request.getParameter("ywh"));
		}
		// WinOpen标示
		if (StringUtils.isNotBlank(request.getParameter("WO"))) {
			model.addAttribute("WO", "1");
			model.addAttribute("LISTVIEWS", "1");
		}
		System.out.println(request.getParameter("optype"));
		// 页面操作类型【新增还是更新】
		if (StringUtils.isNotBlank(request.getParameter("optype"))) {
			model.addAttribute("optype", "update");
		}
		if (StringUtils.isNotBlank(request.getParameter("opty"))) {
			model.addAttribute("optype", "update");
		}
		Object djlx = request.getParameter("DJLX");
		String djxl = "";
		if (djlx != null) {
			djxl = djlx.toString();
			if (djxl.equals("1001") || djxl.equals("1002") || djxl.equals("1003") || djxl.equals("1004")
					|| djxl.equals("402") || djxl.equals("403") || djxl.equals("404") || djxl.equals("405")
					|| djxl.equals("406") || djxl.equals("501") || djxl.equals("502") || djxl.equals("407")
					|| djxl.equals("421") || djxl.equals("419") || djxl.equals("505") || djxl.equals("507")
					|| djxl.equals("509") || djxl.equals("510") || djxl.equals("511") || djxl.equals("513")
					|| djxl.equals("515") || djxl.equals("512") || djxl.equals("418") || djxl.equals("430")
					|| djxl.equals("431") || djxl.equals("432") || djxl.equals("433") || djxl.equals("414")
					|| djxl.equals("415") || djxl.equals("427") || djxl.equals("428") || djxl.equals("703")
					|| djxl.equals("704") || djxl.equals("905") || djxl.equals("810") || djxl.equals("811")
					|| djxl.equals("812") || djxl.equals("417") || djxl.equals("610") || djxl.equals("408")
					|| djxl.equals("1007") || djxl.equals("1008") || djxl.equals("410") || djxl.equals("411")
					|| djxl.equals("906") || djxl.equals("907") || djxl.equals("908") || djxl.equals("901")
					|| djxl.equals("904") || djxl.equals("521")) {
				model.addAttribute("LISTVIEWS", "1");
			} else if (djxl.equals("601") || djxl.equals("602") || djxl.equals("605") || djxl.equals("606")
					|| djxl.equals("608") || djxl.equals("607")) {
				model.addAttribute("SXBGLX", "1");
			} else if (djxl.equals("604")) {
				ModelMap modelMap = isFlagDy(request);
				System.out.println(modelMap.get("success"));
				if (modelMap.get("success").equals(0)) {
					model.addAttribute("LISTVIEWS", "1");
				}
			}
		} else {
			RegBusBdcqzsdjxx regBusBdcqzsdjxx = new RegBusBdcqzsdjxx();
			regBusBdcqzsdjxx.setYwh(request.getParameter("ywh"));
			List<RegBusBdcqzsdjxx> temp = regBusBdcqzsdjxxService.findList(regBusBdcqzsdjxx);
			if (temp.size() > 0) {
				djxl = temp.get(0).getDjlx();
				if (djxl.equals("1001") || djxl.equals("1002") || djxl.equals("507") || djxl.equals("509")
						|| djxl.equals("510") || djxl.equals("511") || djxl.equals("512") || djxl.equals("513")
						|| djxl.equals("605") || djxl.equals("606") || djxl.equals("607") || djxl.equals("608")
						|| djxl.equals("430") || djxl.equals("431") || djxl.equals("432") || djxl.equals("433")
						|| djxl.equals("515") || djxl.equals("1007") || djxl.equals("1008")) {
					model.addAttribute("LISTVIEWS", "1");
				}
			} else {
				djxl = "";
			}
		}
		// 登记类型 小类
		if (StringUtils.isNotBlank(request.getParameter("DJLX"))) {
			model.addAttribute("DJLX", request.getParameter("DJLX"));
		} else {
			model.addAttribute("DJLX", djxl);
		}
		Page<RegBusQlr> page = regBusQlrService.findPage_1(new Page<RegBusQlr>(request, response), regBusQlr);
		model.addAttribute("page", page);
		return "modules/reg/bus/regBusQlrList";
	}

	@RequiresPermissions("reg:bus:regBusQlr:view")
	@RequestMapping(value = "yrform")
	public String yrform(RegBusQlr regBusQlr, Model model, HttpServletRequest request) {
		Map<String, String> map = new HashMap<String, String>();
		if (StringUtils.isNotBlank(request.getParameter("YWH"))) {
			model.addAttribute("YWH", request.getParameter("YWH"));
		}
		// 变更类型时,控制宗地基本信息页面上的显示情况
		if (StringUtils.isNotBlank(request.getParameter("SXBGLX"))) {
			model.addAttribute("SXBGLX", request.getParameter("SXBGLX"));
		}
		String qlrxxxz = request.getParameter("QLRXXXZ");
		if (StringUtils.isNotBlank(qlrxxxz)) {
			model.addAttribute("SXBGLX", qlrxxxz);
		}
		if (StringUtils.isNotBlank(request.getParameter("DJLX"))) {
			model.addAttribute("DJLX", request.getParameter("DJLX"));
		}
		if (StringUtils.isNotBlank(request.getParameter("XG"))) {
			model.addAttribute("XG", "1");
			model.addAttribute("SXH", request.getParameter("SXH"));
			regBusQlr.setSxh(new Integer(request.getParameter("SXH")));
			model.addAttribute("qlrid", request.getParameter("qlrid"));
		}
		// 受托人姓名
		if (StringUtils.isNotBlank(request.getParameter("dlrmc"))) {
			model.addAttribute("dlrmc", request.getParameter("dlrmc"));
		}
		// 计算当前顺序号【注意:只有新增时才需要这个值】
		if (StringUtils.isBlank(request.getParameter("optype"))) {
			if (StringUtils.isBlank(request.getParameter("XG"))) {
				model.addAttribute("SXH", getQlrmcOrderNumber(request.getParameter("YWH")));
			}
		}
		if (StringUtils.isNotBlank(request.getParameter("qllx"))) {
			model.addAttribute("qllx", request.getParameter("qllx"));
			regBusQlr.setQllx(request.getParameter("qllx"));
		}
		if (StringUtils.isNotBlank(request.getParameter("gyfs"))) {
			model.addAttribute("gyfs", request.getParameter("gyfs"));
			regBusQlr.setGyfs(request.getParameter("gyfs"));
		}
		String ids = request.getParameter("ids");
		RegBasePerson person = new RegBasePerson();
		person = regBasePersonService.get(ids);
		regBusQlr.setZjzl(person.getZjzl());
		regBusQlr.setSshy(DictUtils.getDictLabel(person.getSshy(), "reg_bus_sshy", ""));
		regBusQlr.setZjh(person.getZjh());
		regBusQlr.setHjszss(person.getHjszss());
		regBusQlr.setXb(person.getXb());
		regBusQlr.setDh(person.getDh());
		regBusQlr.setYb(person.getYb());
		regBusQlr.setGzdw(person.getGzdw());
		regBusQlr.setDzyj(person.getDzyj());
		regBusQlr.setDlrmc(person.getDlrymc());
		regBusQlr.setDljgmc(person.getDljg());
		regBusQlr.setDlrdh(person.getDlrydh());
		regBusQlr.setBz(person.getBz());
		regBusQlr.setQlrlx(person.getRylx());
		regBusQlr.setHjszss(person.getHjszss());
		regBusQlr.setPcode(person.getPcode());
		regBusQlr.setSczt(person.getSczt());
		regBusQlr.setVeritysczt(person.getVeritysczt());
		regBusQlr.setFzjg(person.getFzjg());
		regBusQlr.setSfczr(DictUtils.getDictValue("是", "yes_no", ""));
		regBusQlr.setId("");
		if (StringUtils.isNotBlank(request.getParameter("XG")) && StringUtils.isNotBlank(request.getParameter("qlrid"))
				&& StringUtils.isNotBlank(request.getParameter("ryxz"))) {
			model.addAttribute("opty", "1");
			model.addAttribute("ryxz", "1");
		}
		if (StringUtils.isNotBlank(person.getRymc())) {
			map.put("QLR", person.getRymc());
		}
		if (StringUtils.isNotBlank(person.getDz())) {
			map.put("ZL", person.getDz());
		}
		model.addAttribute("pcode", person.getPcode());
		model.addAttribute("maps", map);
		String qxdm = DictUtils.getDictLabel(Global.getAreaCode(), "reg_bus_xq", "");

		RegBusInterHis his = null;
		switch (regBusQlr.getQlrlx()) {
		case "2010":
		case "2020":
		case "2030":
		case "2040":
			his = siService.getInterHisByMc(regBusQlr, "民政社会组织核验");
			if (his != null) {
				model.addAttribute("minzhenzuzhi", DateUtils.formatDate(his.getCreateDate()));
			}
			break;
		case "1":
			his = siService.getInterHisByMc(regBusQlr, "公安公民身份核验");
			if (his != null) {
				model.addAttribute("gonganshenfen", DateUtils.formatDate(his.getCreateDate()));
			}
			his = siService.getInterHisByMc(regBusQlr, "人像比对");
			if (his != null) {
				model.addAttribute("renxiangbidui", DateUtils.formatDate(his.getCreateDate()));
			}
			his = siService.getInterHisByMc(regBusQlr, "生存状态");
			if (his != null) {
				model.addAttribute("shencunzhuangtai", DateUtils.formatDate(his.getCreateDate()));
			}
			his = siService.getInterHisByMc(regBusQlr, "婚姻状态");
			if (his != null) {
				model.addAttribute("minzhenhunyin", DateUtils.formatDate(his.getCreateDate()));
			}
			break;
		case "2":
			his = siService.getInterHisByMc(regBusQlr, "市场监管企业核验");
			if (his != null) {
				model.addAttribute("shichangjianguanqy", DateUtils.formatDate(his.getCreateDate()));
			}
			break;
		case "2050":
		case "2060":
			his = siService.getInterHisByMc(regBusQlr, "银保监机构核验");
			if (his != null) {
				model.addAttribute("yinbaojianjigou", DateUtils.formatDate(his.getCreateDate()));
			}
			break;
		case "4":
		case "3":
			his = siService.getInterHisByMc(regBusQlr, "中编办部门核验");
			if (his != null) {
				model.addAttribute("zhongbianbumen", DateUtils.formatDate(his.getCreateDate()));
			}
			break;
		default:
			break;
		}

		System.out.println(request.getParameter("DJLX"));
		model.addAttribute("regBusQlr", regBusQlr);
		model.addAttribute("MZ01", "1");// 保存验证婚姻登记信息查询接口
		if (request.getParameter("DJLX").equals("213") || request.getParameter("DJLX").equals("214")
				|| request.getParameter("DJLX").equals("215") || request.getParameter("DJLX").equals("807")
				|| request.getParameter("DJLX").equals("804") || request.getParameter("DJLX").equals("315")
				|| request.getParameter("DJLX").equals("316") || request.getParameter("DJLX").equals("317")
				|| request.getParameter("DJLX").equals("318") || request.getParameter("DJLX").equals("818")) {
			return "modules/reg/bus/dyscregBusQlrForm";
		} else {
			return "modules/reg/bus/regBusQlrForm";
		}
	}

	@RequiresPermissions("reg:bus:regBusQlr:view")
	@RequestMapping(value = "hishouseyrform")
	public String hishouseyrform(RegBusQlr regBusQlr, Model model, HttpServletRequest request) {
		Map<String, String> map = new HashMap<String, String>();
		if (StringUtils.isNotBlank(request.getParameter("YWH"))) {
			model.addAttribute("YWH", request.getParameter("YWH"));
		}
		// 变更类型时,控制宗地基本信息页面上的显示情况
		if (StringUtils.isNotBlank(request.getParameter("SXBGLX"))) {
			model.addAttribute("SXBGLX", request.getParameter("SXBGLX"));
		}
		String qlrxxxz = request.getParameter("QLRXXXZ");
		if (StringUtils.isNotBlank(qlrxxxz)) {
			model.addAttribute("SXBGLX", qlrxxxz);
		}
		if (StringUtils.isNotBlank(request.getParameter("DJLX"))) {
			model.addAttribute("DJLX", request.getParameter("DJLX"));
		}
		// 计算当前顺序号【注意:只有新增时才需要这个值】
		if (StringUtils.isBlank(request.getParameter("optype"))) {
			model.addAttribute("SXH", getQlrmcOrderNumber(request.getParameter("YWH")));
		}
		String ids = request.getParameter("ids");
		RegBasePerson person = new RegBasePerson();
		person = regBasePersonService.get(ids);
		regBusQlr.setZjzl(DictUtils.getDictLabel(person.getZjzl(), "reg_bus_zjlx", ""));
		regBusQlr.setZjh(person.getZjh());
		regBusQlr.setHjszss(person.getHjszss());
		regBusQlr.setXb(person.getXb());
		regBusQlr.setDh(person.getDh());
		regBusQlr.setYb(person.getYb());
		regBusQlr.setGzdw(person.getGzdw());
		regBusQlr.setDzyj(person.getDzyj());
		regBusQlr.setDlrmc(person.getDlrymc());
		regBusQlr.setDljgmc(person.getDljg());
		regBusQlr.setDlrdh(person.getDlrydh());
		regBusQlr.setBz(person.getBz());
		regBusQlr.setQlrlx(person.getRylx());
		regBusQlr.setFzjg(person.getFzjg());
		regBusQlr.setHjszss(person.getHjszss());
		regBusQlr.setSfczr(DictUtils.getDictValue("是", "yes_no", ""));
		regBusQlr.setId("");
		if (StringUtils.isNotBlank(person.getRymc())) {
			map.put("QLR", person.getRymc());
		}
		if (StringUtils.isNotBlank(person.getDz())) {
			map.put("ZL", person.getDz());
		}
		model.addAttribute("maps", map);
		model.addAttribute("regBusQlr", regBusQlr);
		return "modules/reg/bus/regBusHisHouseQlrForm";
	}

	@RequiresPermissions("reg:bus:regBusQlr:view")
	@RequestMapping(value = "form")
	public String form(RegBusQlr regBusQlr, Model model, HttpServletRequest request) {
		String qxdm = DictUtils.getDictLabel(Global.getAreaCode(), "reg_bus_xq", "");
		model.addAttribute("regBusQlr", regBusQlr);
		model.addAttribute("qlrmc", regBusQlr.getQlrmc());
		// 登记类型 小类
		if (StringUtils.isNotBlank(regBusQlr.getPcode())) {
			model.addAttribute("pcode", regBusQlr.getPcode());
		}
		// 登记类型 小类
		if (StringUtils.isNotBlank(request.getParameter("DJLX"))) {
			model.addAttribute("DJLX", request.getParameter("DJLX"));
		}
		// 权利人选择
		if (StringUtils.isNotBlank(request.getParameter("QLRXXXZ"))) {
			model.addAttribute("QLRXXXZ", request.getParameter("QLRXXXZ"));
		}
		// 受托人姓名
		if (StringUtils.isNotBlank(request.getParameter("STR"))) {
			model.addAttribute("dlrmc", request.getParameter("STR"));
		}
		// 业务号
		if (StringUtils.isNotBlank(request.getParameter("YWH"))) {
			model.addAttribute("YWH", request.getParameter("YWH"));
		}
		// 传递要素代码
		if (StringUtils.isNotBlank(request.getParameter("YSDM"))) {
			model.addAttribute("YSDM", request.getParameter("YSDM"));
		}
		// 变更类型时,控制宗地基本信息页面上的显示情况
		if (StringUtils.isNotBlank(request.getParameter("SXBGLX"))) {
			model.addAttribute("SXBGLX", request.getParameter("SXBGLX"));
		}
		// 计算当前顺序号【注意:只有新增时才需要这个值】
		if (StringUtils.isBlank(regBusQlr.getId())) {
			if (StringUtils.isBlank(request.getParameter("XG"))) {
				model.addAttribute("SXH", getQlrmcOrderNumber(request.getParameter("YWH")));
			}
		}
		// 查看标示
		if (StringUtils.isNotBlank(request.getParameter("VIEWS"))) {
			model.addAttribute("VIEWS", request.getParameter("VIEWS"));
		}
		// 修改
		if (StringUtils.isNotBlank(request.getParameter("XG"))) {
			model.addAttribute("SXH", regBusQlr.getSxh());
			model.addAttribute("XG", "1");
			model.addAttribute("qlrid", regBusQlr.getId());
			model.addAttribute("gyfs", regBusQlr.getGyfs());
		}
		Map<String, String> map = new HashMap<String, String>();
		if (StringUtils.isNotBlank(request.getParameter("QLR"))) {
			map.put("QLR", request.getParameter("QLR"));
		}
		if (StringUtils.isNotBlank(request.getParameter("ZL"))) {
			map.put("ZL", request.getParameter("ZL"));
		}
		if (StringUtils.isNotBlank(request.getParameter("QLRDH"))) {
			map.put("QLRDH", request.getParameter("QLRDH"));
		}
		if (StringUtils.isNotBlank(request.getParameter("QLRYJ"))) {
			map.put("QLRYJ", request.getParameter("QLRYJ"));
		}
		if (StringUtils.isNotBlank(request.getParameter("gyfs"))) {
			model.addAttribute("gyfs", request.getParameter("gyfs"));
			regBusQlr.setGyfs(request.getParameter("gyfs"));
		}
		RegBusInterHis his = null;
		if (regBusQlr != null && regBusQlr.getQlrlx() != null) {
			switch (regBusQlr.getQlrlx()) {
			case "2010":
			case "2020":
			case "2030":
			case "2040":
				his = siService.getInterHisByMc(regBusQlr, "民政社会组织核验");
				if (his != null) {
					model.addAttribute("minzhenzuzhi", DateUtils.formatDate(his.getCreateDate()));
				}
				break;
			case "1":
				his = siService.getInterHisByMc(regBusQlr, "公安公民身份核验");
				if (his != null) {
					model.addAttribute("gonganshenfen", DateUtils.formatDate(his.getCreateDate()));
				}
				his = siService.getInterHisByMc(regBusQlr, "人像比对");
				if (his != null) {
					model.addAttribute("renxiangbidui", DateUtils.formatDate(his.getCreateDate()));
				}
				his = siService.getInterHisByMc(regBusQlr, "生存状态");
				if (his != null) {
					model.addAttribute("shencunzhuangtai", DateUtils.formatDate(his.getCreateDate()));
				}
				his = siService.getInterHisByMc(regBusQlr, "婚姻状态");
				if (his != null) {
					model.addAttribute("minzhenhunyin", DateUtils.formatDate(his.getCreateDate()));
				}
				break;
			case "2":
				his = siService.getInterHisByMc(regBusQlr, "市场监管企业核验");
				if (his != null) {
					model.addAttribute("shichangjianguanqy", DateUtils.formatDate(his.getCreateDate()));
				}
				break;
			case "2050":
			case "2060":
				his = siService.getInterHisByMc(regBusQlr, "银保监机构核验");
				if (his != null) {
					model.addAttribute("yinbaojianjigou", DateUtils.formatDate(his.getCreateDate()));
				}
				break;
			case "4":
			case "3":
				his = siService.getInterHisByMc(regBusQlr, "中编办部门核验");
				if (his != null) {
					model.addAttribute("zhongbianbumen", DateUtils.formatDate(his.getCreateDate()));
				}
				break;
			default:
				break;
			}
		}
		if (request.getParameter("DJLX").equals("803")) {
			if (regBusQlr.getId() != null) {
				regBusQlr = regBusQlrService.get(regBusQlr.getId());
				model.addAttribute("maps", map);
				model.addAttribute("regBusQlr", regBusQlr);
			} else {
				RegBusSlsq regBusSlsq = new RegBusSlsq();
				regBusSlsq.setYwh(request.getParameter("YWH"));
				List<RegBusSlsq> regBusSlsqlist = regBusSlsqService.findList(regBusSlsq);
				if (regBusSlsqlist.size() > 0) {
					regBusSlsq = regBusSlsqlist.get(0);
					map.put("QLR", regBusSlsq.getTzrxm());
				}
				RegBusYgdj regBusYgdj = new RegBusYgdj();
				regBusYgdj.setYwh(request.getParameter("YWH"));
				List<RegBusYgdj> listYgdj = regBusYgdjService.findList(regBusYgdj);
				if (listYgdj.size() > 0) {
					regBusYgdj = listYgdj.get(listYgdj.size() - 1);
					RegBusQlr regBusQlr1 = new RegBusQlr();
					if (StringUtils.isNotBlank(request.getParameter("gyfs"))) {
						model.addAttribute("gyfs", request.getParameter("gyfs"));
						regBusQlr.setGyfs(request.getParameter("gyfs"));
					}
					model.addAttribute("regBusQlr", regBusQlr1);
				}
				model.addAttribute("maps", map);
			}
			return "modules/reg/bus/regBusQlrForm";
			// 判断本次操作业务为现房一般抵押214、最高额抵押215、房屋所有权抵押预告登记807
		} else if (request.getParameter("DJLX").equals("213") || request.getParameter("DJLX").equals("214")
				|| request.getParameter("DJLX").equals("215") || request.getParameter("DJLX").equals("807")
				|| request.getParameter("DJLX").equals("804")) {
			return "modules/reg/bus/dyscregBusQlrForm";
		} else if (request.getParameter("DJLX").equals("601") || request.getParameter("DJLX").equals("602")
				|| request.getParameter("DJLX").equals("605") || request.getParameter("DJLX").equals("606")
				|| request.getParameter("DJLX").equals("608") || request.getParameter("DJLX").equals("609")
				|| request.getParameter("DJLX").equals("607")) {
			if (request.getParameter("DJLX").equals("601") || request.getParameter("DJLX").equals("602")
					|| request.getParameter("DJLX").equals("609")) {
				model.addAttribute("qlrgz", "1");// 所有权使用权更正传入标记判断是否有抵押数据
			}
			return "modules/reg/bus/regBusSyqGzQlrForm";
		} else {
			model.addAttribute("maps", map);
			return "modules/reg/bus/regBusQlrForm";
		}
	}

	@RequiresPermissions("reg:bus:regBusQlr:view")
	@RequestMapping(value = "hishouseForm")
	public String hishouseForm(RegBusQlr regBusQlr, Model model, HttpServletRequest request) {
		model.addAttribute("regBusQlr", regBusQlr);
		// 业务号
		if (StringUtils.isNotBlank(request.getParameter("YWH"))) {
			model.addAttribute("YWH", request.getParameter("YWH"));
		}
		// 传递要素代码
		if (StringUtils.isNotBlank(request.getParameter("YSDM"))) {
			model.addAttribute("YSDM", request.getParameter("YSDM"));
		}
		// 计算当前顺序号【注意:只有新增时才需要这个值】
		if (StringUtils.isBlank(regBusQlr.getId())) {
			model.addAttribute("SXH", getQlrmcOrderNumber(request.getParameter("YWH")));
		}

		// 查看标示
		if (StringUtils.isNotBlank(request.getParameter("VIEWS"))) {
			model.addAttribute("VIEWS", request.getParameter("VIEWS"));
		}
		Map<String, String> map = new HashMap<String, String>();
		if (StringUtils.isNotBlank(request.getParameter("QLR"))) {
			map.put("QLR", request.getParameter("QLR"));
		}
		if (StringUtils.isNotBlank(request.getParameter("ZL"))) {
			map.put("ZL", request.getParameter("ZL"));
		}
		model.addAttribute("maps", map);
		return "modules/reg/bus/regBusHisHouseQlrForm";
	}

	@RequiresPermissions("reg:bus:regBusQlr:view")
	@RequestMapping(value = { "selectedList" })
	public String selectedList(RegBusQlr regBusQlr, HttpServletRequest request, HttpServletResponse response,
			Model model) {
		Page<RegBusQlr> page = regBusQlrService.findPage(new Page<RegBusQlr>(request, response), regBusQlr);
		model.addAttribute("page", page);
		// QLRXXXZ
		if (StringUtils.isNotBlank(request.getParameter("QLRXXXZ"))) {
			model.addAttribute("QLRXXXZ", "1");
		}
		// 初审以后的环节只能查看不能修改删除
		if (StringUtils.isNotBlank(request.getParameter("LISTVIEWS"))) {
			model.addAttribute("LISTVIEWS", "1");
		}
		if (StringUtils.isNotBlank(request.getParameter("ywh"))) {
			model.addAttribute("YWH", request.getParameter("ywh"));
		}
		if (StringUtils.isNotBlank(request.getParameter("YSDM"))) {
			model.addAttribute("YSDM", request.getParameter("YSDM"));
		}
		if (StringUtils.isNotBlank(request.getParameter("QLR"))) {
			model.addAttribute("QLR", request.getParameter("QLR"));
		}
		if (StringUtils.isNotBlank(request.getParameter("ZL"))) {
			model.addAttribute("ZL", request.getParameter("ZL"));
		}
		if (StringUtils.isNotBlank(request.getParameter("QLRDH"))) {
			model.addAttribute("QLRDH", request.getParameter("QLRDH"));
		}
		if (StringUtils.isNotBlank(request.getParameter("QLRYJ"))) {
			model.addAttribute("QLRYJ", request.getParameter("QLRYJ"));
		}
		// WinOpen标示
		if (StringUtils.isNotBlank(request.getParameter("WO"))) {
			model.addAttribute("WO", "1");
			model.addAttribute("LISTVIEWS", "1");
		}
		// 页面操作类型【新增还是更新】
		if (StringUtils.isNotBlank(request.getParameter("optype"))) {
			model.addAttribute("optype", "update");
		}
		return "modules/reg/bus/regBusQlrList";
	}

	@RequiresPermissions("reg:bus:regBusQlr:view")
	@RequestMapping(value = "getByIds")
	@ResponseBody
	public ModelMap getByIds(HttpServletRequest request) {
		String ids = request.getParameter("ids");
		String[] idList = ids.split(";");
		String qlrmcs = "";
		String zjzls = "";
		String zjhs = "";
		String dzs = "";
		String ybs = "";
		String gzdws = "";

		for (String id : idList) {
			RegBusQlr regBusQlr = regBusQlrService.get(id);
			if (StringUtils.isNotBlank(qlrmcs)) {
				qlrmcs += ";" + regBusQlr.getQlrmc();
			} else {
				qlrmcs = regBusQlr.getQlrmc();
			}

			if (StringUtils.isNotBlank(zjzls)) {
				zjzls += ";" + DictUtils.getDictLabel(regBusQlr.getZjzl(), "reg_bus_zjlx", "");

			} else {
				zjzls = DictUtils.getDictLabel(regBusQlr.getZjzl(), "reg_bus_zjlx", "");
			}

			if (StringUtils.isNotBlank(zjhs)) {
				zjhs += ";" + regBusQlr.getZjh();
			} else {
				zjhs = regBusQlr.getZjh();
			}

			if (StringUtils.isNotBlank(dzs)) {
				dzs += ";" + regBusQlr.getDz();
			} else {
				dzs = regBusQlr.getDz();
			}

			if (StringUtils.isNotBlank(ybs)) {
				ybs += ";" + regBusQlr.getYb();
			} else {
				ybs = regBusQlr.getYb();
			}
			if (StringUtils.isNotBlank(gzdws)) {
				gzdws += ";" + regBusQlr.getGzdw();
			} else {
				gzdws = regBusQlr.getGzdw();
			}
		}
		ModelMap modelMap = new ModelMap();
		modelMap.put("qlrmcs", qlrmcs);
		modelMap.put("zjzls", zjzls);
		modelMap.put("zjhs", zjhs);
		modelMap.put("dzs", dzs);
		modelMap.put("ybs", ybs);
		modelMap.put("gzdws", gzdws);
		return modelMap;
	}

	@RequiresPermissions("reg:bus:regBusQlr:edit")
	@RequestMapping(value = "save")
	public String save(RegBusQlr regBusQlr, Model model, HttpServletRequest request,
			RedirectAttributes redirectAttributes) throws IOException {
		if (!beanValidator(model, regBusQlr)) {
			return form(regBusQlr, model, request);
		}
		String qlrxxxz = request.getParameter("QLRXXXZ");
		String ywhStr = request.getParameter("YWH");
		String MZ01 = request.getParameter("MZ01");
		Object djxl = request.getParameter("DJLX");
		String pcode = request.getParameter("pcode");
		String DJLX = "";
		if (djxl != null) {
			DJLX = djxl.toString();
		}	
		
		RegBusQlr cxql = new RegBusQlr();
		cxql.setQlrmc(regBusQlr.getQlrmc());
		cxql.setZjh(regBusQlr.getZjh());
		cxql.setYwh(ywhStr);
		List<RegBusQlr> list  = regBusQlrService.findList_1(cxql);
		
		Boolean isexists  = false;
		
		if(list != null && list.size() > 0) {
		    for(RegBusQlr qlr : list) {
		    	if(qlr.getId() == null) {
		    		continue;
		    	}
		    	if(regBusQlr.getId() == null) {
		    		isexists = true;
		    		break;
		    	}
		    	if(!regBusQlr.getId().equals(qlr.getId())) {
		    		isexists = true;
		    		break;
		    	}
		    }
		}
		if(!isexists) {
		System.out.println(request.getParameter("SXBGLX"));
		// 变更类型时,控制宗地基本信息页面上的显示情况
		if (StringUtils.isNotBlank(request.getParameter("SXBGLX"))) {
			model.addAttribute("SXBGLX", request.getParameter("SXBGLX"));
		}
		
		if (StringUtils.isNotBlank(qlrxxxz)) {
			model.addAttribute("SXBGLX", qlrxxxz);
		}
		if (StringUtils.isNotBlank(request.getParameter("ryxz"))
				&& StringUtils.isNotBlank(request.getParameter("qlrid"))) {
			RegBusQlr regQlr = new RegBusQlr();
			String qlrid = request.getParameter("qlrid");
			if (StringUtils.isNotBlank(qlrid)) {
				regQlr = regBusQlrService.get(qlrid);
				regBusQlrService.delete(regQlr);
			}
		}

		regBusQlr.setYwh(ywhStr);
		regBusQlr.setQszt("0");
		regBusQlr.setGyqk(DictUtils.getDictLabel(regBusQlr.getGyfs(), "reg_bus_gyfs", ""));

		// 业务号跟权利人关联
		Map<String, String> map = new HashMap<String, String>();
		
		if (StringUtils.isNotBlank(pcode)) {
			regBusQlr.setPcode(pcode);
		}
		String xmqllx = "";// 记录多幢登记时qllx
		if (djxl != null) {
			DJLX = djxl.toString();
			if (DJLX.equals("806") || DJLX.equals("302") || DJLX.equals("609")) {
				if (StringUtils.isNotBlank(ywhStr)) {
					// 权利人信息保存后反写登记信息权利人
					RegBusBdcqzsdjxx regBusBdcqzsdjxxtmp = new RegBusBdcqzsdjxx();
					regBusBdcqzsdjxxtmp.setYwh(ywhStr);
					List<RegBusBdcqzsdjxx> findList = regBusBdcqzsdjxxService.findList(regBusBdcqzsdjxxtmp);
					if (findList.size() > 0) {
						regBusBdcqzsdjxxtmp = findList.get(0);
						regBusQlr.setBdcdyh(regBusBdcqzsdjxxtmp.getBdcdyh());
						RegBusQlr regBusQlr_1 = new RegBusQlr();
						regBusQlr_1.setYwh(ywhStr);
						List<RegBusQlr> regBusQlrlist = regBusQlrService.findListSxh(regBusQlr_1);
						// 查出当前业务号下总条数,如果大于1则说明是多个权利人,则只反写第一次添加时候的权利人
						if (regBusQlrlist.size() <= 0) {
							// 说明权利人信息未添加
							if (regBusBdcqzsdjxxtmp != null) {
								regBusBdcqzsdjxxtmp.setQlrmc(regBusQlr.getQlrmc());
								regBusBdcqzsdjxxtmp
										.setGyqk(DictUtils.getDictLabel(regBusQlr.getGyfs(), "reg_bus_gyfs", ""));
								regBusBdcqzsdjxxService.save(regBusBdcqzsdjxxtmp);
							}
						} else {
							if (DJLX.equals("806")) {
								// 反写权属土地使用权人
								RegBusQlr tdsyqr = new RegBusQlr();
								String tdqlr = "";
								RegBusYgdj ygdj = new RegBusYgdj();
								ygdj.setYwh(ywhStr);
								ygdj.setBdcdyh(regBusBdcqzsdjxxtmp.getBdcdyh());
								List<RegBusYgdj> ygdjlist = regBusYgdjService.findList(ygdj);
								if (ygdjlist.size() > 0) {
									ygdj = ygdjlist.get(0);
									for (int t = 0; t < regBusQlrlist.size(); t++) {
										tdsyqr = regBusQlrlist.get(t);
										tdqlr += tdsyqr.getQlrmc() + ";";
									}
									ygdj.setTdsyqr(tdqlr);
									regBusYgdjService.save(ygdj);
								}
							} else if (DJLX.equals("302")) {
								// 反写权属土地使用权人
								RegBusQlr tdsyqr = new RegBusQlr();
								String tdqlr = "";
								RegBusFdcq2 fdcq2 = new RegBusFdcq2();
								fdcq2.setYwh(ywhStr);
								fdcq2.setBdcdyh(regBusBdcqzsdjxxtmp.getBdcdyh());
								List<RegBusFdcq2> fdcqlist = regBusFdcq2Service.findList(fdcq2);
								if (fdcqlist.size() > 0) {
									fdcq2 = fdcqlist.get(0);
									for (int t = 0; t < regBusQlrlist.size(); t++) {
										tdsyqr = regBusQlrlist.get(t);
										tdqlr += tdsyqr.getQlrmc() + ";";
									}
									fdcq2.setTdsyqr(tdqlr);
									regBusFdcq2Service.save(fdcq2);
								}
							}
							RegBusQlr qlr = regBusQlrlist.get(0);
							// 第一权利人顺序号
							String sxh = qlr.getSxh().toString();
							// 点击修改传过来的权利人顺序号
							String sxh_1 = regBusQlr.getSxh().toString();
							System.out.println(request.getParameter("optype"));
							/*if (sxh.equals(sxh_1)
									&& request.getParameter("optype").equals(regBusQlrlist.get(0).getId())) {
								if (request.getParameter("optype") != null
										|| !request.getParameter("optype").equals("")) {*/
							if("1".equals(sxh_1)) {
									if (regBusBdcqzsdjxxtmp != null) {
										regBusBdcqzsdjxxtmp.setQlrmc(regBusQlr.getQlrmc());
										regBusBdcqzsdjxxtmp.setGyqk(
												DictUtils.getDictLabel(regBusQlr.getGyfs(), "reg_bus_gyfs", ""));
										regBusBdcqzsdjxxService.save(regBusBdcqzsdjxxtmp);
									}
								//}
							}
						}
					}
				}
			} else if (DJLX.equals("207") || DJLX.equals("604")) {
				if (StringUtils.isNotBlank(ywhStr)) {
					// 权利人信息保存后反写登记信息权利人
					RegBusBdcqzsdjxx regBusBdcqzsdjxxtmp = new RegBusBdcqzsdjxx();
					regBusBdcqzsdjxxtmp.setYwh(ywhStr);
					List<RegBusBdcqzsdjxx> findList = regBusBdcqzsdjxxService.findList(regBusBdcqzsdjxxtmp);
					if (findList.size() > 0) {
						for (int i = 0; i < findList.size(); i++) {
							regBusBdcqzsdjxxtmp = findList.get(i);
							regBusQlr.setBdcdyh(regBusBdcqzsdjxxtmp.getBdcdyh());
							RegBusQlr regBusQlr_1 = new RegBusQlr();
							regBusQlr_1.setYwh(ywhStr);
							// 第一条是第一权利人信息
							List<RegBusQlr> regBusQlrlist = regBusQlrService.findListSxh(regBusQlr_1);
							// 查出当前业务号下总条数,如果大于1则说明是多个权利人,则只反写第一次添加时候的权利人
							if (regBusQlrlist.size() <= 0) {
								// 说明权利人信息未添加
								if (regBusBdcqzsdjxxtmp != null) {
									regBusBdcqzsdjxxtmp.setQlrmc(regBusQlr.getQlrmc());
									regBusBdcqzsdjxxtmp
											.setGyqk(DictUtils.getDictLabel(regBusQlr.getGyfs(), "reg_bus_gyfs", ""));
									regBusBdcqzsdjxxService.save(regBusBdcqzsdjxxtmp);
								}
							} else {
								// 反写权属土地使用权人
								RegBusQlr tdsyqr = new RegBusQlr();
								String tdqlr = "";
								RegBusFdcq2 fdcq2 = new RegBusFdcq2();
								fdcq2.setYwh(ywhStr);
								fdcq2.setBdcdyh(regBusBdcqzsdjxxtmp.getBdcdyh());
								List<RegBusFdcq2> fdcqlist = regBusFdcq2Service.findList(fdcq2);
								if (fdcqlist.size() > 0) {
									fdcq2 = fdcqlist.get(0);
									for (int t = 0; t < regBusQlrlist.size(); t++) {
										tdsyqr = regBusQlrlist.get(t);
										tdqlr += tdsyqr.getQlrmc() + ";";
									}
									fdcq2.setTdsyqr(tdqlr);
									regBusFdcq2Service.save(fdcq2);
								}
								RegBusQlr qlr = regBusQlrlist.get(0);
								// 第一权利人顺序号
								String sxh = qlr.getSxh().toString();
								// 点击修改传过来的权利人顺序号
								String sxh_1 = regBusQlr.getSxh().toString();
								if ("1".equals(sxh_1)) {
									if (regBusBdcqzsdjxxtmp != null) {
										regBusBdcqzsdjxxtmp.setQlrmc(regBusQlr.getQlrmc());
										regBusBdcqzsdjxxtmp.setGyqk(
												DictUtils.getDictLabel(regBusQlr.getGyfs(), "reg_bus_gyfs", ""));
										regBusBdcqzsdjxxService.save(regBusBdcqzsdjxxtmp);
									}
								}
							}
						}
					}
				}
			} else if (DJLX.equals("201") || DJLX.equals("203") || DJLX.equals("204") || DJLX.equals("202")
					|| DJLX.equals("601") || DJLX.equals("602") || DJLX.equals("208")) {
				// 权利人信息保存后反写登记信息权利人
				if (request.getParameter("optype") != null && !request.getParameter("optype").equals("")) {
					RegBusQlr regBusQlr1 = new RegBusQlr();
					regBusQlr1.setYwh(ywhStr);
					List<RegBusQlr> regBusQlrlist = regBusQlrService.findListSxh(regBusQlr1);
					if (regBusQlrlist.size() > 0) {
						if (request.getParameter("optype").equals(regBusQlrlist.get(0).getId())) {
							RegBusBdcqzsdjxx regBusBdcqzsdjxxtmp = new RegBusBdcqzsdjxx();
							regBusBdcqzsdjxxtmp.setYwh(ywhStr);
							List<RegBusBdcqzsdjxx> findList = regBusBdcqzsdjxxService.findList(regBusBdcqzsdjxxtmp);
							if (DJLX.equals("602")) {
								RegBaseZdjbxx zdjbxx = new RegBaseZdjbxx();
								zdjbxx.setZddm(findList.get(0).getZddm());
								zdjbxx.setIslogout("3");
								List<RegBaseZdjbxx> zdjbxxfindList = regBaseZdjbxxService.findList(zdjbxx);
								if (zdjbxxfindList.size() > 0) {
									zdjbxx = zdjbxxfindList.get(0);
									zdjbxx.setQlrxm(regBusQlr.getQlrmc());
									regBaseZdjbxxService.save(zdjbxx);
								}
							}
							if (findList.size() > 0) {
								for (int i = 0; i < findList.size(); i++) {
									regBusBdcqzsdjxxtmp = findList.get(0);
									regBusBdcqzsdjxxtmp.setQlrmc(regBusQlr.getQlrmc());
									regBusBdcqzsdjxxtmp
											.setGyqk(DictUtils.getDictLabel(regBusQlr.getGyfs(), "reg_bus_gyfs", ""));// 共有情况
									regBusBdcqzsdjxxService.save(regBusBdcqzsdjxxtmp);
								}
							}
						}
					}
				} else {
					RegBusBdcqzsdjxx regBusBdcqzsdjxxtmp = new RegBusBdcqzsdjxx();
					regBusBdcqzsdjxxtmp.setYwh(ywhStr);
					RegBusQlr regBusQlr1 = new RegBusQlr();
					regBusQlr1.setYwh(ywhStr);
					List<RegBusQlr> regBusQlrlist = regBusQlrService.findListSxh(regBusQlr1);
					if (regBusQlrlist.size() == 0) {
						List<RegBusBdcqzsdjxx> findList = regBusBdcqzsdjxxService.findList(regBusBdcqzsdjxxtmp);
						if (DJLX.equals("602")) {
							RegBaseZdjbxx zdjbxx = new RegBaseZdjbxx();
							zdjbxx.setZddm(findList.get(0).getZddm());
							zdjbxx.setIslogout("3");
							List<RegBaseZdjbxx> zdjbxxfindList = regBaseZdjbxxService.findList(zdjbxx);
							if (zdjbxxfindList.size() > 0) {
								zdjbxx = zdjbxxfindList.get(0);
								zdjbxx.setQlrxm(regBusQlr.getQlrmc());
								regBaseZdjbxxService.save(zdjbxx);
							}
						}
						if (findList.size() > 0) {
							for (int i = 0; i < findList.size(); i++) {
								regBusBdcqzsdjxxtmp = findList.get(i);
								regBusBdcqzsdjxxtmp.setQlrmc(regBusQlr.getQlrmc());
								regBusBdcqzsdjxxtmp
										.setGyqk(DictUtils.getDictLabel(regBusQlr.getGyfs(), "reg_bus_gyfs", ""));// 共有情况
								regBusBdcqzsdjxxService.save(regBusBdcqzsdjxxtmp);
							}
						}
					}
				}
			} else if (DJLX.equals("803")) {
				// 权利人信息保存后反写登记信息权利人
				if (request.getParameter("optype") != null && !request.getParameter("optype").equals("")) {
					RegBusQlr regBusQlr1 = new RegBusQlr();
					regBusQlr1.setYwh(ywhStr);
					List<RegBusQlr> regBusQlrlist = regBusQlrService.findListSxh(regBusQlr1);
					if (regBusQlrlist.size() > 0) {
						if (request.getParameter("optype").equals(regBusQlrlist.get(0).getId())) {
							RegBusBdcqzsdjxx regBusBdcqzsdjxxtmp = new RegBusBdcqzsdjxx();
							regBusBdcqzsdjxxtmp.setYwh(ywhStr);
							List<RegBusBdcqzsdjxx> findList = regBusBdcqzsdjxxService.findList(regBusBdcqzsdjxxtmp);
							if (findList.size() > 0) {
								for (int i = 0; i < findList.size(); i++) {
									regBusBdcqzsdjxxtmp = findList.get(0);
									regBusQlr.setBdcdyh(regBusBdcqzsdjxxtmp.getBdcdyh());
									regBusBdcqzsdjxxtmp.setQlrmc(regBusQlr.getQlrmc());
									regBusBdcqzsdjxxtmp
											.setGyqk(DictUtils.getDictLabel(regBusQlr.getGyfs(), "reg_bus_gyfs", ""));// 共有情况
									regBusBdcqzsdjxxService.save(regBusBdcqzsdjxxtmp);
								}
							}
						}
					}
				} else {
					RegBusBdcqzsdjxx regBusBdcqzsdjxxtmp = new RegBusBdcqzsdjxx();
					regBusBdcqzsdjxxtmp.setYwh(ywhStr);
					RegBusQlr regBusQlr1 = new RegBusQlr();
					regBusQlr1.setYwh(ywhStr);
					List<RegBusQlr> regBusQlrlist = regBusQlrService.findListSxh(regBusQlr1);
					if (regBusQlrlist.size() == 0) {
						List<RegBusBdcqzsdjxx> findList = regBusBdcqzsdjxxService.findList(regBusBdcqzsdjxxtmp);
						if (findList.size() > 0) {
							for (int i = 0; i < findList.size(); i++) {
								regBusBdcqzsdjxxtmp = findList.get(i);
								regBusQlr.setBdcdyh(regBusBdcqzsdjxxtmp.getBdcdyh());
								regBusBdcqzsdjxxtmp.setQlrmc(regBusQlr.getQlrmc());
								regBusBdcqzsdjxxtmp
										.setGyqk(DictUtils.getDictLabel(regBusQlr.getGyfs(), "reg_bus_gyfs", ""));// 共有情况
								regBusBdcqzsdjxxService.save(regBusBdcqzsdjxxtmp);
							}
						}
					}
				}
			} else if (DJLX.equals("214") || DJLX.equals("215")) {
				// 权利人信息保存后反写登记信息权利人
				if (request.getParameter("optype") != null && !request.getParameter("optype").equals("")) {
					RegBusQlr regBusQlr1 = new RegBusQlr();
					regBusQlr1.setYwh(ywhStr);
					RegBusDyaq regBusDyaq = new RegBusDyaq();
					regBusDyaq.setYwh(ywhStr);
					List<RegBusQlr> regBusQlrlist = regBusQlrService.findListSxh(regBusQlr1);
					if (regBusQlrlist.size() > 0) {
						if (request.getParameter("optype").equals(regBusQlrlist.get(0).getId())) {
							RegBusBdcqzsdjxx regBusBdcqzsdjxxtmp = new RegBusBdcqzsdjxx();
							regBusBdcqzsdjxxtmp.setYwh(ywhStr);
							List<RegBusBdcqzsdjxx> findList = regBusBdcqzsdjxxService.findList(regBusBdcqzsdjxxtmp);
							if (findList.size() > 0) {
								for (int i = 0; i < findList.size(); i++) {
									regBusBdcqzsdjxxtmp = findList.get(i);
									regBusBdcqzsdjxxtmp.setQlrmc(regBusQlr.getQlrmc());
									regBusBdcqzsdjxxtmp
											.setGyqk(DictUtils.getDictLabel(regBusQlr.getGyfs(), "reg_bus_gyfs", ""));// 共有情况
									regBusBdcqzsdjxxService.save(regBusBdcqzsdjxxtmp);
								}
							}
							List<RegBusDyaq> regBusDyaqlist = regBusDyaqService.findList(regBusDyaq);
							if (regBusDyaqlist.size() > 0) {
								for (int i = 0; i < regBusDyaqlist.size(); i++) {
									regBusDyaq = regBusDyaqlist.get(i);
									regBusDyaq.setDyqr(regBusQlr.getQlrmc());
									regBusDyaqService.save(regBusDyaq);
								}
							}
						}
					}
				} else {
					RegBusBdcqzsdjxx regBusBdcqzsdjxxtmp = new RegBusBdcqzsdjxx();
					RegBusDyaq regBusDyaq = new RegBusDyaq();
					regBusDyaq.setYwh(ywhStr);
					regBusBdcqzsdjxxtmp.setYwh(ywhStr);
					RegBusQlr regBusQlr1 = new RegBusQlr();
					regBusQlr1.setYwh(ywhStr);
					List<RegBusQlr> regBusQlrlist = regBusQlrService.findListSxh(regBusQlr1);
					if (regBusQlrlist.size() == 0) {
						List<RegBusBdcqzsdjxx> findList = regBusBdcqzsdjxxService.findList(regBusBdcqzsdjxxtmp);
						if (findList.size() > 0) {
							for (int i = 0; i < findList.size(); i++) {
								regBusBdcqzsdjxxtmp = findList.get(i);
								regBusBdcqzsdjxxtmp.setQlrmc(regBusQlr.getQlrmc());
								regBusBdcqzsdjxxtmp
										.setGyqk(DictUtils.getDictLabel(regBusQlr.getGyfs(), "reg_bus_gyfs", ""));// 共有情况
								regBusBdcqzsdjxxService.save(regBusBdcqzsdjxxtmp);
							}
						}
						List<RegBusDyaq> regBusDyaqlist = regBusDyaqService.findList(regBusDyaq);
						if (regBusDyaqlist.size() > 0) {
							for (int i = 0; i < regBusDyaqlist.size(); i++) {
								regBusDyaq = regBusDyaqlist.get(i);
								regBusDyaq.setDyqr(regBusQlr.getQlrmc());
								regBusDyaqService.save(regBusDyaq);
							}
						}
					}
				}
			} else if (DJLX.equals("804") || DJLX.equals("807") || DJLX.equals("209") || DJLX.equals("213")
					|| DJLX.equals("315") || DJLX.equals("316") || DJLX.equals("317") || DJLX.equals("318")
					|| DJLX.equals("818") || DJLX.equals("217") || DJLX.equals("605") || DJLX.equals("606")
					|| DJLX.equals("607") || DJLX.equals("608")) {
				RegBusDyaq regBusDyaq = new RegBusDyaq();
				regBusDyaq.setYwh(ywhStr);
				List<RegBusDyaq> regBusDyaqlist = regBusDyaqService.findList(regBusDyaq);
				if (regBusDyaqlist.size() > 0) {// 如果有数据,反写权利人
					// 权利人信息保存后反写登记信息权利人
					if (request.getParameter("optype") != null && !request.getParameter("optype").equals("")) {
						RegBusQlr regBusQlr1 = new RegBusQlr();
						regBusQlr1.setYwh(ywhStr);
						regBusDyaq.setYwh(ywhStr);
						List<RegBusQlr> regBusQlrlist = regBusQlrService.findListSxh(regBusQlr1);
						if (regBusQlrlist.size() > 0) {
							if (request.getParameter("optype").equals(regBusQlrlist.get(0).getId())) {
								RegBusBdcqzsdjxx regBusBdcqzsdjxxtmp = new RegBusBdcqzsdjxx();
								regBusBdcqzsdjxxtmp.setYwh(ywhStr);
								List<RegBusBdcqzsdjxx> findList = regBusBdcqzsdjxxService.findList(regBusBdcqzsdjxxtmp);
								if (findList.size() > 0) {
									for (int i = 0; i < findList.size(); i++) {
										regBusBdcqzsdjxxtmp = findList.get(i);
										regBusBdcqzsdjxxtmp.setQlrmc(regBusQlr.getQlrmc());
										regBusBdcqzsdjxxtmp.setGyqk(
												DictUtils.getDictLabel(regBusQlr.getGyfs(), "reg_bus_gyfs", ""));// 共有情况
										regBusBdcqzsdjxxService.save(regBusBdcqzsdjxxtmp);
									}
								}
								if (regBusDyaqlist.size() > 0) {
									for (int i = 0; i < regBusDyaqlist.size(); i++) {
										regBusDyaq = regBusDyaqlist.get(i);
										regBusDyaq.setDyqr(regBusQlr.getQlrmc());
										regBusDyaqService.save(regBusDyaq);
									}
								}
							}
						}
					} else {
						RegBusBdcqzsdjxx regBusBdcqzsdjxxtmp = new RegBusBdcqzsdjxx();
						regBusDyaq.setYwh(ywhStr);
						regBusBdcqzsdjxxtmp.setYwh(ywhStr);
						RegBusQlr regBusQlr1 = new RegBusQlr();
						regBusQlr1.setYwh(ywhStr);
						List<RegBusQlr> regBusQlrlist = regBusQlrService.findListSxh(regBusQlr1);
						if (regBusQlrlist.size() == 0) {
							List<RegBusBdcqzsdjxx> findList = regBusBdcqzsdjxxService.findList(regBusBdcqzsdjxxtmp);
							if (findList.size() > 0) {
								for (int i = 0; i < findList.size(); i++) {
									regBusBdcqzsdjxxtmp = findList.get(i);
									regBusBdcqzsdjxxtmp.setQlrmc(regBusQlr.getQlrmc());
									regBusBdcqzsdjxxtmp
											.setGyqk(DictUtils.getDictLabel(regBusQlr.getGyfs(), "reg_bus_gyfs", ""));// 共有情况
									regBusBdcqzsdjxxService.save(regBusBdcqzsdjxxtmp);
								}
							}
							if (regBusDyaqlist.size() > 0) {
								for (int i = 0; i < regBusDyaqlist.size(); i++) {
									regBusDyaq = regBusDyaqlist.get(i);
									regBusDyaq.setDyqr(regBusQlr.getQlrmc());
									regBusDyaqService.save(regBusDyaq);
								}
							}
						}
					}
				}
			} else if (DJLX.equals("305") || DJLX.equals("306") || DJLX.equals("307") || DJLX.equals("301")
					|| DJLX.equals("304") || DJLX.equals("309") || DJLX.equals("220") || DJLX.equals("439")
					|| DJLX.equals("639") || DJLX.equals("339")) {
				// 权利人信息保存后反写登记信息权利人
				RegBusBdcqzsdjxx regBusBdcqzsdjxxtmp = new RegBusBdcqzsdjxx();
				regBusBdcqzsdjxxtmp.setYwh(ywhStr);
				List<RegBusBdcqzsdjxx> findList = regBusBdcqzsdjxxService.findList(regBusBdcqzsdjxxtmp);
				if (findList.size() > 0) {
					regBusBdcqzsdjxxtmp = findList.get(0);
					xmqllx = regBusBdcqzsdjxxtmp.getQllx();
					regBusQlr.setBdcdyh(regBusBdcqzsdjxxtmp.getBdcdyh());
					RegBusQlr regBusQlr_1 = new RegBusQlr();
					regBusQlr_1.setYwh(ywhStr);
					// 第一条是第一权利人信息
					List<RegBusQlr> regBusQlrlist = regBusQlrService.findListSxh(regBusQlr_1);
					// 查出当前业务号下总条数,如果大于1则说明是多个权利人,则只反写第一次添加时候的权利人
					if (regBusQlrlist.size() <= 0) {
						// 说明权利人信息未添加
						regBusBdcqzsdjxxtmp.setQlrmc(regBusQlr.getQlrmc());
						regBusBdcqzsdjxxtmp.setGyqk(DictUtils.getDictLabel(regBusQlr.getGyfs(), "reg_bus_gyfs", ""));
						regBusBdcqzsdjxxService.save(regBusBdcqzsdjxxtmp);
					} else {
						RegBusQlr qlr = regBusQlrlist.get(0);
						// 第一权利人顺序号
						String sxh = qlr.getSxh().toString();
						// 点击修改传过来的权利人顺序号
						String sxh_1 = regBusQlr.getSxh().toString();
						if (sxh.equals(sxh_1) && request.getParameter("optype").equals(regBusQlrlist.get(0).getId())) {
							if (request.getParameter("optype") != null || !request.getParameter("optype").equals("")) {
								regBusBdcqzsdjxxtmp.setQlrmc(regBusQlr.getQlrmc());
								regBusBdcqzsdjxxtmp
										.setGyqk(DictUtils.getDictLabel(regBusQlr.getGyfs(), "reg_bus_gyfs", ""));
								regBusBdcqzsdjxxService.save(regBusBdcqzsdjxxtmp);
							}
						}
					}
				}
			}
		}
		// 修改人员信息
		if (StringUtils.isNotBlank(request.getParameter("XG"))) {
			regBusQlrService.saveqlr(regBusQlr);
			if ("1".equals(MZ01)) {// 验证接口
				try {
					updateMZQlr(regBusQlr, "save");
					addMessage(redirectAttributes, "保存权利人信息成功");
				} catch (ServiceException e) {
					addMessage(redirectAttributes, "获取权利人配偶信息失败,失败原因:【" + e.getMessage() + "】,请注意手工处理");
					e.printStackTrace();
				}
			} else {
				addMessage(redirectAttributes, "保存权利人信息成功");
			}
			if (DJLX.equals("806") || DJLX.equals("609")) {
				String tdsyqr = "";
				RegBusQlr regBusQlr_2 = new RegBusQlr();
				regBusQlr_2.setYwh(ywhStr);
				// 第一条是第一权利人信息
				List<RegBusQlr> regBusQlrlist_2 = regBusQlrService.findListSxh(regBusQlr_2);
				// 反写土地使用权人
				for (int i = 0; i < regBusQlrlist_2.size(); i++) {
					regBusQlr_2 = regBusQlrlist_2.get(i);
					tdsyqr += regBusQlr_2.getQlrmc() + ";";
				}
				// 查询权属信息
				RegBusYgdj regBusygdj_3 = new RegBusYgdj();
				regBusygdj_3.setYwh(ywhStr);
				List<RegBusYgdj> regBusygdjlist = regBusYgdjService.findList(regBusygdj_3);
				if (regBusygdjlist.size() > 0) {
					regBusygdj_3 = regBusygdjlist.get(0);
					regBusygdj_3.setTdsyqr(tdsyqr);
					regBusYgdjService.save(regBusygdj_3);
				}
			}
			if (DJLX.equals("201") || DJLX.equals("203") || DJLX.equals("204") || DJLX.equals("202")
					|| DJLX.equals("601") || DJLX.equals("602")) {
				if (regBusQlr.getSxh() == 1) {// 保存第一权利人时,刷新权属iframe和登记信息iframe
					DJLX = "201";
				}
			}
			if (DJLX.equals("208")) {
				DJLX = "208";
			}
			if (DJLX.equals("804") || DJLX.equals("807") || DJLX.equals("209") || DJLX.equals("213")
					|| DJLX.equals("315") || DJLX.equals("316") || DJLX.equals("317") || DJLX.equals("318")
					|| DJLX.equals("818") || DJLX.equals("605") || DJLX.equals("606") || DJLX.equals("607")
					|| DJLX.equals("608") || DJLX.equals("214") || DJLX.equals("215") || DJLX.equals("217")) {
				if (regBusQlr.getSxh() == 1) {// 保存第一权利人时,刷新权属iframe和登记信息iframe
					DJLX = "214215";
				}
			}
		} else {
			// 此处添加权利人权利类型,根据得及小类判断
			// 抵押权利类型为24抵押权
			if ("213".equals(DJLX) || "214".equals(DJLX) || "215".equals(DJLX) || "422".equals(DJLX)
					|| "317".equals(DJLX) || "318".equals(DJLX) || "316".equals(DJLX) || "209".equals(DJLX)
					|| "315".equals(DJLX) || DJLX.equals("605") || DJLX.equals("606") || DJLX.equals("608")
					|| DJLX.equals("217")) {
				regBusQlr.setQllx("24");
			}
			// 预告权利类型为27预告登记
			if ("803".equals(DJLX) || "818".equals(DJLX) || "806".equals(DJLX) || "811".equals(DJLX)
					|| "812".equals(DJLX) || "810".equals(DJLX) || "609".equals(DJLX) || "809".equals(DJLX)
					|| "819".equals(DJLX) || "804".equals(DJLX) || "807".equals(DJLX) || "607".equals(DJLX)) {
				regBusQlr.setQllx("27");
			}
			// 所有权利类型为4所有权
			if ("207".equals(DJLX) || "416".equals(DJLX) || "302".equals(DJLX) || "205".equals(DJLX)) {
				regBusQlr.setQllx("4");
			}
			// 集体土地所有权1
			if ("202".equals(DJLX) || "301".equals(DJLX)) {
				regBusQlr.setQllx("1");
			}
			
			// 使用权利类型为3,5,7使用权国有
			if ("201".equals(DJLX) || "305".equals(DJLX)) {
				regBusQlr.setQllx("3");
			}
			// 使用权利类型为23使用权国有农用地
			if ("309".equals(DJLX)) {
				regBusQlr.setQllx("23");
			}
			// 使用权利类型为3,5,7使用权集体
			if ("203".equals(DJLX) || "306".equals(DJLX)) {
				regBusQlr.setQllx("7");
			}
			// 使用权利类型为3,5,7使用权宅基地
			if ("204".equals(DJLX) || "307".equals(DJLX)) {
				regBusQlr.setQllx("5");
			}
			//林权
			if ("205".equals(DJLX) || "304".equals(DJLX)) {
				regBusQlr.setQllx("36");
			}
			if ("521".equals(DJLX)) {
				regBusQlr.setQllx("6");
			}
			// 项目多幢取djxx表中的数据
			if ("220".equals(DJLX) || "521".equals(DJLX) || "439".equals(DJLX) || "639".equals(DJLX)
					|| "339".equals(DJLX)) {
				regBusQlr.setQllx(xmqllx);
			}
			// 异议权利类型为23异议
			if ("701".equals(DJLX) || "702".equals(DJLX) || "703".equals(DJLX) || "704".equals(DJLX)) {
				regBusQlr.setQllx("25");
			}
			// 查封权利类型为22查封
			if ("901".equals(DJLX) || "904".equals(DJLX) || "905".equals(DJLX) || "906".equals(DJLX)
					|| "907".equals(DJLX) || "908".equals(DJLX) || "910".equals(DJLX) || "912".equals(DJLX)) {
				regBusQlr.setQllx("26");
			}
			if (DJLX.equals("201") || DJLX.equals("203") || DJLX.equals("204") || DJLX.equals("202")
					|| DJLX.equals("601") || DJLX.equals("602")) {
				if (regBusQlr.getSxh() == 1) {// 保存第一权利人时,刷新权属iframe和登记信息iframe
					DJLX = "201";
				}
			}
			if (DJLX.equals("208")) {
				DJLX = "208";
			}
			if (DJLX.equals("804") || DJLX.equals("807") || DJLX.equals("209") || DJLX.equals("213")
					|| DJLX.equals("315") || DJLX.equals("316") || DJLX.equals("317") || DJLX.equals("318")
					|| DJLX.equals("818") || DJLX.equals("605") || DJLX.equals("606") || DJLX.equals("607")
					|| DJLX.equals("608") || DJLX.equals("214") || DJLX.equals("215") || DJLX.equals("217")) {
				if (regBusQlr.getSxh() == 1) {// 保存第一权利人时,刷新权属iframe和登记信息iframe
					DJLX = "214215";
				}
			}
			// 所有变更更正,更名注销业务获取上一笔权利人类型
			if (DJLX.equals("604") || "421".equals(DJLX)) {
				RegBusBdcqzsdjxx regBusBdcqzsdjxx = new RegBusBdcqzsdjxx();
				regBusBdcqzsdjxx.setYwh(regBusQlr.getYwh());
				List<RegBusBdcqzsdjxx> findList = regBusBdcqzsdjxxService.findList(regBusBdcqzsdjxx);
				if (findList.size() > 0) {
					regBusBdcqzsdjxx = findList.get(0);
					String[] oldid = regBusBdcqzsdjxx.getOldid().split(";");
					regBusBdcqzsdjxx = regBusBdcqzsdjxxService.get(oldid[0]);
					RegBusQlr regBusQlrOld = new RegBusQlr();
					regBusQlrOld.setYwh(regBusBdcqzsdjxx.getYwh());
					List<RegBusQlr> findListSxh = regBusQlrService.findListSxh(regBusQlrOld);
					if (findListSxh.size() > 0) {
						regBusQlrOld = findListSxh.get(0);
						regBusQlr.setQllx(regBusQlrOld.getQllx());
					}
				}
			}
			RegBusQlr ql = new RegBusQlr();
			ql.setQlrmc(regBusQlr.getQlrmc());
			ql.setZjh(regBusQlr.getZjh());
			ql.setYwh(regBusQlr.getYwh());
			List<RegBusQlr> qllist = regBusQlrService.findList_1(ql);
			if (qllist.size() <= 0) {
				regBusQlr.setQszt("0");
				regBusQlr.setYsdm("6003000000");
				regBusQlrService.saveqlr(regBusQlr);
				if ("1".equals(MZ01)) {// 验证接口
					try {
						updateMZQlr(regBusQlr, "save");
						addMessage(redirectAttributes, "保存权利人信息成功");
					} catch (ServiceException e) {
						addMessage(redirectAttributes, "获取权利人配偶信息失败,失败原因:【" + e.getMessage() + "】,请注意手工处理");
						e.printStackTrace();
					}
				}
			}
		}

		// 土地使用权人反写
		if ("302".equals(DJLX) || DJLX.equals("604")) {
			RegBusQlr regBusQlrnew = new RegBusQlr();
			String tdqlr = "";
			regBusQlrnew.setYwh(ywhStr);
			List<RegBusQlr> regBusQlrlist = regBusQlrService.findListSxh(regBusQlrnew);
			if (regBusQlrlist.size() > 0) {
				for (int i = 0; i < regBusQlrlist.size(); i++) {
					regBusQlrnew = regBusQlrlist.get(i);
					tdqlr += regBusQlrnew.getQlrmc() + ";";
				}
				RegBusFdcq2 fdcq2 = new RegBusFdcq2();
				fdcq2.setYwh(ywhStr);
				List<RegBusFdcq2> fdcq2list = regBusFdcq2Service.findList(fdcq2);
				if (fdcq2list.size() > 0) {
					fdcq2 = fdcq2list.get(0);
					fdcq2.setTdsyqr(tdqlr);
					regBusFdcq2Service.save(fdcq2);
				}
			}
		}
		// 修改人员信息的状态为已引用
		if (StringUtils.isNotBlank(regBusQlr.getZjh())) {
			RegBasePerson regBasePerson = new RegBasePerson();
			regBasePerson.setZjh(regBusQlr.getZjh());
			regBasePerson.setZjzl(regBusQlr.getZjzl());
			List<RegBasePerson> findPersonList = regBasePersonService.findList(regBasePerson);
			if (findPersonList.size() > 0) {
				regBasePerson = findPersonList.get(0);
				regBasePerson.setIsaudit("2");
				regBasePersonService.save(regBasePerson);
			}
		}
		} else {
			addMessage(redirectAttributes, "添加权利人信息失败,权利人"+regBusQlr.getQlrmc()+"信息在业务中已存在");
		}

		if (StringUtils.isNotBlank(qlrxxxz)) {
			return "redirect:" + Global.getAdminPath() + "/reg/bus/regBusQlr/selectedList?QLRXXXZ=1&ywh=" + ywhStr;
		}
		return "redirect:" + Global.getAdminPath() + "/reg/bus/regBusQlr/list?SXBGLX=" + request.getParameter("SXBGLX")
				+ "&WO=1&ywh=" + ywhStr + "&optype=" + request.getParameter("optype") + "&DJLX=" + DJLX + "&opty="
				+ request.getParameter("opty");
	}

	/**
	 * 根据当前权利人查询配偶信息并且进行保存或者删除
	 * 
	 * @param regBusQlr
	 * @param flag
	 * @throws JsonParseException
	 * @throws JsonMappingException
	 * @throws IOException
	 * @throws ServiceException
	 */
	private void updateMZQlr(RegBusQlr regBusQlr, String flag)
			throws JsonParseException, JsonMappingException, IOException, ServiceException {
		String str = "{" + "\"" + "cert_num" + "\"" + ":" + "\"" + regBusQlr.getZjh() + "\"" + "," + "\"" + "name"
				+ "\"" + ":" + "\"" + regBusQlr.getQlrmc() + "\"" + "}";
		String si_code = "in/MZ01";
		RegBusInterHis interhis = new RegBusInterHis();
		RegBasePerson person = new RegBasePerson();
		person.setRymc(regBusQlr.getQlrmc());
		person.setZjzl("1");
		person.setZjh(regBusQlr.getZjh());
		List<RegBasePerson> personlst = regBasePersonService.findListqy(person);
		if (personlst.size() > 0) {
			person = personlst.get(0);
		}
		 interhis.setChyw("权利人保存");
		 interhis.setJklx(si_code);
		 interhis.setJkmc("婚姻状态");
		 interhis.setRymc(regBusQlr.getQlrmc() );
		 interhis.setZjhm(regBusQlr.getZjh());
		 interhis.setPersonid(person.getId());
		 interhis.setPcode(regBusQlr.getPcode());
		 interhis.setInparam(str);
		 interhis.setYwh(regBusQlr.getYwh()); 
		 interhis.setQlrid(regBusQlr.getId());
		
		if ("1".equals(regBusQlr.getZjzl()) && "1".equals(regBusQlr.getQlrlx())) {
			Map resmap = siService.si_post1(str,interhis, si_code); 
			
			if (resmap.containsKey("data")) {
				Map data = (Map) resmap.get("data");
				interhis.setVeritydatazt("1");
				if (data.containsKey("op_type")) { 
					
					String op_type = (String) data.get("op_type");
					
					if ("IA".equals(op_type) || "IC".equals(op_type) || "ICA".equals(op_type)) {
						
						if ("0".equals(regBusQlr.getGyfs())) {
							regBusQlr.setGyfs("1");
							regBusQlr.setGyqk(DictUtils.getDictLabel(regBusQlr.getGyfs(), "reg_bus_gyfs", ""));
							regBusQlr.setQlbl("");
							regBusQlrService.save(regBusQlr);
							
							
							RegBusBdcqzsdjxx regBusBdcqzsdjxxtmp = new RegBusBdcqzsdjxx();
							regBusBdcqzsdjxxtmp.setYwh(regBusQlr.getYwh());
							List<RegBusBdcqzsdjxx> findList = regBusBdcqzsdjxxService.findList(regBusBdcqzsdjxxtmp);
							if (findList.size() > 0) {
								for (int i = 0; i < findList.size(); i++) {
									regBusBdcqzsdjxxtmp = findList.get(i); 
									regBusBdcqzsdjxxtmp.setGyqk(
											DictUtils.getDictLabel(regBusQlr.getGyfs(), "reg_bus_gyfs", ""));// 共有情况
									regBusBdcqzsdjxxService.save(regBusBdcqzsdjxxtmp);
								}
							}
						} 
						
						RegBusQlr regBusQlr1 = new RegBusQlr();
						RegBusQlr regBusQlr2 = new RegBusQlr();
						regBusQlr1.setQlrmc((String) data.get("name_man"));
						regBusQlr1.setZjh((String) data.get("cert_num_man"));
						regBusQlr1.setYwh(regBusQlr.getYwh());
						regBusQlr2.setQlrmc((String) data.get("name_woman"));
						regBusQlr2.setZjh((String) data.get("cert_num_woman"));
						regBusQlr2.setYwh(regBusQlr.getYwh());
						
						Map map = Maps.newHashMap();
						map.put("男姓名", regBusQlr1.getQlrmc());
						map.put("男证件号码", regBusQlr1.getZjh());
						map.put("女姓名", regBusQlr2.getQlrmc());
						map.put("女证件号码", regBusQlr2.getZjh());
						map.put("状态", "结婚");
						interhis.setVeritydatamsg("数据核查通过 数据内容:"+JsonUtil.toJsonString(map));
						
						if ("save".equals(flag)) {
							if (!regBusQlr.getQlrmc().equals(regBusQlr1.getQlrmc())
									&& !regBusQlr.getZjh().equals(regBusQlr1.getZjh())) {
								
								List list  = regBusQlrService.findList_1(regBusQlr1);
								if(list != null && list.size() >=0) {
									logger.info("配偶 姓名:"+regBusQlr1.getQlrmc()+" 证件号码:"+regBusQlr1.getZjh()+"在权利人中已存在");
								}
								
								RegBasePerson regBasePerson = new RegBasePerson();
								regBasePerson.setRymc((String) data.get("name_man"));
								regBasePerson.setZjzl("1");
								regBasePerson.setZjh((String) data.get("cert_num_man"));
								List<RegBasePerson> findListqy = regBasePersonService.findListqy(regBasePerson);
								if (findListqy.size() > 0) {
									regBasePerson = findListqy.get(0);
									regBusQlr1.setHjszss(regBasePerson.getHjszss());
									regBusQlr1.setDz(regBasePerson.getDz());
									regBusQlr1.setDh(regBasePerson.getDh());
									regBusQlr1.setGzdw(regBasePerson.getGzdw());
									regBusQlr1.setDzyj(regBasePerson.getDzyj());
									regBusQlr1.setDlrmc(regBasePerson.getDlrymc());
									regBusQlr1.setDlrdh(regBasePerson.getDlrydh());
								} else {
									String pCode = "1000000";
									pCode = RegUtils.getHMaxFwbm(regBasePersonService.getHMaxPCode());// 没有的时候返回100000,然后+1最为第一笔
									regBasePerson.setPcode(pCode);
									regBasePerson.setGj(person.getGj());
									regBasePerson.setDz(person.getDz());
									regBasePerson.setRylx(person.getRylx());
									regBasePerson.setBz("民政婚姻接口带入-基础信息插入");
									regBasePerson.setIsaudit(person.getIsaudit());
									regBasePerson.setVeritydatazt(person.getVeritydatazt());
									regBusQlr1.setHjszss(regBusQlr.getHjszss());
									regBusQlr1.setDz(regBusQlr.getDz());
									regBusQlr1.setDh(regBusQlr.getDh());
									regBusQlr1.setGzdw(regBusQlr.getGzdw());
									regBusQlr1.setDzyj(regBusQlr.getDzyj());
									regBusQlr1.setDlrmc(regBusQlr.getDlrmc());
									regBusQlr1.setDlrdh(regBusQlr.getDlrdh());
								}
								regBusQlr1.setPcode(regBasePerson.getPcode());
								regBusQlr1.setZjzl("1");
								regBusQlr1.setGj("142");
								regBusQlr1.setXb("1");
								regBusQlr1.setSfczr(regBusQlr.getSfczr());
								regBusQlr1.setFzjg(regBusQlr.getFzjg());
								regBusQlr1.setYsdm(regBusQlr.getYsdm());
								regBusQlr1.setQllx(regBusQlr.getQllx());
								regBusQlr1.setQszt(regBusQlr.getQszt());
								regBusQlr1.setQlrlx(regBusQlr.getQlrlx());
								regBusQlr1.setGyfs(regBusQlr.getGyfs());
								regBusQlr1.setGyqk(regBusQlr.getGyqk());
								regBusQlr1.setBz("民政婚姻接口带入-权利人");
								regBasePersonService.save(regBasePerson);
								regBusQlr1.setSxh(getQlrmcOrderNumber(regBusQlr.getYwh()));
								regBusQlrService.save(regBusQlr1);
							} else if (!regBusQlr.getQlrmc().equals(regBusQlr2.getQlrmc())
									&& !regBusQlr.getZjh().equals(regBusQlr2.getZjh())) {
								
								List list  = regBusQlrService.findList_1(regBusQlr1);
								if(list != null && list.size() >=0) {
									logger.info("配偶 姓名:"+regBusQlr1.getQlrmc()+" 证件号码:"+regBusQlr1.getZjh()+"在权利人中已存在");
								}
								
								RegBasePerson regBasePerson = new RegBasePerson();
								regBasePerson.setRymc((String) data.get("name_woman"));
								regBasePerson.setZjzl("1");
								regBasePerson.setZjh((String) data.get("cert_num_woman"));
								List<RegBasePerson> findListqy = regBasePersonService.findListqy(regBasePerson);
								if (findListqy.size() > 0) {
									regBasePerson = findListqy.get(0);
									regBusQlr2.setHjszss(regBasePerson.getHjszss());
									regBusQlr2.setDz(regBasePerson.getDz());
									regBusQlr2.setDh(regBasePerson.getDh());
									regBusQlr2.setGzdw(regBasePerson.getGzdw());
									regBusQlr2.setDzyj(regBasePerson.getDzyj());
									regBusQlr2.setDlrmc(regBasePerson.getDlrymc());
									regBusQlr2.setDlrdh(regBasePerson.getDlrydh());
								} else {
									String pCode = "1000000";
									pCode = RegUtils.getHMaxFwbm(regBasePersonService.getHMaxPCode());// 没有的时候返回100000,然后+1最为第一笔
									regBasePerson.setPcode(pCode);
									regBasePerson.setGj(person.getGj());
									regBasePerson.setDz(person.getDz());
									regBasePerson.setRylx(person.getRylx());
									regBasePerson.setBz("民政婚姻接口带入-基础信息插入");
									regBasePerson.setIsaudit(person.getIsaudit());
									regBasePerson.setVeritydatazt(person.getVeritydatazt());
									regBusQlr2.setHjszss(regBusQlr.getHjszss());
									regBusQlr2.setDz(regBusQlr.getDz());
									regBusQlr2.setDh(regBusQlr.getDh());
									regBusQlr2.setGzdw(regBusQlr.getGzdw());
									regBusQlr2.setDzyj(regBusQlr.getDzyj());
									regBusQlr2.setDlrmc(regBusQlr.getDlrmc());
									regBusQlr2.setDlrdh(regBusQlr.getDlrdh());
								}
								regBusQlr2.setZjzl("1");
								regBusQlr2.setGj("142");
								regBusQlr2.setXb("2");
								regBusQlr2.setPcode(regBasePerson.getPcode());
								regBusQlr2.setSfczr(regBusQlr.getSfczr());
								regBusQlr2.setFzjg(regBusQlr.getFzjg());
								regBusQlr2.setYsdm(regBusQlr.getYsdm());
								regBusQlr2.setQllx(regBusQlr.getQllx());
								regBusQlr2.setQszt(regBusQlr.getQszt());
								regBusQlr2.setQlrlx(regBusQlr.getQlrlx());
								regBusQlr2.setGyfs(regBusQlr.getGyfs());
								regBusQlr2.setGyqk(regBusQlr.getGyqk());
								regBusQlr2.setSxh(getQlrmcOrderNumber(regBusQlr.getYwh()));
								regBusQlr2.setBz("民政婚姻接口带入-权利人");
								regBasePersonService.save(regBasePerson);
								regBusQlrService.save(regBusQlr2);
							}
						}
					}else {
						Map map = Maps.newHashMap();
						map.put("男姓名", data.get("name_man"));
						map.put("男证件号码",  data.get("cert_num_man"));
						map.put("女姓名",  data.get("name_woman"));
						map.put("女证件号码", data.get("cert_num_woman"));
						map.put("状态", "离婚");
						interhis.setVeritydatamsg("数据核查通过 数据内容:"+JsonUtil.toJsonString(map));
					}
				}else {
					interhis.setVeritydatamsg("数据内容:配偶信息为空");
				}
			}else {
				interhis.setVeritydatamsg("数据核查未通过 未接收到返回信息");
				interhis.setVeritydatazt("2");
			}
			User user = UserUtils.getUser();
			interhis.setCreateby(user.getId());
			interhis.setCreateuser(user.getLoginName());
			interhis.setCreateDate(new Date());
			siService.save(interhis);
		}
	}

	@RequiresPermissions("reg:bus:regBusQlr:edit")
	@RequestMapping(value = "delete")
	public String delete(RegBusQlr regBusQlr, RedirectAttributes redirectAttributes, HttpServletRequest request)
			throws JsonParseException, JsonMappingException, IOException, ServiceException {
		Map<String, String> map = new HashMap<String, String>();
		String ywhStr = request.getParameter("YWH");
		if (StringUtils.isNotBlank(ywhStr)) {
			RegBusQlr regBusQlr1 = new RegBusQlr();
			regBusQlr1.setYwh(ywhStr);
			List<RegBusQlr> regBusQlrlist = regBusQlrService.findListSxh(regBusQlr1);
			regBusQlr = regBusQlrService.get(regBusQlr.getId());
			if (regBusQlrlist.size() > 0) {
				regBusQlr1 = regBusQlrlist.get(regBusQlrlist.size() - 1);
				if (regBusQlr1.getSxh() > regBusQlr.getSxh()) {// 判断当前顺序号是否是最大顺序号
					addMessage(redirectAttributes, "请先删除最大顺序号权利人!");
				} else {
					if(StringUtils.isNotBlank(regBusQlr.getPic())) {
						String picpath = Global.getPictures();
						  String realpath = picpath + regBusQlr.getPic();
						  File file =new File(realpath);
						  if(file.exists()){
							  file.delete();
						  }
					}
					regBusQlrService.delete(regBusQlr);
					map.put("ywh", ywhStr);
					map.put("qlrid", regBusQlr.getId());
					regBusQlrService.updateRelationYwhIsuse(map);
					addMessage(redirectAttributes, "删除权利人信息成功");
				}
			} else {
				addMessage(redirectAttributes, "删除权利人信息失败!");
			}
		} else {
			addMessage(redirectAttributes, "删除权利人信息失败!");
		}
		return "redirect:" + Global.getAdminPath() + "/reg/bus/regBusQlr/?repage&ywh=" + request.getParameter("YWH");
	}

	@RequiresPermissions("reg:bus:regBusQlr:edit")
	@RequestMapping(value = "deletegmqlr")
	public String deletegmqlr(RegBusQlr regBusQlr, RedirectAttributes redirectAttributes, HttpServletRequest request) {
		if (StringUtils.isNotBlank(regBusQlr.getId())) {
			regBusQlrService.delete(regBusQlr);
			addMessage(redirectAttributes, "删除权利人信息成功!");
		}
		return "redirect:" + Global.getAdminPath() + "/reg/bus/regBusQlr/fwgmdjlist?ts=1&ywh="
				+ request.getParameter("YWH");
	}

	/**
	 * 房屋预告更名删除
	 * 
	 * @param regBusQlr
	 * @param redirectAttributes
	 * @param request
	 * @return
	 */
	@RequiresPermissions("reg:bus:regBusQlr:edit")
	@RequestMapping(value = "deleteyggmqlr")
	public String deleteyggmqlr(RegBusQlr regBusQlr, RedirectAttributes redirectAttributes,
			HttpServletRequest request) {
		if (StringUtils.isNotBlank(regBusQlr.getId())) {
			regBusQlrService.delete(regBusQlr);
			addMessage(redirectAttributes, "删除权利人信息成功!");
		}
		return "redirect:" + Global.getAdminPath() + "/reg/bus/regBusQlr/fwgmdjlist?ywh=" + request.getParameter("YWH")
				+ "&gm=" + request.getParameter("gm") + "&bj=" + request.getParameter("bj");
	}

	/***
	 * @Title: getQlrmcByYwh @Description: 通过业务号获取权利人名称 @param @param
	 * ywhStr @param @return 设定文件 @return String 返回类型 @throws
	 */
	public String getQlrmcByYwh(String ywhStr) {
		String qlrmc = "";
		if (StringUtils.isBlank(ywhStr)) {
			return qlrmc;
		}
		// 首先获取权利人 ID
		List<String> qlrIDList = new ArrayList<String>();
		RegBusQlrRelationYwh regBusQlrRelationYwh = new RegBusQlrRelationYwh();
		regBusQlrRelationYwh.setYwh(ywhStr);
		List<RegBusQlrRelationYwh> regBusQlrRelationYwhList = regBusQlrRelationYwhDao.findList(regBusQlrRelationYwh);
		if (regBusQlrRelationYwhList.size() > 0) {
			for (int i = 0; i < regBusQlrRelationYwhList.size(); i++) {
				qlrIDList.add(regBusQlrRelationYwhList.get(i).getQlrid());
			}
		}

		// 通过权利人ID获取权利人实体list
		List<RegBusQlr> regBusQlrList = new ArrayList<RegBusQlr>();
		if (qlrIDList.size() > 0) {
			for (int j = 0; j < qlrIDList.size(); j++) {
				regBusQlrList.add(regBusQlrService.get(qlrIDList.get(j)));
			}
		}
		// 开始构造权利人姓名字符串
		if (regBusQlrList.size() > 0) {
			for (int k = 0; k < regBusQlrList.size(); k++) {
				qlrmc += regBusQlrList.get(k).getQlrmc() + "  ";
			}
		}
		return qlrmc;
	}

	/***
	 * @Title: getQlrmcByYwh @Description: 通过业务号获取权利人名称 @param @param
	 * ywhStr @param @return 设定文件 @return String 返回类型 @throws
	 */
	public Map<String, String> getQlrmcAndGyqkByYwh(String ywhStr) {
		Map<String, String> map = new HashMap<String, String>();
		if (StringUtils.isBlank(ywhStr)) {
			return null;
		}
		String qlrmc = "";
		String qlgyqk = "";
		// 首先获取权利人 ID
		List<String> qlrIDList = new ArrayList<String>();
		RegBusQlrRelationYwh regBusQlrRelationYwh = new RegBusQlrRelationYwh();
		regBusQlrRelationYwh.setYwh(ywhStr);
		List<RegBusQlrRelationYwh> regBusQlrRelationYwhList = regBusQlrRelationYwhDao.findList(regBusQlrRelationYwh);
		if (regBusQlrRelationYwhList.size() > 0) {
			for (int i = 0; i < regBusQlrRelationYwhList.size(); i++) {
				qlrIDList.add(regBusQlrRelationYwhList.get(i).getQlrid());
			}
		}

		// 通过权利人ID获取权利人实体list
		List<RegBusQlr> regBusQlrList = new ArrayList<RegBusQlr>();
		if (qlrIDList.size() > 0) {
			for (int j = 0; j < qlrIDList.size(); j++) {
				regBusQlrList.add(regBusQlrService.get(qlrIDList.get(j)));
			}
		}
		// 开始构造权利人姓名字符串
		if (regBusQlrList.size() > 0) {
			for (int k = 0; k < regBusQlrList.size(); k++) {
				qlrmc += regBusQlrList.get(k).getQlrmc() + "  ";
				if (StringUtils.isNotBlank(regBusQlrList.get(k).getGyfs())) {
					qlgyqk = DictUtils.getDictLabel(regBusQlrList.get(k).getGyfs(), "reg_bus_gyfs", "");// 这里用共有方式【代码转化到文本】
				}
			}
			map.put("qlrmc", qlrmc);
			map.put("qlgyqk", qlgyqk);
		}
		return map;
	}

	/***
	 * @Title: getQlrmcOrderNumber @Description: 通过业务号获取当前权利人在此业务中的顺序号 @param @param
	 * ywhStr @param @return 设定文件 @return String 返回类型 @throws
	 */
	public int getQlrmcOrderNumber(String ywhStr) {
		int qlrmcOrderNumber = 1;// 默认为001
		if (StringUtils.isBlank(ywhStr)) {
			return qlrmcOrderNumber;
		}
		// 首先获取权利人 ID个数
		RegBusQlr qlr = new RegBusQlr();
		qlr.setYwh(ywhStr);
		List<RegBusQlr> qlrlist = regBusQlrService.findList_1(qlr);
		int count = qlrlist.size();
		if (count > 0) {
			qlrmcOrderNumber = qlrlist.size() + 1;
		}
		return qlrmcOrderNumber;
	}

	/**
	 * 所有权使用权更正判断是否已有抵押数据存在
	 * 
	 * @param request
	 * @return
	 */
	@RequiresPermissions("reg:bus:regBusBdcqzsdjxx:view")
	@RequestMapping(value = "isFlagDy")
	@ResponseBody
	public ModelMap isFlagDy(HttpServletRequest request) {
		ModelMap modelMap = new ModelMap();
		String ywh = request.getParameter("ywh");
		RegBusBdcqzsdjxx regBusBdcqzsdjxx = new RegBusBdcqzsdjxx();
		regBusBdcqzsdjxx.setYwh(ywh);
		List<RegBusBdcqzsdjxx> findList = regBusBdcqzsdjxxService.findList(regBusBdcqzsdjxx);
		if (findList.size() > 0) {
			RegBusBdcqzsdjxx regBusBdcqzsdjxxtmp = new RegBusBdcqzsdjxx();
			for (int i = 0; i < findList.size(); i++) {
				regBusBdcqzsdjxx = findList.get(i);
				regBusBdcqzsdjxxtmp.setBdcdyh(regBusBdcqzsdjxx.getBdcdyh());
				regBusBdcqzsdjxxtmp.setIslogout("0");
				regBusBdcqzsdjxxtmp.setDbsj("NOTNULL");
				regBusBdcqzsdjxxtmp.setRights("25");
				List<RegBusBdcqzsdjxx> findList2 = regBusBdcqzsdjxxService.findList(regBusBdcqzsdjxxtmp);
				if (findList2.size() > 0) {
					modelMap.put("success", 0);
					modelMap.put("msg", "不动产单元号:" + regBusBdcqzsdjxx.getBdcdyh() + "已存在抵押业务数据,不能更换权利人!");
					break;
				} else {
					modelMap.put("success", 1);
				}
			}
		} else {
			modelMap.put("success", 0);
			modelMap.put("msg", "当前业务数据不存在,不能更换权利人!");
		}
		return modelMap;
	}

	/**
	 * 判断是否已有第一笔为共同共有的权利人
	 * 
	 * @param request
	 * @return
	 */
	@RequiresPermissions("reg:bus:regBusQlr:view")
	@RequestMapping(value = "isFlagGyqk")
	@ResponseBody
	public ModelMap isFlagGyqk(HttpServletRequest request) {
		ModelMap modelMap = new ModelMap();
		String ywh = request.getParameter("YWH");
		RegBusQlr regBusQlr = new RegBusQlr();
		regBusQlr.setYwh(ywh);
		List<RegBusQlr> findList = regBusQlrService.findListSxh(regBusQlr);
		if (findList.size() > 0) {
			regBusQlr = findList.get(0);
			if (regBusQlr.getGyfs().equals("0")) {// 单独所有
				modelMap.put("success", 0);
				modelMap.put("msg", "第一权利人为单独所有,不能继续添加权利人!");
			} else {
				modelMap.put("success", 1);
			}
			modelMap.put("gyfs", regBusQlr.getGyfs());
		} else {
			modelMap.put("success", 1);
			modelMap.put("gyfs", "");
		}
		return modelMap;
	}

	/**
	 * 柜台受理提交判断共同共有的权利人
	 * 
	 * @param request
	 * @return
	 */
	@RequiresPermissions("reg:bus:regBusQlr:view")
	@RequestMapping(value = "isFlagSubmit")
	@ResponseBody
	public ModelMap isFlagSubmit(HttpServletRequest request) {
		ModelMap modelMap = new ModelMap();
		modelMap.put("success", 1);
		String ywh = request.getParameter("ywh");
		RegBusQlr regBusQlr = new RegBusQlr();
		regBusQlr.setYwh(ywh);
		List<RegBusQlr> findList = regBusQlrService.findListSxh(regBusQlr);
		if (findList.size() == 1) {
			regBusQlr = findList.get(0);
			if (!regBusQlr.getGyfs().equals("0")) {
				modelMap.put("success", 0);
				modelMap.put("msg", "存在不合理的权利人共有情况,不能提交受理!");
			}
		} else {
			regBusQlr = findList.get(0);
			if (regBusQlr.getGyfs().equals("2")) {
				Double qlbl = 0.0;
				boolean n = true;
				for (RegBusQlr qlr : findList) {
					try {
						qlbl += Double.valueOf(qlr.getQlbl());
					} catch (Exception e) {
						modelMap.put("success", 0);
						modelMap.put("msg", "权利比例(" + qlr.getQlrmc() + ")存在非法字符,不能提交受理!");
						n = false;
						break;
					}
				}
				// 小数点转换
				DecimalFormat dFormat = new DecimalFormat("#.00");
				String yearString = dFormat.format(qlbl);
				qlbl = Double.valueOf(yearString);
				if (n && qlbl != 100.0) {
					modelMap.put("success", 0);
					modelMap.put("msg", "按份共有权利比例总和不等于100%,不能提交受理!");
				}

			}

		}
		return modelMap;
	}

	/**
	 * 房屋更名权利人信息查询
	 * 
	 * @param regBusBdcqzsdjxx
	 * @param request
	 * @param response
	 * @param model
	 * @return
	 */
	@RequiresPermissions("reg:bus:regBusQlr:view")
	@RequestMapping(value = "fwgmdjlist")
	public String fwgmdjlist(RegBusQlr regBusQlr, HttpServletRequest request, HttpServletResponse response,
			Model model) {
		String ywh = request.getParameter("ywh");
		String listView = request.getParameter("LISTVIEWS");
		if (StringUtils.isNotBlank(ywh)) {
			regBusQlr.setYwh(ywh);
			model.addAttribute("YWH", ywh);
		}
		if (StringUtils.isNotBlank(request.getParameter("ts"))) {
			model.addAttribute("ts", "1");
		}
		if (StringUtils.isNotBlank(request.getParameter("slhj"))) {
			model.addAttribute("slhj", "1");
		}
		if (StringUtils.isNotBlank(request.getParameter("gm"))) {
			RegBusQlr Qlr = new RegBusQlr();
			Qlr.setYwh(ywh);// 用新业务号去查
			// 当前业务号有数据就在list中显示当前的没有就显示选择已登记信息的
			List<RegBusQlr> qlrList = regBusQlrService.findList_1(Qlr);
			if (qlrList.size() > 0) {
				regBusQlr.setYwh(ywh);
			} else {
				RegBusBdcqzsdjxx djxx = new RegBusBdcqzsdjxx();
				djxx.setYwh(ywh);
				djxx.setBdcdyh(regBusQlr.getBdcdyh());
				djxx.setIslogout("0");
				List<RegBusBdcqzsdjxx> djxxList = regBusBdcqzsdjxxService.findList(djxx);
				if (djxxList.size() > 0) {
					djxx = djxxList.get(0);
					RegBusBdcqzsdjxx djxxold = regBusBdcqzsdjxxService.get(djxx.getOldid());
					regBusQlr.setYwh(djxxold.getYwh());
				}
			}
			model.addAttribute("gm", "1");
		} else {
			regBusQlr.setYwh(ywh);
		}
		if (StringUtils.isNotBlank(listView)) {
			model.addAttribute("LISTVIEWS", listView);
		}
		Page<RegBusQlr> page = regBusQlrService.findPage_1(new Page<RegBusQlr>(request, response), regBusQlr);
		model.addAttribute("page", page);
		return "modules/reg/bus/regBusfwgmdjList";
	}

	@RequiresPermissions("reg:bus:regBusQlr:view")
	@RequestMapping(value = "qlrgmform")
	public String qlrgmform(RegBusQlr regBusQlr, Model model, HttpServletRequest request) {
		String ids = request.getParameter("id");
		model.addAttribute("oldid", ids);
		model.addAttribute("regBusQlr", regBusQlr);
		// 计算当前顺序号【注意:只有新增时才需要这个值】
		if (StringUtils.isBlank(regBusQlr.getId())) {
			model.addAttribute("SXH", getQlrmcOrderNumber(request.getParameter("YWH")));
		}
		// 查看标示
		if (StringUtils.isNotBlank(request.getParameter("VIEWS"))) {
			model.addAttribute("VIEWS", request.getParameter("VIEWS"));
		}
		if (StringUtils.isNotBlank(request.getParameter("djlx"))) {
			model.addAttribute("djlx", request.getParameter("djlx"));
		}
		// 是否预告更名表示
		if (StringUtils.isNotBlank(request.getParameter("bj"))) {
			model.addAttribute("bj", "1");
		}
		// 业务号
		if (StringUtils.isNotBlank(request.getParameter("YWH"))) {
			model.addAttribute("YWH", request.getParameter("YWH"));
			model.addAttribute("BDCDYH", request.getParameter("BDCDYH"));
		}
		// 修改
		if (StringUtils.isNotBlank(request.getParameter("XG"))) {
			model.addAttribute("XG", "1");
		}
		return "modules/reg/bus/regBusQlrgmForm";
	}

	@RequiresPermissions("reg:bus:regBusQlr:view")
	@RequestMapping(value = "qlrtdgmform")
	public String qlrtdgmform(RegBusQlr regBusQlr, Model model, HttpServletRequest request) {
		// 已经是当前业务号的权利人id
		String ids = request.getParameter("id");
		model.addAttribute("oldid", ids);
		model.addAttribute("regBusQlr", regBusQlr);
		// 计算当前顺序号【注意:只有新增时才需要这个值】
		if (StringUtils.isBlank(regBusQlr.getId())) {
			model.addAttribute("SXH", getQlrmcOrderNumber(request.getParameter("YWH")));
		}
		// 查看标示
		if (StringUtils.isNotBlank(request.getParameter("VIEWS"))) {
			model.addAttribute("VIEWS", request.getParameter("VIEWS"));
		}
		if (StringUtils.isNotBlank(request.getParameter("DJLX"))) {
			model.addAttribute("djlx", request.getParameter("DJLX"));
		}
		// 是否预告更名表示
		if (StringUtils.isNotBlank(request.getParameter("bj"))) {
			model.addAttribute("bj", "1");
		}
		// 业务号
		if (StringUtils.isNotBlank(request.getParameter("YWH"))) {
			model.addAttribute("YWH", request.getParameter("YWH"));
			model.addAttribute("BDCDYH", request.getParameter("BDCDYH"));
		}
		// 修改
		if (StringUtils.isNotBlank(request.getParameter("XG"))) {
			model.addAttribute("XG", "1");
		}
		return "modules/reg/bus/regBusQlrTdgmForm";
	}

	@RequiresPermissions("reg:bus:regBusQlr:view")
	@RequestMapping(value = "gmyrform")
	public String gmyrform(RegBusQlr regBusQlr, Model model, HttpServletRequest request) {
		Map<String, String> map = new HashMap<String, String>();
		if (StringUtils.isNotBlank(request.getParameter("YWH"))) {
			model.addAttribute("YWH", request.getParameter("YWH"));
			model.addAttribute("BDCDYH", request.getParameter("BDCDYH"));
		}
		if (StringUtils.isNotBlank(request.getParameter("oldid"))) {
			model.addAttribute("oldid", request.getParameter("oldid"));
		}
		if (StringUtils.isNotBlank(request.getParameter("XG"))) {
			model.addAttribute("XG", "1");
		}
		if (StringUtils.isNotBlank(request.getParameter("qllx"))) {
			model.addAttribute("qllx", request.getParameter("qllx"));
			regBusQlr.setQllx(request.getParameter("qllx"));
		}
		// 是否预告更名表示
		if (StringUtils.isNotBlank(request.getParameter("bj"))) {
			model.addAttribute("bj", "1");
		}
		// 计算当前顺序号【注意:只有新增时才需要这个值】
		System.out.println(request.getParameter("YWH"));// 当前业务号
//		if(StringUtils.isBlank(request.getParameter("optype"))){
//			model.addAttribute("SXH", getQlrmcOrderNumber(request.getParameter("YWH")));
//		}
		String ids = request.getParameter("ids");
		RegBasePerson person = new RegBasePerson();
		person = regBasePersonService.get(ids);
//		//首先获取权利人 ID个数
//		RegBusQlr qlr2 = new RegBusQlr();
//		qlr2.setYwh(request.getParameter("YWH"));
//		qlr2.setPcode(person.getPcode());
//		List<RegBusQlr> qlrlist = regBusQlrService.findList_1(qlr2);
//		int count = qlrlist.size();
//		if(count > 0){
//			model.addAttribute("SXH",qlrlist.get(0).getSxh());
//		}
		regBusQlr.setZjzl(person.getZjzl());
		regBusQlr.setZjh(person.getZjh());
		regBusQlr.setHjszss(person.getHjszss());
		regBusQlr.setXb(person.getXb());
		regBusQlr.setDh(person.getDh());
		regBusQlr.setYb(person.getYb());
		regBusQlr.setGzdw(person.getGzdw());
		regBusQlr.setDzyj(person.getDzyj());
		regBusQlr.setDlrmc(person.getDlrymc());
		regBusQlr.setDljgmc(person.getDljg());
		regBusQlr.setDlrdh(person.getDlrydh());
		regBusQlr.setBz(person.getBz());
		regBusQlr.setQlrlx(person.getRylx());
		regBusQlr.setHjszss(person.getHjszss());
		regBusQlr.setPcode(person.getPcode());
		regBusQlr.setSfczr(DictUtils.getDictValue("是", "yes_no", ""));
		regBusQlr.setId("");
		if (StringUtils.isNotBlank(person.getRymc())) {
			map.put("QLR", person.getRymc());
			regBusQlr.setQlrmc(person.getRymc());
		}
		if (StringUtils.isNotBlank(person.getDz())) {
			map.put("ZL", person.getDz());
			regBusQlr.setDz(person.getDz());
		}
		model.addAttribute("pcode", person.getPcode());
		model.addAttribute("maps", map);
		if (StringUtils.isNotBlank(request.getParameter("djlx"))) {
			model.addAttribute("djlx", request.getParameter("djlx"));
		}
		model.addAttribute("regBusQlr", regBusQlr);
		return "modules/reg/bus/regBusQlrgmForm";
	}

	/**
	 * 权利人更名保存
	 * 
	 * @param regBusQlr
	 * @param model
	 * @param request
	 * @param redirectAttributes
	 * @return
	 */
	@RequiresPermissions("reg:bus:regBusQlr:edit")
	@RequestMapping(value = "gmsave")
	@ResponseBody
	public ModelMap gmsave(RegBusQlr regBusQlr, Model model, HttpServletRequest request,
			RedirectAttributes redirectAttributes) {
		ModelMap modelMap = new ModelMap();
		modelMap.put("success", 1);
		String ywhStr = request.getParameter("YWH");// 当前业务号
		// 获取单元号
		String dyh = request.getParameter("BDCDYH");
		regBusQlr.setYwh(ywhStr);
		// 业务号跟权利人关联
		Map<String, String> map = new HashMap<String, String>();
		Object djxl = request.getParameter("DJLX");
		String pcode = request.getParameter("pcode");
		if (StringUtils.isNotBlank(pcode)) {
			regBusQlr.setPcode(pcode);
		}
		System.out.println(request.getParameter("oldid"));
		// 获取要更名的业务数据
		RegBusQlr qlrshow = regBusQlrService.get(request.getParameter("oldid"));
		String oldid = request.getParameter("oldid");
		String rybm = qlrshow.getPcode();
		int sxh = qlrshow.getSxh();
		String ysdm = qlrshow.getYsdm();

		// 获取要更名的登记信息
		String djxlqllx = "";
		RegBusBdcqzsdjxx djxxgm = new RegBusBdcqzsdjxx();
		djxxgm.setYwh(qlrshow.getYwh());
		List<RegBusBdcqzsdjxx> djxxgmlist = regBusBdcqzsdjxxService.findList(djxxgm);
		if (djxxgmlist.size() > 0) {
			djxxgm = djxxgmlist.get(0);
			djxlqllx = djxxgm.getDjlx();
		}
		// 此处添加权利人权利类型,根据得及小类判断
		// 抵押权利类型为24抵押权
		if ("213".equals(djxlqllx) || "214".equals(djxlqllx) || "215".equals(djxlqllx) || "422".equals(djxlqllx)
				|| "317".equals(djxlqllx) || "318".equals(djxlqllx) || "316".equals(djxlqllx) || "209".equals(djxlqllx)
				|| "315".equals(djxlqllx) || djxlqllx.equals("605") || djxlqllx.equals("606") || djxlqllx.equals("608")
				|| djxlqllx.equals("217")) {
			regBusQlr.setQllx("24");
		}
		// 预告权利类型为27预告登记
		if ("803".equals(djxlqllx) || "818".equals(djxlqllx) || "806".equals(djxlqllx) || "811".equals(djxlqllx)
				|| "812".equals(djxlqllx) || "810".equals(djxlqllx) || "609".equals(djxlqllx) || "809".equals(djxlqllx)
				|| "819".equals(djxlqllx) || "804".equals(djxlqllx) || "807".equals(djxlqllx)
				|| "607".equals(djxlqllx)) {
			regBusQlr.setQllx("27");
		}
		// 所有权利类型为4所有权
		if ("207".equals(djxlqllx) || "416".equals(djxlqllx) || "302".equals(djxlqllx)) {
			regBusQlr.setQllx("4");
		}
		// 集体土地所有权1
		if ("202".equals(djxlqllx) || "301".equals(djxlqllx)) {
			regBusQlr.setQllx("1");
		}
		// 使用权利类型为3,5,7使用权国有
		if ("201".equals(djxlqllx) || "305".equals(djxlqllx)) {
			regBusQlr.setQllx("3");
		}
		// 使用权利类型为3,5,7使用权集体
		if ("203".equals(djxlqllx) || "306".equals(djxlqllx)) {
			regBusQlr.setQllx("7");
		}
		// 使用权利类型为3,5,7使用权宅基地
		if ("204".equals(djxlqllx) || "307".equals(djxlqllx)) {
			regBusQlr.setQllx("5");
		}
//		定义权利人个数
//		int  qlrsizeold = 0;
//		int  qlrsizenew = 0;	
//		//查询旧的权利人的个数
//		RegBusQlr qlrold = new RegBusQlr();
//		qlrold.setYwh(qlrshow.getYwh());
//		List<RegBusQlr>  qllistold = regBusQlrService.findList_1(qlrold);
//		qlrsizeold = qllistold.size();
//		查询新的权利人的个数
//		RegBusQlr qlrnew = new RegBusQlr();
//		qlrnew.setYwh(ywhStr);
//		List<RegBusQlr>  qllistnew = regBusQlrService.findList_1(qlrnew);
//		qlrsizenew = qllistnew.size();
		if (sxh == 1) {
			RegBusBdcqzsdjxx regBusBdcqzsdjxxtmp = new RegBusBdcqzsdjxx();
			if (StringUtils.isNotBlank(ywhStr)) {
				regBusBdcqzsdjxxtmp.setYwh(ywhStr);
				List<RegBusBdcqzsdjxx> findList = regBusBdcqzsdjxxService.findList(regBusBdcqzsdjxxtmp);
				if (findList.size() > 0) {
					dyh = findList.get(0).getBdcdyh();
					// 同步更新已登记信息权利人
					for (int i = 0; i < findList.size(); i++) {
						regBusBdcqzsdjxxtmp = findList.get(i);
						regBusBdcqzsdjxxtmp.setQlrmc(regBusQlr.getQlrmc());
						regBusBdcqzsdjxxtmp.setGyqk(DictUtils.getDictLabel(regBusQlr.getGyfs(), "reg_bus_gyfs", ""));
						regBusBdcqzsdjxxService.save(regBusBdcqzsdjxxtmp);
					}
				}
			}
		}

		if (rybm.equals(regBusQlr.getPcode())) {
			// 查询本次更换的权利人是否有增加过
			RegBusQlr qlrybm = new RegBusQlr();
			qlrybm.setSxh(sxh);
			qlrybm.setYwh(regBusQlr.getYwh());
			List<RegBusQlr> qlrybmlist = regBusQlrService.findList_1(qlrybm);
			if (qlrybmlist.size() > 0) {
				RegBusQlr delqlr = new RegBusQlr();
				delqlr.setYwh(regBusQlr.getYwh());
				delqlr.setSxh(sxh);
				regBusQlrService.deleteqlr(delqlr);
			}
			RegBasePerson person = new RegBasePerson();
			person.setZjh(regBusQlr.getZjh());
			person.setZjzl(regBusQlr.getZjzl());
			List<RegBasePerson> personllist = regBasePersonService.findList(person);
			if (personllist.size() > 0) {
				if (regBusQlr.getPcode().equals(personllist.get(0).getPcode())) {
					// 通过oldid要更名的业务数据是否与当前业务号一样,一样就直接更新此条数据,不一样说明还未对以前的权利人进行更名则直接新增
					if (!qlrshow.getYwh().equals(ywhStr)) {
						RegBusQlr ql = new RegBusQlr();
						ql.setPcode(regBusQlr.getPcode());
						ql.setYwh(regBusQlr.getYwh());
						List<RegBusQlr> qllist = regBusQlrService.findList_1(ql);
						if (qllist.size() <= 0) {
							// 首先获取权利人 ID个数
							// int qlrmcOrderNumber = 0;
							// RegBusQlr qlr2 = new RegBusQlr();
							// qlr2.setYwh(regBusQlr.getYwh());
							// List<RegBusQlr> qlrlist = regBusQlrService.findList_1(qlr2);
							// int count = qlrlist.size();
							// if(count > 0){
							// qlrmcOrderNumber = qlrlist.size() + 1;
							// }else{
							// qlrmcOrderNumber = 1;
							// }
							regBusQlr.setSxh(sxh);
							regBusQlr.setYsdm("6003000000");
							regBusQlr.setGmrid(oldid);
							regBusQlr.setQszt("0");
							regBusQlrService.saveqlr(regBusQlr);
							addMessage(redirectAttributes, "保存权利人信息成功");
							modelMap.put("success", 0);
						} else {
							if (qllist.size() > 0) {
								regBusQlr.setId(qllist.get(0).getId());
								regBusQlr.setBdcdyh(dyh);
								regBusQlr.setSxh(qllist.get(0).getSxh());
								regBusQlr.setGyqk(request.getParameter("gyfs"));
								regBusQlr.setGmrid(oldid);
								regBusQlrService.saveqlr(regBusQlr);
								addMessage(redirectAttributes, "保存权利人信息成功");
								modelMap.put("success", 0);
							}
						}
						// 修改人员信息的状态为已引用
						if (StringUtils.isNotBlank(regBusQlr.getZjh())) {
							RegBasePerson regBasePerson = new RegBasePerson();
							regBasePerson.setZjh(regBusQlr.getZjh());
							regBasePerson.setZjzl(regBusQlr.getZjzl());
							List<RegBasePerson> findPersonList = regBasePersonService.findList(regBasePerson);
							if (findPersonList.size() > 0) {
								regBasePerson = findPersonList.get(0);
								regBasePerson.setIsaudit("2");
								regBasePersonService.save(regBasePerson);
								modelMap.put("success", 0);
							}

						}
					} else {
						qlrshow = regBusQlr;
						qlrshow.setSxh(sxh);
						qlrshow.setYsdm(ysdm);
						qlrshow.setBdcdyh(dyh);
						qlrshow.setId(request.getParameter("oldid"));
						regBusQlrService.save(qlrshow);
						modelMap.put("success", 0);
					}
				} else {
					modelMap.put("success", 1);
				}
			} else {
				// 通过oldid要更名的业务数据是否与当前业务号一样,一样就直接更新此条数据,不一样说明还未对以前的权利人进行更名则直接新增
				if (!qlrshow.getYwh().equals(ywhStr)) {
					RegBusQlr ql = new RegBusQlr();
					ql.setPcode(regBusQlr.getPcode());
					ql.setYwh(regBusQlr.getYwh());
					List<RegBusQlr> qllist = regBusQlrService.findList_1(ql);
					if (qllist.size() <= 0) {
						// 首先获取权利人 ID个数
//							int qlrmcOrderNumber = 0;
//							RegBusQlr qlr2 = new RegBusQlr();
//							qlr2.setYwh(regBusQlr.getYwh());
//							List<RegBusQlr> qlrlist = regBusQlrService.findList_1(qlr2);
//							int count = qlrlist.size();
//							if(count > 0){
//								qlrmcOrderNumber = qlrlist.size() + 1;
//							}else{
//								 qlrmcOrderNumber = 1;
//							}
						regBusQlr.setSxh(sxh);
						regBusQlr.setYsdm("6003000000");
						regBusQlr.setQszt("0");
						regBusQlr.setGmrid(oldid);
						regBusQlr.setBdcdyh(null);
						regBusQlrService.saveqlr(regBusQlr);
						addMessage(redirectAttributes, "保存权利人信息成功");
						modelMap.put("success", 0);
					} else {
						if (qllist.size() > 0) {
							regBusQlr.setId(qllist.get(0).getId());
							regBusQlr.setBdcdyh(dyh);
							regBusQlr.setSxh(qllist.get(0).getSxh());
							regBusQlr.setGyqk(request.getParameter("gyfs"));
							regBusQlr.setGmrid(oldid);
							regBusQlrService.saveqlr(regBusQlr);
							addMessage(redirectAttributes, "保存权利人信息成功");
							modelMap.put("success", 0);
						}
					}
					// 修改人员信息的状态为已引用
					if (StringUtils.isNotBlank(regBusQlr.getZjh())) {
						RegBasePerson regBasePerson = new RegBasePerson();
						regBasePerson.setZjh(regBusQlr.getZjh());
						regBasePerson.setZjzl(regBusQlr.getZjzl());
						List<RegBasePerson> findPersonList = regBasePersonService.findList(regBasePerson);
						if (findPersonList.size() > 0) {
							regBasePerson = findPersonList.get(0);
							regBasePerson.setIsaudit("2");
							regBasePersonService.save(regBasePerson);
							modelMap.put("success", 0);
						}

					}
				} else {
					qlrshow = regBusQlr;
					qlrshow.setSxh(sxh);
					qlrshow.setYsdm(ysdm);
					qlrshow.setBdcdyh(dyh);
					qlrshow.setId(request.getParameter("oldid"));
					regBusQlrService.save(qlrshow);
					modelMap.put("success", 0);
				}
			}
		}

		if (!rybm.equals(regBusQlr.getPcode())) {
			// 查询本次更换的权利人是否有增加过
			RegBusQlr qlrybm = new RegBusQlr();
			qlrybm.setSxh(sxh);
			qlrybm.setYwh(regBusQlr.getYwh());
			List<RegBusQlr> qlrybmlist = regBusQlrService.findList_1(qlrybm);
			if (qlrybmlist.size() > 0) {
				RegBusQlr delqlr = new RegBusQlr();
				delqlr.setYwh(regBusQlr.getYwh());
				delqlr.setSxh(sxh);
				regBusQlrService.deleteqlr(delqlr);
			}
			RegBasePerson person = new RegBasePerson();
			person.setZjh(regBusQlr.getZjh());
			person.setZjzl(regBusQlr.getZjzl());
			List<RegBasePerson> personllist = regBasePersonService.findList(person);
			if (personllist.size() > 0) {
				if (regBusQlr.getPcode().equals(personllist.get(0).getPcode())) {
					// 通过oldid要更名的业务数据是否与当前业务号一样,一样就直接更新此条数据,不一样说明还未对以前的权利人进行更名则直接新增
					if (!qlrshow.getYwh().equals(ywhStr)) {
						RegBusQlr ql = new RegBusQlr();
						ql.setPcode(regBusQlr.getPcode());
						ql.setYwh(regBusQlr.getYwh());
						List<RegBusQlr> qllist = regBusQlrService.findList_1(ql);
						if (qllist.size() <= 0) {
							// 首先获取权利人 ID个数
							int qlrmcOrderNumber = 0;
							RegBusQlr qlr2 = new RegBusQlr();
							qlr2.setYwh(regBusQlr.getYwh());
							List<RegBusQlr> qlrlist = regBusQlrService.findList_1(qlr2);
							int count = qlrlist.size();
							if (count > 0) {
								qlrmcOrderNumber = qlrlist.size() + 1;
							} else {
								qlrmcOrderNumber = 1;
							}
							regBusQlr.setSxh(sxh);
							regBusQlr.setQszt("0");
							regBusQlr.setYsdm("6003000000");
							regBusQlr.setGmrid(oldid);
							regBusQlr.setBdcdyh(null);
							regBusQlrService.saveqlr(regBusQlr);
							addMessage(redirectAttributes, "保存权利人信息成功");
							modelMap.put("success", 0);
						} else {
							if (qllist.size() > 0) {
								regBusQlr.setId(qllist.get(0).getId());
								regBusQlr.setBdcdyh(dyh);
								regBusQlr.setSxh(qllist.get(0).getSxh());
								regBusQlr.setGyqk(request.getParameter("gyfs"));
								regBusQlr.setGmrid(oldid);
								regBusQlrService.saveqlr(regBusQlr);
								addMessage(redirectAttributes, "保存权利人信息成功");
								modelMap.put("success", 0);
							}
						}
						// 修改人员信息的状态为已引用
						if (StringUtils.isNotBlank(regBusQlr.getZjh())) {
							RegBasePerson regBasePerson = new RegBasePerson();
							regBasePerson.setZjh(regBusQlr.getZjh());
							regBasePerson.setZjzl(regBusQlr.getZjzl());
							List<RegBasePerson> findPersonList = regBasePersonService.findList(regBasePerson);
							if (findPersonList.size() > 0) {
								regBasePerson = findPersonList.get(0);
								regBasePerson.setIsaudit("2");
								regBasePersonService.save(regBasePerson);
								modelMap.put("success", 0);
							}

						}
					} else {
						qlrshow = regBusQlr;
						qlrshow.setSxh(sxh);
						qlrshow.setYsdm(ysdm);
						qlrshow.setBdcdyh(dyh);
						qlrshow.setId(request.getParameter("oldid"));
						regBusQlrService.save(qlrshow);
						modelMap.put("success", 0);
					}
				} else {
					modelMap.put("success", 1);
				}
			} else {
				// 通过oldid要更名的业务数据是否与当前业务号一样,一样就直接更新此条数据,不一样说明还未对以前的权利人进行更名则直接新增
				if (!qlrshow.getYwh().equals(ywhStr)) {
					RegBusQlr ql = new RegBusQlr();
					ql.setPcode(regBusQlr.getPcode());
					ql.setYwh(regBusQlr.getYwh());
					List<RegBusQlr> qllist = regBusQlrService.findList_1(ql);
					if (qllist.size() <= 0) {
						// 首先获取权利人 ID个数
						int qlrmcOrderNumber = 0;
						RegBusQlr qlr2 = new RegBusQlr();
						qlr2.setYwh(regBusQlr.getYwh());
						List<RegBusQlr> qlrlist = regBusQlrService.findList_1(qlr2);
						int count = qlrlist.size();
						if (count > 0) {
							qlrmcOrderNumber = qlrlist.size() + 1;
						} else {
							qlrmcOrderNumber = 1;
						}
						regBusQlr.setSxh(sxh);
						regBusQlr.setYsdm("6003000000");
						regBusQlr.setGmrid(oldid);
						regBusQlr.setQszt("0");
						regBusQlrService.saveqlr(regBusQlr);
						regBusQlr.setBdcdyh(null);
						addMessage(redirectAttributes, "保存权利人信息成功");
						modelMap.put("success", 0);
					} else {
						if (qllist.size() > 0) {
							regBusQlr.setId(qllist.get(0).getId());
							regBusQlr.setBdcdyh(dyh);
							regBusQlr.setSxh(qllist.get(0).getSxh());
							regBusQlr.setGyqk(request.getParameter("gyfs"));
							regBusQlr.setGmrid(oldid);
							regBusQlrService.saveqlr(regBusQlr);
							addMessage(redirectAttributes, "保存权利人信息成功");
							modelMap.put("success", 0);
						}
					}
					// 修改人员信息的状态为已引用
					if (StringUtils.isNotBlank(regBusQlr.getZjh())) {
						RegBasePerson regBasePerson = new RegBasePerson();
						regBasePerson.setZjh(regBusQlr.getZjh());
						regBasePerson.setZjzl(regBusQlr.getZjzl());
						List<RegBasePerson> findPersonList = regBasePersonService.findList(regBasePerson);
						if (findPersonList.size() > 0) {
							regBasePerson = findPersonList.get(0);
							regBasePerson.setIsaudit("2");
							regBasePersonService.save(regBasePerson);
							modelMap.put("success", 0);
						}

					}
				} else {
					qlrshow = regBusQlr;
					qlrshow.setSxh(sxh);
					qlrshow.setYsdm(ysdm);
					qlrshow.setBdcdyh(dyh);
					qlrshow.setId(request.getParameter("oldid"));
					regBusQlrService.save(qlrshow);
					modelMap.put("success", 0);
				}
			}
		}
		return modelMap;
	}

	/**
	 * @Title: tdgmsave @Description:土地更名 @param @param regBusQlr @param @param
	 * model @param @param request @param @param redirectAttributes @param @return
	 * 设定文件 @return ModelMap 返回类型 @throws
	 */
	@RequiresPermissions("reg:bus:regBusQlr:edit")
	@RequestMapping(value = "tdgmsave")
	@ResponseBody
	public ModelMap tdgmsave(RegBusQlr regBusQlr, Model model, HttpServletRequest request,
			RedirectAttributes redirectAttributes) {
		ModelMap modelMap = new ModelMap();
		// 判断当前业务号和人员编码下已经有权利人信息了,有了就直接修改,没有就新增
		String ywh = request.getParameter("YWH");
		String bdcdyh = request.getParameter("BDCDYH");
		String pcode = request.getParameter("pcode");

		RegBusQlr regBusQlrT = new RegBusQlr();
		regBusQlrT.setYwh(ywh);
		regBusQlrT.setPcode(pcode);
		List<RegBusQlr> findList_1 = regBusQlrService.findList_1(regBusQlrT);
		// 已经存在
		if (findList_1 != null && findList_1.size() > 0) {
			regBusQlrT = findList_1.get(0);
			regBusQlrT.setQlrmc(regBusQlr.getQlrmc());
			regBusQlrT.setZjzl(regBusQlr.getZjzl());
			regBusQlrT.setZjh(regBusQlr.getZjh());
			regBusQlrService.save(regBusQlrT);
		} else {
			// 不存在的话,就直接新增
			regBusQlr.setYwh(ywh);
			regBusQlr.setBdcdyh(bdcdyh);
			regBusQlr.setYsdm("6003000000");
			regBusQlrService.save(regBusQlr);
		}
		modelMap.put("success", 1);
		return modelMap;
	}

	/**
	 * 判断多宗地或者多房屋的权利人是否一致
	 * 
	 * @param request
	 * @return
	 */
	@RequiresPermissions("reg:bus:regBusBdcqzsdjxx:view")
	@RequestMapping(value = "isFlag")
	@ResponseBody
	public String isFlag(HttpServletRequest request, String ywhs, String dyxxdjId) {
		String id = "";
		if (dyxxdjId.equals("")) {
			id = request.getParameter("ids");
		} else {
			id = dyxxdjId;
		}
		String[] ids = id.split(";");
		String success = "";
		for (int i = 0; i < ids.length; i++) {
			String qlr1size = "";
			String qlrsize = "";
			RegBusBdcqzsdjxx regBusBdcqzsdjxx = new RegBusBdcqzsdjxx();
			regBusBdcqzsdjxx = regBusBdcqzsdjxxService.get(ids[i]);
			RegBusQlr regBusQlr = new RegBusQlr();
			RegBusQlr regBusQlr1 = new RegBusQlr();
			if (regBusBdcqzsdjxx != null) {
				if (!ywhs.equals("")) {// 后续继续添加
					regBusQlr.setYwh(ywhs);
					List<RegBusQlr> listregBusQlr = regBusQlrService.findListSxh(regBusQlr);
					qlrsize = listregBusQlr.size() + "";
					regBusBdcqzsdjxx = regBusBdcqzsdjxxService.get(ids[i]);
					regBusQlr1.setYwh(regBusBdcqzsdjxx.getYwh());
					List<RegBusQlr> listregBusQlr1 = regBusQlrService.findListSxh(regBusQlr1);
					String flag = "";
					qlr1size = listregBusQlr1.size() + "";

					if (listregBusQlr1.size() > 0) {
						for (int j = 0; j < listregBusQlr1.size(); j++) {
							regBusQlr1 = listregBusQlr1.get(j);
							regBusQlr.setPcode(regBusQlr1.getPcode());
							List<RegBusQlr> listregBusQlrtmp = regBusQlrService.findListSxh(regBusQlr);
							if (listregBusQlrtmp.size() == 0) {
								flag = "1";
								break;
							}
						}
					}

					if (qlrsize.equals("0") || !qlrsize.equals(qlr1size) || flag.equals("1")) {
						success = "0";
						break;
					} else {
						success = "1";
					}
				} else {// 第一次添加
					regBusQlr.setYwh(regBusBdcqzsdjxx.getYwh());
					List<RegBusQlr> listregBusQlr = regBusQlrService.findListSxh(regBusQlr);
					qlrsize = listregBusQlr.size() + "";
					if (i > 0) {
						regBusBdcqzsdjxx = regBusBdcqzsdjxxService.get(ids[i - 1]);
						regBusQlr1.setYwh(regBusBdcqzsdjxx.getYwh());
						List<RegBusQlr> listregBusQlr1 = regBusQlrService.findListSxh(regBusQlr1);
						String flag = "";
						qlr1size = listregBusQlr1.size() + "";
						if (listregBusQlr1.size() > 0) {
							for (int j = 0; j < listregBusQlr1.size(); j++) {
								regBusQlr1 = listregBusQlr1.get(j);
								regBusQlr.setPcode(regBusQlr1.getPcode());
								List<RegBusQlr> listregBusQlrtmp = regBusQlrService.findListSxh(regBusQlr);
								if (listregBusQlrtmp.size() == 0) {
									flag = "1";
									break;
								}
							}
						}
						if (qlrsize.equals("0") || !qlrsize.equals(qlr1size) || flag.equals("1")) {
							success = "0";
							break;
						} else {
							success = "1";
						}
					}
				}
			}
		}
		return success;
	}

	/**
	 * 必特权利人查询保存
	 * 
	 * @param request
	 * @return
	 */
	@RequiresPermissions("reg:bus:regBusBdcqzsdjxx:view")
	@RequestMapping(value = "BTQueryQlr")
	@ResponseBody
	public void BTQueryQlr(String bdcdyh, String djxl, String ywh) {
		// 保存权利人
		RegBaseH regbaseh = regBaseHService.getdy(bdcdyh);
		if (StringUtils.isNotBlank(regbaseh.getBtfwbm())) {
			RegBusBtqlr btQlr = new RegBusBtqlr();
			btQlr.setFwbm(regbaseh.getBtfwbm());
			btQlr.setDjxl(djxl);
			List<RegBusBtqlr> listregBusQlr = regBusBtqlrService.findList(btQlr);
			if (listregBusQlr.size() > 0) {
				for (int i = 0; i < listregBusQlr.size(); i++) {
					btQlr = listregBusQlr.get(i);
					// 获取权利人编码
					String pcode = RegUtils.getHMaxFwbm(regBasePersonService.getHMaxPCode());
					RegBusQlr Qlr_1 = new RegBusQlr();
					org.springframework.beans.BeanUtils.copyProperties(btQlr, Qlr_1);
					Qlr_1.setYwh(ywh);
					Qlr_1.setId("");
					Qlr_1.setQllx("4");
					Qlr_1.setSxh(i + 1);
					Qlr_1.setZjzl(btQlr.getQlrzjzl());
					Qlr_1.setZjh(btQlr.getQlrzjh());
					Qlr_1.setHjszss(btQlr.getQlrhjszss());
					Qlr_1.setXb(btQlr.getQlrxb());
					Qlr_1.setDh(btQlr.getQlrdh());
					Qlr_1.setBz(btQlr.getQlrbz());
					Qlr_1.setQlrlx(btQlr.getQlrlx());
					Qlr_1.setGyfs(btQlr.getQlrgyfs());
					Qlr_1.setGyfs(btQlr.getQlrgyfs());
					Qlr_1.setQlbl(btQlr.getQlrqlbl());
					Qlr_1.setGyqk(DictUtils.getDictLabel(btQlr.getQlrgyfs(), "reg_bus_gyfs", ""));
					Qlr_1.setSfczr(DictUtils.getDictValue("是", "yes_no", ""));
					Qlr_1.setPcode(pcode);
					Qlr_1.setQszt("0");
					regBusQlrService.save(Qlr_1);
				}
			}
		}
	}
	
	
	
	
	//人像比对界面
	@RequestMapping(value = "rxbdForm")
	public String rxbdForm(RegBusQlr regBusQlr, HttpServletRequest request, HttpServletResponse response, Model model) {
		String ywh="";
		if(StringUtils.isNotBlank(request.getParameter("ywh"))) {
		ywh = request.getParameter("ywh");	
		List<RegBusQlr> list = regBusQlrService.findByYwh(ywh);
		model.addAttribute("list", list);
		}
		return "modules/reg/bus/regBusQlrrxbdForm";
	}
	
	//人像比对过程
	@RequestMapping(value = "interSi/{si_type}/{si_code}", method = RequestMethod.POST)
	public void interSi(HttpServletRequest request,@PathVariable String si_code,@PathVariable String si_type, HttpServletResponse response, Model model) {
		Map resmap = Maps.newHashMap(); 
		try{
			String data = request.getParameter("data");
			String interdata = request.getParameter("interdata");
			String ywh = request.getParameter("ywh");
			String sxh = request.getParameter("sxh");
			resmap =  regBusQlrService.interSi(data, interdata,si_type+"/"+si_code,ywh,sxh);
			resmap.put("success", "0");
		}catch(Exception e){
			e.printStackTrace();
			resmap.put("success", "1");
			resmap.put("error_msg", e.getMessage());
		} 
		renderString(response, resmap);
	}
	
	@RequestMapping(value="test")
	public String test(ModelMap model,HttpServletRequest request,HttpServletResponse response) {
		  
		return  "modules/wxinterface/test";
	}
	
	
	//--------------------------------------个人登记信息查询-----------------------------------------------//
	@RequestMapping(value="readCard")
	public String readCard(ModelMap model,HttpServletRequest request,HttpServletResponse response) {
		  
		return  "modules/reg/print/ReadCard";
	}
	
	@RequestMapping(value="DjxxSelect")
	public String DjxxSelect(ModelMap model,HttpServletRequest request,HttpServletResponse response) {
		String qlrmc = request.getParameter("qlrmc");
		String zjh = request.getParameter("zjh");
		String zjzl = request.getParameter("zjzl");
		RegBusQlr qlr = new RegBusQlr();
		qlr.setQlrmc(qlrmc);
		qlr.setZjh(zjh);
		qlr.setZjzl(zjzl);
		List<Map> list = regBusQlrService.DjxxSelect(qlr);
		
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		model.addAttribute("date", sdf.format(new Date()));
		model.addAttribute("list", list);
		model.addAttribute("qlrmc", qlrmc);
		model.addAttribute("zjh", zjh);
		
		return  "modules/reg/print/djxxPrint";
	}
}