cbf59323761fc89e9579fc2c1ec7cbd727096f4a.svn-base 84.3 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
/**
 * Copyright &copy; 2015-2018 <a href="#">J-Site</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.reg.web.bus;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
//import java.util.Arrays;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.activiti.engine.impl.util.json.JSONArray;
import org.activiti.engine.impl.util.json.JSONException;
import org.activiti.engine.impl.util.json.JSONObject;
import org.apache.poi.hssf.usermodel.DVConstraint;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFDataValidation;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.CellRangeAddress;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.util.CellRangeAddressList;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import com.thinkgem.jeesite.common.config.Global;
import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.utils.DateUtils;
import com.thinkgem.jeesite.common.utils.FileUtils;
import com.thinkgem.jeesite.common.utils.StringUtils;
import com.thinkgem.jeesite.common.web.BaseController;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBaseChxx11;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBasePerson;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBaseXm;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBaseZdbhqk;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBaseZdjbxx;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBaseZdjbxxdr;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusBdcqzsdjxx;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusHisHouseQlr;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusHisHouseYwr;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusJsydsyq;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusQlr;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusRights;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusYwr;
import com.thinkgem.jeesite.modules.reg.service.base.RegBaseChxx11Service;
import com.thinkgem.jeesite.modules.reg.service.base.RegBasePersonService;
import com.thinkgem.jeesite.modules.reg.service.base.RegBaseXmService;
import com.thinkgem.jeesite.modules.reg.service.base.RegBaseZdbhqkService;
import com.thinkgem.jeesite.modules.reg.service.base.RegBaseZdjbxxService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBaseZdjbxxdrService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusBdcqzsdjxxService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusHisHouseQlrService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusHisHouseYwrService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusJsydsyqService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusQlrService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusRightsService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusYwrService;
import com.thinkgem.jeesite.modules.reg.utils.RegUtils;
import com.thinkgem.jeesite.modules.reg.web.base.RegBasePersonController;
import com.thinkgem.jeesite.modules.reg.web.base.RegBaseZdjbxxController;
import com.thinkgem.jeesite.modules.sys.entity.Dict;
import com.thinkgem.jeesite.modules.sys.entity.Office;
import com.thinkgem.jeesite.modules.sys.entity.User;
import com.thinkgem.jeesite.modules.sys.service.DictService;
import com.thinkgem.jeesite.modules.sys.service.OfficeService;
import com.thinkgem.jeesite.modules.sys.utils.DictUtils;
import com.thinkgem.jeesite.modules.sys.utils.UserUtils;

/**
 * 宗地基本信息数据导入管理Controller
 * 
 * @author wb
 * @version 2016-11-08
 */
@Controller
@RequestMapping(value = "${adminPath}/reg/bus/regBaseZdjbxxdr")
public class RegBaseZdjbxxdrController extends BaseController {
	@Autowired
	private RegBasePersonService regBasePersonService;
	@Autowired
	private RegBusBdcqzsdjxxService regBusBdcqzsdjxxService;
	@Autowired
	private RegBaseZdjbxxdrService regBaseZdjbxxdrService;
	@Autowired
	private OfficeService officeService;
	@Autowired
	private RegBaseZdjbxxService regBaseZdjbxxService;
	@Autowired
	private DictService dictService;
	@Autowired
	private RegBusHisHouseQlrService regBusHisHouseQlrService;
	@Autowired
	private RegBusJsydsyqService regBusJsydsyqService;
	@Autowired
	private RegBusQlrService regBusQlrService;
	@Autowired
	private RegBasePersonController regBasePersonController;
	@Autowired
	private RegBusRightsService regBusRightsService;
	@Autowired
	private RegBaseZdbhqkService regBaseZdbhqkService;
	@Autowired
	private RegBaseXmService regBaseXmService;
	@Autowired
	private RegBusHisHouseYwrService regBusHisHouseYwrService;
	@Autowired
	private RegBusYwrService regBusYwrService;
	@Autowired
	private RegBaseChxx11Service regBaseChxxService;

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

	@RequiresPermissions("reg:bus:regBaseZdjbxxdr:view")
	@RequestMapping(value = { "list", "" })
	public String list(RegBaseZdjbxx regBaseZdjbxx, HttpServletRequest request, HttpServletResponse response,
			Model model) {
		// 用户权限分配
		User user = UserUtils.getUser();
		Office office = officeService.get(user.getCurrentUser().getOffice().getId());
		if ("S00001001007".equals(office.getCode())) {
			model.addAttribute("SH", office.getCode());
		} else {
			model.addAttribute("SH", office.getCode());
		}
		if (StringUtils.isNotBlank(request.getParameter("optype"))) {
			model.addAttribute("optype", "1");
		}
		if (StringUtils.isNotBlank(request.getParameter("WO"))) {
			model.addAttribute("WO", "1");
		}
		if (StringUtils.isNotBlank(request.getParameter("scbj"))) {
			model.addAttribute("scbj", "1");
		}
		if (StringUtils.isNotBlank(request.getParameter("ids"))) {
			regBaseZdjbxx.setId(request.getParameter("ids"));
		}
		if (StringUtils.isNotBlank(request.getParameter("dyh"))) {
			regBaseZdjbxx.setBdcdyh(request.getParameter("dyh"));
		}
		//只顯示宅基地
		regBaseZdjbxx.setZdtzm("C");
		// TODO 1. 检查为什么isAudit是null
		// TODO 2. 判断页面显示是否需要考虑null的情况
		Page<RegBaseZdjbxx> page = regBaseZdjbxxService.findPage(new Page<RegBaseZdjbxx>(request, response),
				regBaseZdjbxx);
		model.addAttribute("page", page);
		return "modules/reg/bus/regBaseZdjbxxdrList";
	}

	public void saveQlr(RegBaseZdjbxxdr regBaseZdjbxxdr, HttpServletRequest request) {
		// 增加权利人
		String sfzh = regBaseZdjbxxdr.getSfzh();
		String[] sfzh_1 = sfzh.split(",");
		for (String zjh : sfzh_1) {
			RegBusHisHouseQlr qlr = new RegBusHisHouseQlr();
			RegBasePerson person = new RegBasePerson();
			person.setZjh(zjh);
			person.setZjzl(regBaseZdjbxxdr.getZjlx());
			List<RegBasePerson> personlist = regBasePersonService.findListqy(person);
			if (personlist.size() > 0) {
				person = personlist.get(0);
				qlr.setQlrmc(person.getRymc());
				qlr.setSfczr(regBaseZdjbxxdr.getSfczr());
				qlr.setZjzl(person.getZjzl());
				qlr.setZjh(person.getZjh());
				qlr.setQlrlx(regBaseZdjbxxdr.getQlrlx());
				qlr.setGyfs(regBaseZdjbxxdr.getGyqk());
				qlr.setId("");
				qlr.setHjszss(person.getHjszss());
				qlr.setXb(person.getXb());
				qlr.setSshy(person.getSshy());
				qlr.setGj(person.getGj());
				qlr.setDz(person.getDz());
				qlr.setSxh("1");
				qlr.setYwh(regBaseZdjbxxdr.getYwh());
				qlr.setPcode(person.getPcode());
			} else {
				String pCode = regBasePersonController.getpcode();
				qlr.setPcode(pCode);
				qlr.setQlrmc(regBaseZdjbxxdr.getQlrxm());
				qlr.setSfczr(regBaseZdjbxxdr.getSfczr());
				qlr.setZjzl(regBaseZdjbxxdr.getZjlx());
				qlr.setZjh(regBaseZdjbxxdr.getSfzh());
				qlr.setQlrlx(regBaseZdjbxxdr.getQlrlx());
				qlr.setGyfs(regBaseZdjbxxdr.getGyqk());
				qlr.setSxh("1");
				qlr.setYwh(regBaseZdjbxxdr.getYwh());
				qlr.setId("");
			}
			regBusHisHouseQlrService.save(qlr);
		}
	}

	@RequiresPermissions("reg:bus:regBaseZdjbxxdr:view")
	@RequestMapping(value = "form")
	public String form(RegBaseZdjbxx regBaseZdjbxxdr, Model model, HttpServletRequest request) {
		if (StringUtils.isNotBlank(request.getParameter("optype"))) {
			model.addAttribute("optype", "1");
			regBaseZdjbxxdr.setZddm(
					regBaseZdjbxxdr.getSeachdistrict() + regBaseZdjbxxdr.getTdsyqdm() + regBaseZdjbxxdr.getZdtzm());
			regBaseZdjbxxdr.setBdcdyh(
					regBaseZdjbxxdr.getSeachdistrict() + regBaseZdjbxxdr.getTdsyqdm() + regBaseZdjbxxdr.getZdtzm());
		}
		regBaseZdjbxxdr.setQllx("5");
		if (StringUtils.isNotBlank(request.getParameter("view"))) {
			model.addAttribute("view", "1");
		}
		if (StringUtils.isNotBlank(request.getParameter("xg"))) {
			model.addAttribute("xg", "1");
		}
		Dict dict = new Dict();
		if (regBaseZdjbxxdr.getQllx().equals("3") || regBaseZdjbxxdr.getQllx().equals("7")) {
			dict.setValue("3");
		} else if (regBaseZdjbxxdr.getQllx().equals("5")) {
			dict.setValue("5");
		}
		dict.setType("reg_bus_tdyt");
		List<String> ytList = dictService.findTdytList(dict);
		model.addAttribute("ytList", ytList);
		/*model.addAttribute("YWH", regBaseZdjbxxdr.getYwh());
		regBaseZdjbxx.setDjxl("204");*/
		model.addAttribute("regBaseZdjbxxdr", regBaseZdjbxxdr);
		return "modules/reg/bus/regBaseZdjbxxdrForm";
	}

	/***
	 * @Title: getNextYwh @Description: 获取并生成业务号 @param @return 设定文件 @return
	 * String 返回类型 @throws
	 */
	public synchronized String getNextYwhs() {
		String maxYwh = regBaseZdjbxxdrService.findMaxYwhLs();
		if (StringUtils.isNotBlank(maxYwh) && DateUtils.getDate("yyyyMMdd").equals(maxYwh.substring(2, 10))) {
			maxYwh = maxYwh.substring(2, 16);
		} else {
			maxYwh = DateUtils.getDate("yyyyMMdd") + "000000";
		}
		String nextYwh = DateUtils.getDate("yyyyMMdd") + "000001";
		// 如果数据里的最大业务号不为空,就取出来进行处理;否则直接默认值
		if (StringUtils.isNotBlank(maxYwh)) {
			// 如果当前日期字符串等于数据库里最大业务号前面的日期字符串,那只要顺序往上加就好;否则直接默认值
			if (DateUtils.getDate("yyyyMMdd").equals(maxYwh.substring(0, 8))) {
				int nextSerNum = Integer.parseInt(maxYwh.substring(8)) + 1;
				if (nextSerNum < 10) {
					nextYwh = DateUtils.getDate("yyyyMMdd") + "00000" + nextSerNum;
				} else if (nextSerNum > 9 && nextSerNum < 100) {
					nextYwh = DateUtils.getDate("yyyyMMdd") + "0000" + nextSerNum;
				} else if (nextSerNum > 99 && nextSerNum < 1000) {
					nextYwh = DateUtils.getDate("yyyyMMdd") + "000" + nextSerNum;
				} else if (nextSerNum > 999 && nextSerNum < 10000) {
					nextYwh = DateUtils.getDate("yyyyMMdd") + "00" + nextSerNum;
				} else if (nextSerNum > 9999 && nextSerNum < 100000) {
					nextYwh = DateUtils.getDate("yyyyMMdd") + "0" + nextSerNum;
				} else {
					nextYwh = DateUtils.getDate("yyyyMMdd") + nextSerNum;
				}
			}
		}
		System.out.println(nextYwh);
		return "ZD" + nextYwh;
	}

	@RequiresPermissions("reg:bus:regBaseZdjbxxdr:edit")
	@RequestMapping(value = "save")
	public String save(RegBaseZdjbxx regBaseZdjbxxdr, Model model, RedirectAttributes redirectAttributes,
			HttpServletRequest request) {
		
		regBaseZdjbxxdr.setZddm(regBaseZdjbxxdr.getSeachdistrict()
				+ regBaseZdjbxxdr.getTdsyqdm() + regBaseZdjbxxdr.getZdtzm());
		
		
		      // 构造不動產單元號
				if (regBaseZdjbxxdr.getZddm().substring(0, 12).length() == 12) {
					String maxZddmSxh = regBaseZdjbxxService.findMaxZddmByDistrict(regBaseZdjbxxdr.getZddm().substring(0, 12));// 使用当前宗地代码
					String ruleCode = regBaseZdjbxxdr.getZddm();
					RegBaseZdjbxxController zdjbxxc = new RegBaseZdjbxxController();
					String nextZddm = zdjbxxc.getNextZddm(maxZddmSxh, ruleCode);
					regBaseZdjbxxdr.setZddm(nextZddm);
					regBaseZdjbxxdr.setBdcdyh(nextZddm + "W00000000");
				}
				regBaseZdjbxxdr.setYtmc(DictUtils.getDictLabel(regBaseZdjbxxdr.getYt(), "reg_bus_tdyt", ""));
				regBaseZdjbxxdr.setIslogout("0");
				regBaseZdjbxxdr.setIsaudit("0");
				regBaseZdjbxxdr.setIschafeng("0");
				regBaseZdjbxxdr.setIsdiya("0");
				regBaseZdjbxxdr.setIsyiyi("0");
		regBaseZdjbxxService.save(regBaseZdjbxxdr);
		addMessage(redirectAttributes, "保存宗地基本信息导入成功!");
		return "redirect:" + Global.getAdminPath() + "/reg/bus/regBaseZdjbxxdr/list";
	}

	@RequiresPermissions("reg:bus:regBaseZdjbxxdr:edit")
	@RequestMapping(value = "delete")
	public String delete(RegBaseZdjbxx regBaseZdjbxxdr, RedirectAttributes redirectAttributes,
			HttpServletRequest request) {
		// 删除历史临时表中的权利人
		  RegBaseChxx11 chxx = regBaseChxxService.get(regBaseZdjbxxdr.getChid());
		  chxx.setIsaudit("1");
		  regBaseChxxService.save(chxx);
		  regBaseZdjbxxService.delete(regBaseZdjbxxdr);
		
		addMessage(redirectAttributes, "删除成功");
		return "redirect:" + Global.getAdminPath() + "/reg/bus/regBaseZdjbxxdr/list?WWO=1";
	}

	/*
	 * @RequiresPermissions("reg:bus:regBaseZdjbxxdr:edit")
	 * 
	 * @RequestMapping(value = "audit")
	 * 
	 * @ResponseBody public synchronized String audit(RegBaseZdjbxxdr
	 * regBaseZdjbxxdr, RedirectAttributes redirectAttributes,
	 * HttpServletRequest request) { regBaseZdjbxxdr.setIsaudit("1"); String
	 * xz="",jq="",zq="";
	 * 
	 * if(StringUtils.isNotBlank(request.getParameter("djq"))){
	 * regBaseZdjbxxdr.setSeachcity(DictUtils.getDictValue(request.getParameter(
	 * "djq"), "reg_bus_djq", ""));
	 * regBaseZdjbxxdr.setSeachprov(DictUtils.getDictValue(request.getParameter(
	 * "djq"), "reg_bus_djq", "").substring(0,6));
	 * 
	 * } if(StringUtils.isNotBlank(request.getParameter("djzq"))){
	 * regBaseZdjbxxdr.setSeachdistrict(DictUtils.getDictValue(request.
	 * getParameter("djzq"), "reg_bus_djzq", ""));
	 * regBaseZdjbxxdr.setZddm(DictUtils.getDictValue(request.getParameter(
	 * "djzq"), "reg_bus_djzq",
	 * "")+regBaseZdjbxxdr.getTdsyqdm()+regBaseZdjbxxdr.getZdtzm());
	 * regBaseZdjbxxdr.setBdcdyh(DictUtils.getDictValue(request.getParameter(
	 * "djzq"), "reg_bus_djzq",
	 * "")+regBaseZdjbxxdr.getTdsyqdm()+regBaseZdjbxxdr.getZdtzm()); }
	 * 
	 * regBaseZdjbxxdrService.save(regBaseZdjbxxdr); //保存测绘信息 RegBaseChxx chxx =
	 * new RegBaseChxx(); chxx.setSeachprov(regBaseZdjbxxdr.getSeachprov());
	 * chxx.setSeachcity(regBaseZdjbxxdr.getSeachcity());
	 * chxx.setSeachdistrict(regBaseZdjbxxdr.getSeachdistrict());
	 * chxx.setZl(regBaseZdjbxxdr.getZl());
	 * chxx.setZdszd(regBaseZdjbxxdr.getZdszd());
	 * chxx.setZdszb(regBaseZdjbxxdr.getZdszb());
	 * chxx.setZdszn(regBaseZdjbxxdr.getZdszn());
	 * chxx.setZdszx(regBaseZdjbxxdr.getZdszx());
	 * chxx.setZdt(regBaseZdjbxxdr.getZdt());
	 * chxx.setTfh(regBaseZdjbxxdr.getTfh()); if(regBaseZdjbxxdr.getZdmj() !=
	 * null){ chxx.setZdmj(Double.valueOf(regBaseZdjbxxdr.getZdmj())); }
	 * chxx.setJzdzb(regBaseZdjbxxdr.getZb());
	 * chxx.setChrymc(regBaseZdjbxxdr.getChrymc());
	 * chxx.setChsj(regBaseZdjbxxdr.getChsj());
	 * chxx.setChcode(regBaseZdjbxxdr.getSeachdistrict());
	 * chxx.setQlrmc(regBaseZdjbxxdr.getQlrxm());
	 * chxx.setZjhm(regBaseZdjbxxdr.getSfzh());
	 * chxx.setZjlx(regBaseZdjbxxdr.getZjlx()); chxx.setIsaudit("1");
	 * chxx.setRemarks(regBaseZdjbxxdr.getRemarks());
	 * chxx.setZdtzm(regBaseZdjbxxdr.getZdtzm()); regBaseChxxService.save(chxx);
	 * //宗地信息 RegBaseZdjbxx zdjbxx = new RegBaseZdjbxx(); //构造宗地号
	 * if(regBaseZdjbxxdr.getZddm().substring(0,12).length() == 12){
	 * System.out.println(regBaseZdjbxxdr.getZddm().substring(0,12)); String
	 * maxZddmSxh =
	 * regBaseZdjbxxService.findMaxZddmByDistrict(regBaseZdjbxxdr.getZddm().
	 * substring(0,12));//使用当前宗地代码 String ruleCode = regBaseZdjbxxdr.getZddm();
	 * RegBaseZdjbxxController zdjbxxc = new RegBaseZdjbxxController(); String
	 * nextZddm = zdjbxxc.getNextZddm(maxZddmSxh, ruleCode);
	 * zdjbxx.setZddm(nextZddm); zdjbxx.setBdcdyh(nextZddm + "W00000000"); }
	 * //保存宗地基本信息 zdjbxx.setYsdm("2001010000");
	 * zdjbxx.setZdtzm(regBaseZdjbxxdr.getZdtzm());
	 * zdjbxx.setZl(regBaseZdjbxxdr.getZl());
	 * if(StringUtils.isNotBlank(String.valueOf(regBaseZdjbxxdr.getZdmj()))){
	 * zdjbxx.setZdmj(Double.valueOf(regBaseZdjbxxdr.getZdmj())); }
	 * zdjbxx.setMjdw(regBaseZdjbxxdr.getMjdw());
	 * zdjbxx.setYt(regBaseZdjbxxdr.getYt());
	 * zdjbxx.setDj(regBaseZdjbxxdr.getDj()); if(regBaseZdjbxxdr.getJg() !=
	 * null){ zdjbxx.setJg(Double.valueOf(regBaseZdjbxxdr.getJg())); }
	 * zdjbxx.setQllx(regBaseZdjbxxdr.getQllx());
	 * zdjbxx.setQlxz(regBaseZdjbxxdr.getQlxz());
	 * zdjbxx.setQlsdfs(regBaseZdjbxxdr.getQlsdfs());
	 * zdjbxx.setRjl(regBaseZdjbxxdr.getRjl());
	 * zdjbxx.setJzmd(regBaseZdjbxxdr.getJzmd());
	 * zdjbxx.setJzxg(regBaseZdjbxxdr.getJzxg());
	 * zdjbxx.setZdszd(regBaseZdjbxxdr.getZdszd());
	 * zdjbxx.setZdszb(regBaseZdjbxxdr.getZdszb());
	 * zdjbxx.setZdszn(regBaseZdjbxxdr.getZdszn());
	 * zdjbxx.setZdszx(regBaseZdjbxxdr.getZdszx());
	 * zdjbxx.setZdt(regBaseZdjbxxdr.getZdt());
	 * zdjbxx.setTfh(regBaseZdjbxxdr.getTfh());
	 * zdjbxx.setDjh(regBaseZdjbxxdr.getDjh());
	 * zdjbxx.setDah(regBaseZdjbxxdr.getDah());
	 * zdjbxx.setBz(regBaseZdjbxxdr.getRemarks());
	 * zdjbxx.setZt(regBaseZdjbxxdr.getZt());
	 * zdjbxx.setSeachprov(regBaseZdjbxxdr.getSeachprov());
	 * zdjbxx.setSeachcity(regBaseZdjbxxdr.getSeachcity());
	 * zdjbxx.setSeachdistrict(regBaseZdjbxxdr.getSeachdistrict());
	 * zdjbxx.setZb(regBaseZdjbxxdr.getZb());
	 * zdjbxx.setQlrxm(regBaseZdjbxxdr.getQlrxm());
	 * zdjbxx.setZjlx(regBaseZdjbxxdr.getZjlx());
	 * zdjbxx.setSfzh(regBaseZdjbxxdr.getSfzh());
	 * zdjbxx.setTdsyqdm(regBaseZdjbxxdr.getTdsyqdm());
	 * zdjbxx.setChid(chxx.getId());//保存关联的测绘信息ID zdjbxx.setStatus("1");
	 * zdjbxx.setHistory("1"); zdjbxx.setIsaudit("1"); zdjbxx.setIschafeng("0");
	 * zdjbxx.setIsdiya("0"); zdjbxx.setIsyiyi("0"); zdjbxx.setIslogout("0");
	 * //是否注销 zdjbxx.setRemarks(regBaseZdjbxxdr.getRemarks()); //判断有没有宗地信息 有的话
	 * 更新 RegBaseZdjbxx temp = new RegBaseZdjbxx();
	 * temp.setZddm(zdjbxx.getZddm()); temp.setBdcdyh(zdjbxx.getBdcdyh());
	 * List<RegBaseZdjbxx> listZdjbxx = regBaseZdjbxxService.findList(temp);
	 * if(listZdjbxx != null && listZdjbxx.size()>0){ temp = listZdjbxx.get(0);
	 * zdjbxx.setId(temp.getId()); } regBaseZdjbxxService.save(zdjbxx);
	 * addMessage(redirectAttributes, "不动产登记历史数据审核成功!");
	 * System.out.println("redirect:"+Global.getAdminPath()+
	 * "/reg/bus/regBaseZdjbxxdr/list?WO=1&dyh="+zdjbxx.getBdcdyh()); return
	 * "redirect:"+Global.getAdminPath()+
	 * "/reg/bus/regBaseZdjbxxdr/list?WO=1&dyh="+zdjbxx.getBdcdyh();
	 * 
	 * }
	 */
	@RequiresPermissions("reg:bus:regBaseZdjbxxdr:edit")
	@RequestMapping(value = "audit")
	@ResponseBody
	public ModelMap audit(RegBaseZdjbxxdr regBaseZdjbxxdr, RedirectAttributes redirectAttributes,
			HttpServletRequest request, Model model) {
		regBaseZdjbxxdr.setIsaudit("2");
		// 查找当前权利人信息
		RegBusHisHouseQlr qlrperson = new RegBusHisHouseQlr();
		qlrperson.setYwh(regBaseZdjbxxdr.getYwh());
		List<RegBusHisHouseQlr> qlrlistperson = regBusHisHouseQlrService.findList(qlrperson);// 获取权利人子表数据
		if (qlrlistperson.size() > 0) {
			for (int j = 0; j < qlrlistperson.size(); j++) {
				qlrperson = qlrlistperson.get(j);
				// 插入到人员信息基础表中
				RegBasePerson person = new RegBasePerson();
				person.setZjh(qlrperson.getZjh());
				person.setZjzl(qlrperson.getZjzl());
				List<RegBasePerson> personlist = regBasePersonService.findListqy(person);
				if (personlist.size() > 0) {
					person = personlist.get(0);
					String info = queryinfo(personlist.get(0).getId());
					if ("0".equals(info)) {
						person.setDz(qlrperson.getDz());
						person.setDh(qlrperson.getDh());
						person.setXb(qlrperson.getXb());
						person.setYb(qlrperson.getYb());
						person.setGzdw(qlrperson.getGzdw());
						person.setHjszss(qlrperson.getHjszss());
						person.setDzyj(qlrperson.getDzyj());
						regBasePersonService.save(person);
					}
				} else {
					RegBasePerson personnew = new RegBasePerson();
					String pCode = regBasePersonController.getpcode();
					personnew.setPcode(pCode);
					personnew.setId("");
					person.setDz(qlrperson.getDz());
					person.setDh(qlrperson.getDh());
					person.setXb(qlrperson.getXb());
					person.setYb(qlrperson.getYb());
					person.setGzdw(qlrperson.getGzdw());
					person.setHjszss(qlrperson.getHjszss());
					person.setDzyj(qlrperson.getDzyj());
					personnew.setRymc(qlrperson.getQlrmc());
					personnew.setZjzl(qlrperson.getZjzl());
					personnew.setZjh(qlrperson.getZjh());
					personnew.setRylx(qlrperson.getQlrlx());
					regBasePersonService.save(personnew);
				}
			}
		}
		String xz = "", jq = "", zq = "";
		if (StringUtils.isNotBlank(request.getParameter("djq"))) {
			regBaseZdjbxxdr.setSeachcity(DictUtils.getDictValue(request.getParameter("djq"), "reg_bus_djq", ""));
			regBaseZdjbxxdr.setSeachprov(
					DictUtils.getDictValue(request.getParameter("djq"), "reg_bus_djq", "").substring(0, 6));
		}
		if (StringUtils.isNotBlank(request.getParameter("djzq"))) {
			regBaseZdjbxxdr.setSeachdistrict(DictUtils.getDictValue(request.getParameter("djzq"), "reg_bus_djzq", ""));
			regBaseZdjbxxdr.setZddm(DictUtils.getDictValue(request.getParameter("djzq"), "reg_bus_djzq", "")
					+ regBaseZdjbxxdr.getTdsyqdm() + regBaseZdjbxxdr.getZdtzm());
			regBaseZdjbxxdr.setBdcdyh(DictUtils.getDictValue(request.getParameter("djzq"), "reg_bus_djzq", "")
					+ regBaseZdjbxxdr.getTdsyqdm() + regBaseZdjbxxdr.getZdtzm());
			regBaseZdjbxxdr.setChcode(DictUtils.getDictValue(request.getParameter("djzq"), "reg_bus_djzq", ""));
		}
		// 判断是否为空,为空给默认值
		if (StringUtils.isBlank(regBaseZdjbxxdr.getDjjg()) || regBaseZdjbxxdr.getDjjg() == ""
				|| regBaseZdjbxxdr.getDjjg() == null) {
			String qxdm = DictUtils.getDictLabel(Global.getAreaCode(), "reg_bus_xq", "");
			// 如果是汉台区在重新赋值为汉中市
			if ("610702".equals(Global.getAreaCode())) {
				qxdm = "汉中市";
			}
			regBaseZdjbxxdr.setDjjg(qxdm + "不动产登记局");
		}
		if (regBaseZdjbxxdr.getDjsj() == null) {
			regBaseZdjbxxdr.setDjsj(DateUtils.parseDate(DateUtils.getDate("yyyy-MM-dd")));
		}
		if (StringUtils.isBlank(regBaseZdjbxxdr.getDbr()) || regBaseZdjbxxdr.getDbr() == ""
				|| regBaseZdjbxxdr.getDbr() == null) {
			User user = UserUtils.getUser();
			regBaseZdjbxxdr.setDbr(user.getName());
		}
		if (StringUtils.isBlank(regBaseZdjbxxdr.getDjyy()) || regBaseZdjbxxdr.getDjyy() == ""
				|| regBaseZdjbxxdr.getDjyy() == null) {
			regBaseZdjbxxdr.setDjyy("权籍调查信息录入");
		}
		if (regBaseZdjbxxdr.getFzsj() == null) {
			regBaseZdjbxxdr.setFzsj(regBaseZdjbxxdr.getDjsj());
		}

		// 宗地信息
		RegBaseZdjbxx zdjbxx = new RegBaseZdjbxx();
		// 构造宗地号
		if (regBaseZdjbxxdr.getZddm().substring(0, 12).length() == 12) {
			System.out.println(regBaseZdjbxxdr.getZddm().substring(0, 12));
			String maxZddmSxh = regBaseZdjbxxService.findMaxZddmByDistrict(regBaseZdjbxxdr.getZddm().substring(0, 12));// 使用当前宗地代码
			String ruleCode = regBaseZdjbxxdr.getZddm();
			RegBaseZdjbxxController zdjbxxc = new RegBaseZdjbxxController();
			String nextZddm = zdjbxxc.getNextZddm(maxZddmSxh, ruleCode);
			zdjbxx.setZddm(nextZddm);
			zdjbxx.setBdcdyh(nextZddm + "W00000000");
			regBaseZdjbxxdr.setZddm(nextZddm);
			regBaseZdjbxxdr.setBdcdyh(nextZddm + "W00000000");
		}
		// 保存宗地基本信息
		zdjbxx.setYsdm("2001010000");
		regBaseZdjbxxdr.setYsdm("2001010000");
		zdjbxx.setZdtzm(regBaseZdjbxxdr.getZdtzm());
		zdjbxx.setZl(regBaseZdjbxxdr.getZl());
		if (StringUtils.isNotBlank(String.valueOf(regBaseZdjbxxdr.getZdmj()))) {
			zdjbxx.setZdmj(Double.valueOf(regBaseZdjbxxdr.getZdmj()));
		}
		zdjbxx.setMjdw(regBaseZdjbxxdr.getMjdw());
		zdjbxx.setYt(regBaseZdjbxxdr.getYt());
		zdjbxx.setDj(regBaseZdjbxxdr.getDj());
		if (regBaseZdjbxxdr.getJg() != null) {
			zdjbxx.setJg(Double.valueOf(regBaseZdjbxxdr.getJg()));
		}
		zdjbxx.setQllx(regBaseZdjbxxdr.getQllx());
		zdjbxx.setQlxz(regBaseZdjbxxdr.getQlxz());
		zdjbxx.setQlsdfs(regBaseZdjbxxdr.getQlsdfs());
		zdjbxx.setRjl(regBaseZdjbxxdr.getRjl());
		zdjbxx.setJzmd(regBaseZdjbxxdr.getJzmd());
		zdjbxx.setJzxg(regBaseZdjbxxdr.getJzxg());
		zdjbxx.setZdszd(regBaseZdjbxxdr.getZdszd());
		zdjbxx.setZdszb(regBaseZdjbxxdr.getZdszb());
		zdjbxx.setZdszn(regBaseZdjbxxdr.getZdszn());
		zdjbxx.setZdszx(regBaseZdjbxxdr.getZdszx());
		zdjbxx.setZdt(regBaseZdjbxxdr.getZdt());
		zdjbxx.setTfh(regBaseZdjbxxdr.getTfh());
		zdjbxx.setDjh(regBaseZdjbxxdr.getDjh());
		zdjbxx.setDah(regBaseZdjbxxdr.getDah());
		zdjbxx.setBz(regBaseZdjbxxdr.getRemarks());
		zdjbxx.setZt(regBaseZdjbxxdr.getZt());
		zdjbxx.setSeachprov(regBaseZdjbxxdr.getSeachprov());
		zdjbxx.setSeachcity(regBaseZdjbxxdr.getSeachcity());
		zdjbxx.setSeachdistrict(regBaseZdjbxxdr.getSeachdistrict());
		zdjbxx.setZb(regBaseZdjbxxdr.getZb());
		zdjbxx.setQlrxm(regBaseZdjbxxdr.getQlrxm());
		zdjbxx.setZjlx(regBaseZdjbxxdr.getZjlx());
		zdjbxx.setSfzh(regBaseZdjbxxdr.getSfzh());
		zdjbxx.setTdsyqdm(regBaseZdjbxxdr.getTdsyqdm());

		zdjbxx.setStatus("1");
		zdjbxx.setHistory("1");
		zdjbxx.setIsaudit("2");
		zdjbxx.setIschafeng("0");
		zdjbxx.setIsdiya("0");
		zdjbxx.setIsyiyi("0");
		zdjbxx.setIslogout("0"); // 是否注销
		zdjbxx.setRemarks(regBaseZdjbxxdr.getRemarks());
		// 判断有没有宗地信息 有的话 更新
		RegBaseZdjbxx temp = new RegBaseZdjbxx();
		temp.setZddm(zdjbxx.getZddm());
		temp.setBdcdyh(zdjbxx.getBdcdyh());
		List<RegBaseZdjbxx> listZdjbxx = regBaseZdjbxxService.findList(temp);
		if (listZdjbxx != null && listZdjbxx.size() > 0) {
			temp = listZdjbxx.get(0);
			zdjbxx.setId(temp.getId());
		}
		regBaseZdjbxxService.save(zdjbxx);
		regBaseZdjbxxdrService.save(regBaseZdjbxxdr);
		// 宗地变化情况
		RegBaseZdbhqk bhqk = new RegBaseZdbhqk();
		bhqk.setZddm(zdjbxx.getZddm());
		bhqk.setYwh(regBaseZdjbxxdr.getYwh());
		bhqk.setZdid(zdjbxx.getId());
		bhqk.setOldzdid(zdjbxx.getId());
		regBaseZdbhqkService.save(bhqk);
		// 查询权利人信息
		RegBusBdcqzsdjxx bdcdjxx = new RegBusBdcqzsdjxx();
		RegBusHisHouseQlr qlr = new RegBusHisHouseQlr();
		qlr.setYwh(regBaseZdjbxxdr.getYwh());
		List<RegBusHisHouseQlr> qlrlist = regBusHisHouseQlrService.findList(qlr);// 获取权利人子表数据
		String qlrmc = "";
		String gyrmc = "";
		if (qlrlist.size() > 0) {
			for (int i = 0; i < qlrlist.size(); i++) {
				qlr = qlrlist.get(i);
				if (qlrlist.get(i).getSxh().equals("1")) {
					qlrmc = qlrlist.get(i).getQlrmc();
					bdcdjxx.setQlrmc(qlrmc);
					bdcdjxx.setGyqk(DictUtils.getDictLabel(qlr.getGyfs(), "reg_bus_gyfs", ""));
				} else {
					gyrmc += qlrlist.get(i).getQlrmc() + "; ";
				}
				// 首先获取权利人 ID个数
				int qlrmcOrderNumber = 1;
				RegBusQlr qlr_2 = new RegBusQlr();
				qlr_2.setYwh(regBaseZdjbxxdr.getYwh());
				List<RegBusQlr> qlrlist_1 = regBusQlrService.findList_1(qlr_2);
				int count = qlrlist_1.size();
				if (count > 0) {
					qlrmcOrderNumber = qlrlist_1.size() + 1;
				}
				RegBusQlr qlr_1 = new RegBusQlr();
				BeanUtils.copyProperties(qlr, qlr_1);
				qlr_1.setYsdm("2003000000");
				qlr_1.setPcode(qlr.getPcode());
				qlr_1.setBdcdyh(regBaseZdjbxxdr.getBdcdyh());
				qlr_1.setSxh(qlrmcOrderNumber);
				qlr_1.setQszt("1");
				qlr_1.setQllx(regBaseZdjbxxdr.getQllx());
				qlr_1.setId("");
				RegBusQlr qlr_11 = new RegBusQlr();
				qlr_11.setYwh(regBaseZdjbxxdr.getYwh());
				qlr_11.setPcode(qlr.getPcode());
				List<RegBusQlr> qlrlist_11 = regBusQlrService.findList_1(qlr_11);
				if (qlrlist_11.size() > 0) {
					qlr_1.setId(qlrlist_11.get(0).getId());
				}
				regBusQlrService.save(qlr_1);
			}
		}
		// 保存建设用地使用权信息
		RegBusJsydsyq regBusJsydsyq = new RegBusJsydsyq();
		regBusJsydsyq.setYsdm(zdjbxx.getYsdm());
		regBusJsydsyq.setZddm(zdjbxx.getZddm());
		regBusJsydsyq.setBdcdyh(zdjbxx.getBdcdyh());
		regBusJsydsyq.setYwh(regBaseZdjbxxdr.getYwh());
		regBusJsydsyq.setQllx(zdjbxx.getQllx());
		regBusJsydsyq.setDjlx(regBaseZdjbxxdr.getDjdl());
		regBusJsydsyq.setDjyy(regBaseZdjbxxdr.getDjyy());
		if (regBaseZdjbxxdr.getSyqmj() != null) {
			regBusJsydsyq.setSyqmj(Double.valueOf(regBaseZdjbxxdr.getSyqmj()));
		}
		regBusJsydsyq.setSyqqssj(regBaseZdjbxxdr.getSyqqssj());
		regBusJsydsyq.setSyqjssj(regBaseZdjbxxdr.getSyqjssj());
		if (regBaseZdjbxxdr.getJg() != null) {
			regBusJsydsyq.setQdjg(Double.valueOf(regBaseZdjbxxdr.getJg()));
		}
		regBusJsydsyq.setBdcqzh(regBaseZdjbxxdr.getBdcqzh());
		regBusJsydsyq.setQxdm(regBaseZdjbxxdr.getQxdm());
		regBusJsydsyq.setDjjg(regBaseZdjbxxdr.getDjjg());
		regBusJsydsyq.setDbr(regBaseZdjbxxdr.getDbr());
		regBusJsydsyq.setDjsj(regBaseZdjbxxdr.getDjsj());
		regBusJsydsyq.setQszt("1");
		regBusJsydsyq.setFj(regBaseZdjbxxdr.getFj());
		// 同一个业务号下是否存在 已存在更新
		RegBusJsydsyq tempRegBusJsydsyq = new RegBusJsydsyq();
		tempRegBusJsydsyq.setYwh(regBaseZdjbxxdr.getYwh());
		List<RegBusJsydsyq> listRegBusJsydsyq = regBusJsydsyqService.findList(tempRegBusJsydsyq);
		if (listRegBusJsydsyq != null && listRegBusJsydsyq.size() > 0) {
			tempRegBusJsydsyq = listRegBusJsydsyq.get(0);
			regBusJsydsyq.setId(tempRegBusJsydsyq.getId());
		}
		regBusJsydsyqService.save(regBusJsydsyq);
		// 保存已登记信息
		bdcdjxx.setYwh(regBaseZdjbxxdr.getYwh());
		bdcdjxx.setZddm(zdjbxx.getZddm());
		bdcdjxx.setBdcdyh(zdjbxx.getBdcdyh());
		bdcdjxx.setBdcqzh(regBaseZdjbxxdr.getBdcqzh());
		// bdcdjxx.setBdcqzbh(regBusHisBdcqzsdjxx.getBdcqzbh());
		bdcdjxx.setQllx(regBaseZdjbxxdr.getQllx());
		bdcdjxx.setDbsj(DateUtils.formatDate(regBaseZdjbxxdr.getDjsj(), "yyyy-MM-dd"));
		bdcdjxx.setZl(regBaseZdjbxxdr.getZl());
		bdcdjxx.setQlxz(DictUtils.getDictLabel(regBaseZdjbxxdr.getQlxz(), "reg_bus_qlxz", ""));
		bdcdjxx.setYt(regBaseZdjbxxdr.getYt());
		bdcdjxx.setMj(regBaseZdjbxxdr.getZdmj() + "");
		if (regBaseZdjbxxdr.getSyqqssj() != null) {
			if (regBaseZdjbxxdr.getSyqjssj() != null) {
				bdcdjxx.setSyqx(DateUtils.formatDate(regBaseZdjbxxdr.getSyqqssj(), "yyyy年MM月dd日") + "起"
						+ DateUtils.formatDate(regBaseZdjbxxdr.getSyqjssj(), "yyyy年MM月dd日") + "止;");
			} else {
				bdcdjxx.setSyqx(DateUtils.formatDate(regBaseZdjbxxdr.getSyqqssj(), "yyyy年MM月dd日") + "起");
			}
		}
		bdcdjxx.setTh(regBaseZdjbxxdr.getTfh());
		bdcdjxx.setFzsj((DateUtils.formatDate(regBaseZdjbxxdr.getFzsj(), "yyyy-MM-dd")));
		bdcdjxx.setDjlx(regBaseZdjbxxdr.getDjxl());
		bdcdjxx.setStatus("1");
		bdcdjxx.setIshistory("1");
		bdcdjxx.setIslogout("0");
		bdcdjxx.setIsprint("0");
		bdcdjxx.setIsfdsj(Integer.valueOf("0"));
		if (regBaseZdjbxxdr.getQllx().equals("1") || regBaseZdjbxxdr.getQllx().equals("2")
				|| regBaseZdjbxxdr.getQllx().equals("4") || regBaseZdjbxxdr.getQllx().equals("6")
				|| regBaseZdjbxxdr.getQllx().equals("8")) {
			bdcdjxx.setRights("1");
		}
		if (regBaseZdjbxxdr.getQllx().equals("3") || regBaseZdjbxxdr.getQllx().equals("5")
				|| regBaseZdjbxxdr.getQllx().equals("7")) {
			bdcdjxx.setRights("3");
		}
		if (regBaseZdjbxxdr.getQllx().equals("24")) {
			bdcdjxx.setRights("2");
		}
		bdcdjxx.setFj(regBaseZdjbxxdr.getFj());
		RegBusBdcqzsdjxx djxxold = new RegBusBdcqzsdjxx();
		djxxold.setYwh(regBaseZdjbxxdr.getYwh());
		djxxold.setBdcdyh(regBaseZdjbxxdr.getBdcdyh());
		djxxold.setIslogout("0");
		List<RegBusBdcqzsdjxx> djxoldlist = regBusBdcqzsdjxxService.findList(djxxold);
		if (djxoldlist.size() > 0) {
			djxxold = djxoldlist.get(0);
			bdcdjxx.setId(djxxold.getId());
		}
		// oldid; //源业务号
		regBusBdcqzsdjxxService.save(bdcdjxx);
		// 确权表插入数据
		RegBusRights rights = new RegBusRights();
		rights.setBdcdyh(zdjbxx.getBdcdyh());
		rights.setSshiyq(regBaseZdjbxxdr.getYwh());
		rights.setRemarks(regBaseZdjbxxdr.getDjxl());
		regBusRightsService.save(rights);

		addMessage(redirectAttributes, "不动产登记历史数据审核成功!");
		ModelMap modelMap = new ModelMap();
		modelMap.put("zddm", zdjbxx.getZddm());
		modelMap.put("bdcdyh", zdjbxx.getBdcdyh());
		modelMap.put("chid", zdjbxx.getChid());
		modelMap.put("islogout", zdjbxx.getIslogout());
		modelMap.put("ysdm", zdjbxx.getYsdm());
		modelMap.put("zb", zdjbxx.getZb());
		modelMap.put("zdtzm", zdjbxx.getZdtzm());
		modelMap.put("zdjbxx", zdjbxx);
		return modelMap;

	}

	@RequiresPermissions("reg:bus:regBaseZdjbxxdr:edit")
	@RequestMapping(value = "audit1")
	@ResponseBody
	public ModelMap audit1(RegBaseZdjbxx regBaseZdjbxxdr, RedirectAttributes redirectAttributes,
			HttpServletRequest request, Model model) {
		ModelMap modelMap = new ModelMap();
		modelMap.put("zb", regBaseZdjbxxdr.getZb());
		modelMap.put("zdtzm", regBaseZdjbxxdr.getZdtzm());
		modelMap.put("regBaseZdjbxxdr", regBaseZdjbxxdr);
		regBaseZdjbxxdr.setIslogout("3");//满足首次登记条件
		regBaseZdjbxxdr.setIsaudit("1"); 
		regBaseZdjbxxService.save(regBaseZdjbxxdr);
		RegBaseChxx11 chxx = regBaseChxxService.get(regBaseZdjbxxdr.getChid());
		chxx.setIsaudit("2");
		regBaseChxxService.save(chxx);
		return modelMap;
	}

	/**
	 * 下载导入用户数据模板
	 * 
	 * @param response
	 * @param redirectAttributes
	 * @return
	 */
	@RequiresPermissions("reg:bus:regBaseZdjbxxdr:edit")
	@RequestMapping(value = "importFileTemplate")
	public String importFileTemplate(Model model, HttpServletResponse response, RedirectAttributes redirectAttributes) {
		response.setCharacterEncoding("UTF-8");
		// String filepath =
		// "C:"+File.separator+"download"+File.separator+"宗地基本信息批量导入模板.xlsx";
		// String filepath =Global.getUserfilesBaseDir()+ "宗地基本信息批量导入模板.xlsx";
		String filepath = Global.getUserfilesBaseDir() + "/static/" + "download" + File.separator
				+ "宅基地权籍信息批量导入模板V1.0.xlsx";
		if (filepath != null) {
			OutputStream os = null;
			FileInputStream fis = null;
			try {
				String file = filepath;
				if (!(new File(file)).exists()) {
					model.addAttribute("msg", "没有找到下载源文件。");
					return "modules/reg/bus/regBaseZdjbxxdrList";
				}
				String filename = file.substring(file.lastIndexOf(File.separator) + 1);
				System.out.println("文件名为:" + filename);
				os = response.getOutputStream();
				response.setHeader("content-disposition",
						"attachment;filename=" + new String(filename.getBytes("GBK"), "ISO-8859-1"));
				response.setContentType("application/octet-stream");// 八进制流
																	// 与文件类型无关
				byte temp[] = new byte[1024];
				fis = new FileInputStream(file);
				int n = 0;
				while ((n = fis.read(temp)) != -1) {
					os.write(temp, 0, n);
				}
				os.flush();

			} catch (IOException e) {
				model.addAttribute("msg", "出错了,请稍后重试。");
				return "modules/reg/bus/regBaseZdjbxxdrList";
			} finally {
				if (os != null) {
					try {
						os.close();
					} catch (IOException e) {
						System.out.println("输出流关闭异常");
						model.addAttribute("msg", "出错了,请稍后重试。");
						return "modules/reg/bus/regBaseZdjbxxdrList";
					}
				}
				if (fis != null) {
					try {
						fis.close();
					} catch (IOException e) {
						System.out.println("输入流关闭异常");
						model.addAttribute("msg", "出错了,请稍后重试。");
						return "modules/reg/bus/regBaseZdjbxxdrList";
					}
				}
			}
		}
		response.reset();
		return "modules/reg/bus/regBaseZdjbxxdrList";
	}

	/*
	 * @RequestMapping(value = "importFileTemplate") public String
	 * importFileTemplate(HttpServletResponse response, RedirectAttributes
	 * redirectAttributes) { try { String fileName = "宗地基本信息数据导入模板.xlsx";
	 * //----------------------------------------------- HSSFWorkbook wb = new
	 * HSSFWorkbook(); HSSFSheet sheet=wb.createSheet("模板");
	 * 
	 * HSSFRow row1=sheet.createRow(0); HSSFCell cell=row1.createCell(0);
	 * row1.setHeight((short) (15.625*32));//n为行高的像素数 cell.setCellValue(
	 * "不 动 产 登 记 平 台 宗 地 基 本 信 息 导 入 模 板 V1.0"); HSSFCellStyle cellStyle =
	 * wb.createCellStyle();//0,0样式0,0样式
	 * cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); //填充单元格0,0样式
	 * cellStyle.setFillForegroundColor(HSSFColor.LIGHT_TURQUOISE.index);
	 * //0,0样式 cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
	 * //------------------字体 HSSFFont font = wb.createFont();
	 * font.setFontName("微软雅黑"); font.setFontHeightInPoints((short) 12);//
	 * 设置字体大小 cellStyle.setFont(font); cell.setCellStyle(cellStyle);
	 * //------------------- CellRangeAddress cellRangeAddress = new
	 * CellRangeAddress(0, 0, 0,29); sheet.addMergedRegion(cellRangeAddress);
	 * 
	 * 
	 * HSSFRow row2=sheet.createRow(1); row2.createCell(0).setCellValue("必录");
	 * row2.createCell(1).setCellValue("必录");
	 * row2.createCell(2).setCellValue("必录");
	 * row2.createCell(3).setCellValue("必录");
	 * row2.createCell(4).setCellValue("必录");
	 * row2.createCell(5).setCellValue("必录");
	 * row2.createCell(6).setCellValue("必录");
	 * row2.createCell(7).setCellValue("必录");
	 * row2.createCell(8).setCellValue("必录");
	 * row2.createCell(9).setCellValue("必录");
	 * row2.createCell(10).setCellValue("选填");
	 * row2.createCell(11).setCellValue("选填");
	 * 
	 * row2.createCell(12).setCellValue("必录");
	 * row2.createCell(13).setCellValue("必录");
	 * row2.createCell(14).setCellValue("必录");
	 * row2.createCell(15).setCellValue("选填");
	 * row2.createCell(16).setCellValue("选填");
	 * row2.createCell(17).setCellValue("选填");
	 * 
	 * row2.createCell(18).setCellValue("必录");
	 * row2.createCell(19).setCellValue("必录");
	 * row2.createCell(20).setCellValue("必录");
	 * row2.createCell(21).setCellValue("必录");
	 * row2.createCell(22).setCellValue("必录");
	 * row2.createCell(23).setCellValue("必录");
	 * row2.createCell(24).setCellValue("选填");
	 * 
	 * row2.createCell(25).setCellValue("必录");
	 * row2.createCell(26).setCellValue("选填");
	 * 
	 * row2.createCell(27).setCellValue("必录");
	 * row2.createCell(28).setCellValue("必录");
	 * row2.createCell(29).setCellValue("有效");
	 * 
	 * HSSFRow row3=sheet.createRow(2);
	 * row3.createCell(0).setCellValue("宗地特征码");
	 * row3.createCell(1).setCellValue("权利人姓名");
	 * row3.createCell(2).setCellValue("证件类型");
	 * row3.createCell(3).setCellValue("证件号码");
	 * row3.createCell(4).setCellValue("坐标");
	 * row3.createCell(5).setCellValue("土地所有权代码");
	 * row3.createCell(6).setCellValue("坐落");
	 * row3.createCell(7).setCellValue("宗地面积");
	 * row3.createCell(8).setCellValue("面积单位");
	 * row3.createCell(9).setCellValue("用途");
	 * row3.createCell(10).setCellValue("等级");
	 * row3.createCell(11).setCellValue("价格");
	 * 
	 * row3.createCell(12).setCellValue("权利类型");
	 * row3.createCell(13).setCellValue("权利性质");
	 * row3.createCell(14).setCellValue("权利设定方式");
	 * row3.createCell(15).setCellValue("容积率");
	 * row3.createCell(16).setCellValue("建筑密度");
	 * row3.createCell(17).setCellValue("建筑限高(m)");
	 * 
	 * row3.createCell(18).setCellValue("宗地四至东");
	 * row3.createCell(19).setCellValue("宗地四至南");
	 * row3.createCell(20).setCellValue("宗地四至西");
	 * row3.createCell(21).setCellValue("宗地四至北");
	 * row3.createCell(22).setCellValue("宗地图");
	 * row3.createCell(23).setCellValue("图幅号");
	 * row3.createCell(24).setCellValue("地籍号");
	 * row3.createCell(25).setCellValue("档案号");
	 * row3.createCell(26).setCellValue("备注");
	 * 
	 * row3.createCell(27).setCellValue("测绘人员");
	 * row3.createCell(28).setCellValue("测绘时间");
	 * row3.createCell(29).setCellValue("状态"); //--------------加下拉框 HSSFSheet st
	 * = wb.getSheetAt(0);//取得第一个sheet //
	 * st.getLastRowNum();//这个就能取得第一个sheet中一共多少行 CellRangeAddressList regions =
	 * new CellRangeAddressList(3,st.getLastRowNum(), 0, 0); // 生成下拉框内容
	 * DVConstraint constraint = DVConstraint.createExplicitListConstraint(new
	 * String[] { "集体土地所有权宗地", "建设用地使用权宗地(地表)" }); // 绑定下拉框和作用区域
	 * HSSFDataValidation data_validation = new
	 * HSSFDataValidation(regions,constraint); // 对sheet页生效
	 * sheet.addValidationData(data_validation); //---------------------
	 * //输出Excel文件 OutputStream output=response.getOutputStream();
	 * response.reset(); response.setHeader("Content-disposition",
	 * "attachment; filename=details.xls");
	 * response.setContentType("application/msexcel"); wb.write(output);
	 * output.close(); //-----------------------------------------------------
	 * return null; } catch (Exception e) { addMessage(redirectAttributes,
	 * "导入模板下载失败!失败信息:"+e.getMessage()); } return
	 * "modules/reg/bus/regBaseZdjbxxdrList"; }
	 */
	public String changegeshi(Cell cell, boolean boolflag) {
		String value = "";
		if (boolflag == false) {
			switch (cell.getCellType()) { // 根据cell中的类型来输出数据
			case HSSFCell.CELL_TYPE_NUMERIC:
				value = String.valueOf(cell.getNumericCellValue());
				// String df= String.valueOf(new
				// DecimalFormat("0.###").format(cell.getNumericCellValue()));
				// value=df;
				break;
			case HSSFCell.CELL_TYPE_STRING:
				value = cell.getStringCellValue();
				break;
			case HSSFCell.CELL_TYPE_BOOLEAN:
				value = String.valueOf(cell.getBooleanCellValue());
				break;
			case HSSFCell.CELL_TYPE_FORMULA:
				value = String.valueOf(cell.getCellFormula());
				break;
			default:
				value = "";
				break;
			}
		} else// XSSFCell
		{
			switch (cell.getCellType()) { // 根据cell中的类型来输出数据
			case XSSFCell.CELL_TYPE_NUMERIC:
				value = String.valueOf(cell.getNumericCellValue());
				break;
			case XSSFCell.CELL_TYPE_STRING:
				value = cell.getStringCellValue();
				break;
			case XSSFCell.CELL_TYPE_BOOLEAN:
				value = String.valueOf(cell.getBooleanCellValue());
				break;
			case XSSFCell.CELL_TYPE_FORMULA:
				value = String.valueOf(cell.getCellFormula());
				break;
			default:
				value = "";
				break;
			}
		}
		return value;
	}

	// 数据导入
	/**
	 * 导入用户数据
	 * 
	 * @param file
	 * @param redirectAttributes
	 * @return
	 */
	@RequestMapping(value = "importFile")
	public String importFile(RegBaseZdjbxxdr regBaseZdjbxxdr, MultipartFile file, RedirectAttributes redirectAttributes,
			HttpServletRequest request, Model model, HttpServletResponse response) {
		String ysdm = "", zddm = "", bdcdyh = "", ybdcdyh = "", sfczr = "", qlrlx = "", gyqk = "", dz = "", zb = "",
				syqqssj = "", syqjssj = "", bdcqzsh = "", djxl = "", qxdm = "", djyy = "", xmmc = "", fj = "";
		String zdtzmt = "", qlrxmt = "", zjlxt = "", zjhmt = "", zbt = "", tdsyqdmt = "", zlt = "", zdmjt = "",
				mjdw = "";
		String ytt = "", djt = "", jgt = "", qllxt = "", qlxzt = "", qlsdfst = "", rjlt = "", jzmdt = "", jzxgt = "";
		String zdszdt = "", zdsznt = "", zdszxt = "", zdszbt = "", zdtt = "", tfht = "", djht = "", daht = "", bzt = "";
		String chryt = "", chsjt = "", ztt = "";
		String tempywh = "";
		RegBaseZdjbxxdr regBaseZdjbxxdr1 = new RegBaseZdjbxxdr();
		List<RegBaseZdjbxxdr> TempregBaseZdjbxxdr = new ArrayList<RegBaseZdjbxxdr>();
		// --------------------------------
		String fileName = file.getOriginalFilename();
		List<String> qlrxmList = new ArrayList<String>();
		List<String> zbxxList = new ArrayList<String>();
		List<String> zdmjList = new ArrayList<String>();
		if (StringUtils.isNotBlank(fileName)) {
			boolean isE2007 = false; // 判断是否是excel2007格式

			if (fileName.endsWith("xlsx"))
				isE2007 = true;
			try {
				// FileInputStream input = new FileInputStream(fileName);
				// //建立输入流
				InputStream input = file.getInputStream();
				Workbook wb = null;
				// 根据文件格式(2003或者2007)来初始化
				if (isE2007) {
					wb = new XSSFWorkbook(input);
				} else {
					wb = new HSSFWorkbook(input);
				}

				Sheet sheet = wb.getSheetAt(1); // 获得第一个表单

				Iterator<Row> rows = sheet.rowIterator(); // 获得第一个表单的迭代器

				while (rows.hasNext()) {
					Row row = rows.next(); // 获得行数据
					if (row.getRowNum() > 2) {
						try {
							regBaseZdjbxxdr1 = new RegBaseZdjbxxdr();

							Cell cells0 = row.getCell(6);
							if (cells0 != null) {
								zdtzmt = changegeshi(cells0, isE2007);
								zdtzmt = DictUtils.getDictValue(zdtzmt, "reg_bus_zdtzm", "");
							}
							if ((zdtzmt != null) && (zdtzmt != "")) {
								Cell cells1 = row.getCell(0);
								if (cells1 != null)
									qlrxmt = changegeshi(cells1, isE2007);

								Cell cells2 = row.getCell(1);
								if (cells2 != null)
									zjlxt = changegeshi(cells2, isE2007);
								zjlxt = DictUtils.getDictValue(zjlxt, "reg_bus_zjlx", "");

								Cell cells3 = row.getCell(2);
								if (cells3 != null) {
									zjhmt = changegeshi(cells3, isE2007);
								}

								Cell cells09 = row.getCell(3);// 权利人类型
								if (cells09 != null) {
									qlrlx = changegeshi(cells09, isE2007);
								}
								qlrlx = DictUtils.getDictValue(qlrlx, "reg_bus_qlrlx", "");

								Cell cells010 = row.getCell(4);// 共有情况
								if (cells010 != null) {
									gyqk = changegeshi(cells010, isE2007);
								}
								gyqk = DictUtils.getDictValue(gyqk, "reg_bus_gyfs", "");

								Cell cells011 = row.getCell(5);// 地址
								if (cells011 != null) {
									dz = changegeshi(cells011, isE2007);
								}
								regBaseZdjbxxdr1.setQlrxm(qlrxmt);
								regBaseZdjbxxdr1.setZjlx(zjlxt);
								regBaseZdjbxxdr1.setSfzh(zjhmt);
								regBaseZdjbxxdr1.setQlrlx(qlrlx);
								regBaseZdjbxxdr1.setGyqk(gyqk);
								regBaseZdjbxxdr1.setDz(dz);
								regBaseZdjbxxdr1.setZdtzm(zdtzmt);

								Cell cells4 = row.getCell(7);
								if (cells4 != null)
									zbt = changegeshi(cells4, isE2007);
								Pattern p = Pattern.compile("\\s*|\t|\r|\n");
								Matcher ma = p.matcher(zbt);
								regBaseZdjbxxdr1.setZb(zbt);
								// ------------------------
								List<RegBaseZdjbxxdr> regBaseZdjbxxdrList = new ArrayList<RegBaseZdjbxxdr>();
								RegBaseZdjbxxdr regBaseZdjbxxdrTemp = new RegBaseZdjbxxdr();
								regBaseZdjbxxdrTemp.setZb(zbt);
								regBaseZdjbxxdrList = regBaseZdjbxxdrService.findList(regBaseZdjbxxdrTemp);
								for (int m = 0; m < regBaseZdjbxxdrList.size(); m++) {
									if (regBaseZdjbxxdrList.get(m).getZb().equals(zbt)) {
										addMessage(redirectAttributes, "导入失败,第" + (row.getRowNum() - 2) + "条数据坐标重复");
										return "redirect:" + Global.getAdminPath() + "/reg/bus/regBaseZdjbxxdr/list";
									}
								}
								// ================================
								Cell cells5 = row.getCell(8);
								if (cells5 != null)
									tdsyqdmt = changegeshi(cells5, isE2007);
								tdsyqdmt = DictUtils.getDictValue(tdsyqdmt, "reg_bus_tdsyqdm", "");

								Cell cells6 = row.getCell(9);
								if (cells6 != null) {
									zlt = changegeshi(cells6, isE2007);
								}

								Cell cells7 = row.getCell(10);
								if (cells7 != null)
									zdmjt = changegeshi(cells7, isE2007);

								Cell cells8 = row.getCell(11);
								if (cells8 != null)
									mjdw = changegeshi(cells8, isE2007);
								mjdw = DictUtils.getDictValue(mjdw, "reg_bus_mjdw", "");

								Cell cells9 = row.getCell(12);
								if (cells9 != null) {
									ytt = changegeshi(cells9, isE2007);
								}

								Cell cells019 = row.getCell(13);
								if (cells019 != null) {
									syqqssj = changegeshi(cells019, isE2007);
									SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
									Date date = null;
									try {
										date = format.parse(syqqssj);
										regBaseZdjbxxdr1.setSyqqssj(date);
									} catch (Exception ex) {
										System.out.println("发生异常的原因为 :" + ex.getMessage());
										ex.printStackTrace();
									}
								}

								Cell cells020 = row.getCell(14);
								if (cells020 != null) {
									syqjssj = changegeshi(cells020, isE2007);
									SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
									Date date = null;
									try {
										date = format.parse(syqjssj);
										regBaseZdjbxxdr1.setSyqjssj(date);
									} catch (Exception ex) {
										System.out.println("发生异常的原因为 :" + ex.getMessage());
										ex.printStackTrace();
									}
								}

								Cell cells04 = row.getCell(15);
								if (cells04 != null)
									ybdcdyh = changegeshi(cells04, isE2007);

								Cell cells021 = row.getCell(16);
								if (cells021 != null) {
									bdcqzsh = changegeshi(cells021, isE2007);
								}

								regBaseZdjbxxdr1.setTdsyqdm(tdsyqdmt);
								regBaseZdjbxxdr1.setZl(zlt);
								regBaseZdjbxxdr1.setZdmj(zdmjt);
								regBaseZdjbxxdr1.setMjdw(mjdw);
								regBaseZdjbxxdr1.setYt(ytt);
								regBaseZdjbxxdr1.setYbdcdyh(ybdcdyh);
								regBaseZdjbxxdr1.setBdcqzh(bdcqzsh);

								Cell cells024 = row.getCell(17);
								if (cells024 != null) {
									djyy = changegeshi(cells024, isE2007);
								}

								Cell cells025 = row.getCell(18);
								if (cells025 != null) {
									xmmc = changegeshi(cells025, isE2007);
								}

								Cell cells026 = row.getCell(19);
								if (cells026 != null) {
									fj = changegeshi(cells026, isE2007);
								}

								Cell cells10 = row.getCell(20);
								if (cells10 != null)
									djt = changegeshi(cells10, isE2007);
								djt = DictUtils.getDictValue(djt, "reg_bus_tddj", "");

								Cell cells11 = row.getCell(21);
								if (cells11 != null)
									jgt = changegeshi(cells11, isE2007);
								if (jgt == "")
									jgt = "0";

								Cell cells13 = row.getCell(22);
								if (cells13 != null)
									qlxzt = changegeshi(cells13, isE2007);
								qlxzt = DictUtils.getDictValue(qlxzt, "reg_bus_qlxz", "");

								Cell cells14 = row.getCell(23);
								if (cells14 != null)
									qlsdfst = changegeshi(cells14, isE2007);
								qlsdfst = DictUtils.getDictValue(qlsdfst, "reg_bus_qlsdfs", "");

								Cell cells15 = row.getCell(24);
								if (cells15 != null) {
									rjlt = changegeshi(cells15, isE2007);
								}

								Cell cells16 = row.getCell(25);
								if (cells16 != null)
									jzmdt = changegeshi(cells16, isE2007);

								Cell cells17 = row.getCell(26);
								if (cells17 != null)
									jzxgt = changegeshi(cells17, isE2007);

								Cell cells18 = row.getCell(27);
								if (cells18 != null) {
									zdszdt = changegeshi(cells18, isE2007);
								}

								Cell cells19 = row.getCell(28);
								if (cells19 != null)
									zdsznt = changegeshi(cells19, isE2007);

								Cell cells20 = row.getCell(29);
								if (cells20 != null)
									zdszxt = changegeshi(cells20, isE2007);

								Cell cells21 = row.getCell(30);
								if (cells21 != null) {
									zdszbt = changegeshi(cells21, isE2007);
								}

								Cell cells22 = row.getCell(31);
								if (cells22 != null)
									zdtt = changegeshi(cells22, isE2007);

								Cell cells23 = row.getCell(32);
								if (cells23 != null)
									tfht = changegeshi(cells23, isE2007);

								Cell cells24 = row.getCell(33);
								if (cells24 != null) {
									djht = changegeshi(cells24, isE2007);
								}

								Cell cells25 = row.getCell(34);
								if (cells25 != null)
									daht = changegeshi(cells25, isE2007);

								Cell cells26 = row.getCell(35);
								if (cells26 != null)
									bzt = changegeshi(cells26, isE2007);

								Cell cells27 = row.getCell(36);
								if (cells27 != null) {
									chryt = changegeshi(cells27, isE2007);
								}

								regBaseZdjbxxdr1.setDjyy(djyy);
								regBaseZdjbxxdr1.setXmmc(xmmc);
								regBaseZdjbxxdr1.setFj(fj);
								regBaseZdjbxxdr1.setDj(djt);
								regBaseZdjbxxdr1.setJg(Double.valueOf(jgt));
								regBaseZdjbxxdr1.setQlxz(qlxzt);
								regBaseZdjbxxdr1.setQlsdfs(qlsdfst);
								regBaseZdjbxxdr1.setRjl(rjlt);
								regBaseZdjbxxdr1.setJzmd(jzmdt);
								regBaseZdjbxxdr1.setJzxg(jzxgt);
								regBaseZdjbxxdr1.setZdszd(zdszdt);
								regBaseZdjbxxdr1.setZdszn(zdsznt);
								regBaseZdjbxxdr1.setZdszx(zdszxt);
								regBaseZdjbxxdr1.setZdszb(zdszbt);
								regBaseZdjbxxdr1.setZdt(zdtt);
								regBaseZdjbxxdr1.setTfh(tfht);
								regBaseZdjbxxdr1.setDjh(djht);
								regBaseZdjbxxdr1.setDah(daht);
								regBaseZdjbxxdr1.setBz(bzt);
								regBaseZdjbxxdr1.setChrymc(chryt);

								Cell cells28 = row.getCell(37);
								if (cells28 != null) {
									chsjt = changegeshi(cells28, isE2007);
									SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
									Date date = null;
									try {
										date = format.parse(chsjt);
										regBaseZdjbxxdr1.setChsj(date);
									} catch (Exception ex) {
										System.out.println("发生异常的原因为 :" + ex.getMessage());
										ex.printStackTrace();
									}
								}
								regBaseZdjbxxdr1.setIsaudit("0");
								TempregBaseZdjbxxdr.add(regBaseZdjbxxdr1);
							} else {
								// 用户权限分配
								User user = UserUtils.getUser();
								Office office = officeService.get(user.getCurrentUser().getOffice().getId());
								if ("S00001001007".equals(office.getCode())) {
									model.addAttribute("SH", office.getCode());
								} else {
									model.addAttribute("SH", office.getCode());
								}
								if (StringUtils.isNotBlank(request.getParameter("optype"))) {
									model.addAttribute("optype", "1");
								}
								if (StringUtils.isNotBlank(request.getParameter("WO"))) {
									model.addAttribute("WO", "1");
								}
								if (StringUtils.isNotBlank(request.getParameter("scbj"))) {
									model.addAttribute("scbj", "1");
								}
								if (StringUtils.isNotBlank(request.getParameter("ids"))) {
									regBaseZdjbxxdr.setId(request.getParameter("ids"));
								}
								if (StringUtils.isNotBlank(request.getParameter("dyh"))) {
									regBaseZdjbxxdr.setBdcdyh(request.getParameter("dyh"));
								}
								// TODO 1. 检查为什么isAudit是null
								// TODO 2. 判断页面显示是否需要考虑null的情况
								Page<RegBaseZdjbxxdr> page = regBaseZdjbxxdrService
										.findPage(new Page<RegBaseZdjbxxdr>(request, response), regBaseZdjbxxdr);
								model.addAttribute("page", page);
								if (TempregBaseZdjbxxdr.size() > 0) {
									for (int i = 0; i < TempregBaseZdjbxxdr.size(); i++) {
										tempywh = getNextYwhs();
										TempregBaseZdjbxxdr.get(i).setYwh(tempywh);
										saveQlr(TempregBaseZdjbxxdr.get(i), request);
										regBaseZdjbxxdrService.save(TempregBaseZdjbxxdr.get(i));
									}
								}
								// model.addAttribute("TempregBaseZdjbxxdr",
								// TempregBaseZdjbxxdr);
								// model.addAttribute("TempregBaseZdjbxxdr",
								// JsonMapper.toJsonString(TempregBaseZdjbxxdr));
								// model.addAttribute("dr", "jbxxdr");
								// return "modules/reg/bus/regBaseZdjbxxdrList";
								return "redirect:" + Global.getAdminPath()
										+ "/reg/bus/regBaseZdjbxxdr/list";
							}
						} catch (Exception e) {
							e.printStackTrace();
						}
					}
				}

				if (TempregBaseZdjbxxdr.size() > 0) {
					for (int i = 0; i < TempregBaseZdjbxxdr.size(); i++) {
						tempywh = getNextYwhs();
						TempregBaseZdjbxxdr.get(i).setYwh(tempywh);
						saveQlr(TempregBaseZdjbxxdr.get(i), request);
						regBaseZdjbxxdrService.save(TempregBaseZdjbxxdr.get(i));
					}
					TempregBaseZdjbxxdr = new ArrayList<RegBaseZdjbxxdr>();
				}
				// 用户权限分配
				User user = UserUtils.getUser();
				Office office = officeService.get(user.getCurrentUser().getOffice().getId());
				if ("S00001001007".equals(office.getCode())) {
					model.addAttribute("SH", office.getCode());
				} else {
					model.addAttribute("SH", office.getCode());
				}
				if (StringUtils.isNotBlank(request.getParameter("optype"))) {
					model.addAttribute("optype", "1");
				}
				if (StringUtils.isNotBlank(request.getParameter("WO"))) {
					model.addAttribute("WO", "1");
				}
				if (StringUtils.isNotBlank(request.getParameter("scbj"))) {
					model.addAttribute("scbj", "1");
				}
				if (StringUtils.isNotBlank(request.getParameter("ids"))) {
					regBaseZdjbxxdr.setId(request.getParameter("ids"));
				}
				if (StringUtils.isNotBlank(request.getParameter("dyh"))) {
					regBaseZdjbxxdr.setBdcdyh(request.getParameter("dyh"));
				}
				// TODO 1. 检查为什么isAudit是null
				// TODO 2. 判断页面显示是否需要考虑null的情况
				Page<RegBaseZdjbxxdr> page = regBaseZdjbxxdrService
						.findPage(new Page<RegBaseZdjbxxdr>(request, response), regBaseZdjbxxdr);
				model.addAttribute("page", page);
				return "redirect:" + Global.getAdminPath() + "/reg/bus/regBaseZdjbxxdr/list";
			}

			catch (Exception e) {
				addMessage(redirectAttributes, "导入数据失败!失败信息:" + e.getMessage());
			}
			return "redirect:" + Global.getAdminPath() + "/reg/bus/regBaseZdjbxxdr/list";
		} else {
			addMessage(redirectAttributes, "导入失败,请先选择文件");
			return "redirect:" + Global.getAdminPath() + "/reg/bus/regBaseZdjbxxdr/list";
		}

	}

	// 数据导入
	/**
	 * 导入用户数据
	 * 
	 * @param file
	 * @param redirectAttributes
	 * @return
	 */
	/*
	 * @RequestMapping(value = "importFile") public String
	 * importFile(RegBaseZdjbxxdr regBaseZdjbxxdr,MultipartFile file,
	 * RedirectAttributes redirectAttributes,HttpServletRequest request,Model
	 * model, HttpServletResponse response) { String zdtzmt="" ,qlrxmt=""
	 * ,zjlxt="",zjhmt="" ,zbt="" ,tdsyqdmt="",zlt="" ,zdmjt="" ,mjdw=""; String
	 * ytt="" ,djt="" ,jgt="",qllxt="" ,qlxzt="" ,qlsdfst="",rjlt="" ,jzmdt=""
	 * ,jzxgt=""; String zdszdt="" ,zdsznt="" ,zdszxt="",zdszbt="" ,zdtt=""
	 * ,tfht="",djht="" ,daht="" ,bzt=""; String chryt="" ,chsjt="" ,ztt="";
	 * RegBaseZdjbxxdr regBaseZdjbxxdr1=new RegBaseZdjbxxdr();
	 * List<RegBaseZdjbxxdr> TempregBaseZdjbxxdr=new
	 * ArrayList<RegBaseZdjbxxdr>();
	 * 
	 * //-------------------------------- String
	 * fileName=file.getOriginalFilename(); if(StringUtils.isNotBlank(fileName))
	 * { boolean isE2007 = false; //判断是否是excel2007格式
	 * 
	 * if(fileName.endsWith("xlsx")) isE2007 = true; try { // FileInputStream
	 * input = new FileInputStream(fileName); //建立输入流 InputStream input
	 * =file.getInputStream(); Workbook wb = null; //根据文件格式(2003或者2007)来初始化
	 * if(isE2007) { wb = new XSSFWorkbook(input); } else { wb = new
	 * HSSFWorkbook(input); }
	 * 
	 * Sheet sheet = wb.getSheetAt(0); //获得第一个表单
	 * 
	 * Iterator<Row> rows = sheet.rowIterator(); //获得第一个表单的迭代器
	 * 
	 * while (rows.hasNext()) { Row row = rows.next(); //获得行数据
	 * if(row.getRowNum()>2) { try { regBaseZdjbxxdr1=new RegBaseZdjbxxdr();
	 * Cell cells0=row.getCell(3); if(cells0!=null) {
	 * zdtzmt=changegeshi(cells0,isE2007); zdtzmt=DictUtils.getDictValue(zdtzmt,
	 * "reg_bus_zdtzm", ""); } if((zdtzmt!=null)&&(zdtzmt!="")) { Cell
	 * cells1=row.getCell(4);
	 * if(cells1!=null)qlrxmt=changegeshi(cells1,isE2007);
	 * 
	 * 
	 * Cell cells2=row.getCell(5);
	 * if(cells2!=null)zjlxt=changegeshi(cells2,isE2007);
	 * 
	 * zjlxt=DictUtils.getDictValue(zjlxt, "reg_bus_zjlx", "");
	 * regBaseZdjbxxdr1.setZjlx(zjlxt); regBaseZdjbxxdr1.setZdtzm(zdtzmt);
	 * regBaseZdjbxxdr1.setQlrxm(qlrxmt);
	 * 
	 * Cell cells3=row.getCell(6);
	 * if(cells3!=null){zjhmt=changegeshi(cells3,isE2007);}
	 * regBaseZdjbxxdr1.setSfzh(zjhmt);
	 * 
	 * Cell cells4=row.getCell(7);
	 * if(cells4!=null)zbt=changegeshi(cells4,isE2007);
	 * regBaseZdjbxxdr1.setZb(zbt);
	 * 
	 * Cell cells5=row.getCell(8);
	 * if(cells5!=null)tdsyqdmt=changegeshi(cells5,isE2007);
	 * tdsyqdmt=DictUtils.getDictValue(tdsyqdmt, "reg_bus_tdsyqdm", "");
	 * 
	 * regBaseZdjbxxdr1.setTdsyqdm(tdsyqdmt);
	 * 
	 * Cell cells6=row.getCell(9);
	 * if(cells6!=null){zlt=changegeshi(cells6,isE2007);}
	 * regBaseZdjbxxdr1.setZl(zlt);
	 * 
	 * Cell cells7=row.getCell(10);
	 * if(cells7!=null)zdmjt=changegeshi(cells7,isE2007);
	 * regBaseZdjbxxdr1.setZdmj(zdmjt);
	 * 
	 * Cell cells8=row.getCell(11);
	 * if(cells8!=null)mjdw=changegeshi(cells8,isE2007);
	 * mjdw=DictUtils.getDictValue(mjdw, "reg_bus_mjdw", "");
	 * regBaseZdjbxxdr1.setMjdw(mjdw);
	 * 
	 * Cell cells9=row.getCell(12);
	 * if(cells9!=null){ytt=changegeshi(cells9,isE2007);}
	 * regBaseZdjbxxdr1.setYt(ytt);
	 * 
	 * Cell cells10=row.getCell(13);
	 * if(cells10!=null)djt=changegeshi(cells10,isE2007);
	 * djt=DictUtils.getDictValue(djt, "reg_bus_tddj", "");
	 * regBaseZdjbxxdr1.setDj(djt);
	 * 
	 * Cell cells11=row.getCell(14);
	 * if(cells11!=null)jgt=changegeshi(cells11,isE2007); if(jgt=="") jgt="0";
	 * regBaseZdjbxxdr1.setJg(jgt);
	 * 
	 * Cell cells12=row.getCell(15);
	 * if(cells12!=null){qllxt=changegeshi(cells12,isE2007);}
	 * qllxt=DictUtils.getDictValue(qllxt, "reg_bus_qllx", "");
	 * 
	 * regBaseZdjbxxdr1.setQllx(qllxt);
	 * 
	 * Cell cells13=row.getCell(16);
	 * if(cells13!=null)qlxzt=changegeshi(cells13,isE2007);
	 * qlxzt=DictUtils.getDictValue(qlxzt, "reg_bus_qlxz", "");
	 * regBaseZdjbxxdr1.setQlxz(qlxzt);
	 * 
	 * Cell cells14=row.getCell(17);
	 * if(cells14!=null)qlsdfst=changegeshi(cells14,isE2007);
	 * qlsdfst=DictUtils.getDictValue(qlsdfst, "reg_bus_qlsdfs", "");
	 * regBaseZdjbxxdr1.setQlsdfs(qlsdfst);
	 * 
	 * Cell cells15=row.getCell(18);
	 * if(cells15!=null){rjlt=changegeshi(cells15,isE2007);}
	 * regBaseZdjbxxdr1.setRjl(rjlt);
	 * 
	 * Cell cells16=row.getCell(19);
	 * if(cells16!=null)jzmdt=changegeshi(cells16,isE2007);
	 * regBaseZdjbxxdr1.setJzmd(jzmdt);
	 * 
	 * Cell cells17=row.getCell(20);
	 * if(cells17!=null)jzxgt=changegeshi(cells17,isE2007);
	 * regBaseZdjbxxdr1.setJzxg(jzxgt);
	 * 
	 * Cell cells18=row.getCell(21);
	 * if(cells18!=null){zdszdt=changegeshi(cells18,isE2007);}
	 * regBaseZdjbxxdr1.setZdszd(zdszdt);
	 * 
	 * Cell cells19=row.getCell(22);
	 * if(cells19!=null)zdsznt=changegeshi(cells19,isE2007);
	 * regBaseZdjbxxdr1.setZdszn(zdsznt);
	 * 
	 * Cell cells20=row.getCell(23);
	 * if(cells20!=null)zdszxt=changegeshi(cells20,isE2007);
	 * regBaseZdjbxxdr1.setZdszx(zdszxt);
	 * 
	 * Cell cells21=row.getCell(24);
	 * if(cells21!=null){zdszbt=changegeshi(cells21,isE2007);}
	 * regBaseZdjbxxdr1.setZdszb(zdszbt);
	 * 
	 * Cell cells22=row.getCell(25);
	 * if(cells22!=null)zdtt=changegeshi(cells22,isE2007);
	 * regBaseZdjbxxdr1.setZdt(zdtt);
	 * 
	 * Cell cells23=row.getCell(26);
	 * if(cells23!=null)tfht=changegeshi(cells23,isE2007);
	 * regBaseZdjbxxdr1.setTfh(tfht);
	 * 
	 * Cell cells24=row.getCell(27);
	 * if(cells24!=null){djht=changegeshi(cells24,isE2007);}
	 * regBaseZdjbxxdr1.setDjh(djht);
	 * 
	 * Cell cells25=row.getCell(28);
	 * if(cells25!=null)daht=changegeshi(cells25,isE2007);
	 * regBaseZdjbxxdr1.setDah(daht);
	 * 
	 * Cell cells26=row.getCell(29);
	 * if(cells26!=null)bzt=changegeshi(cells26,isE2007);
	 * regBaseZdjbxxdr1.setBz(bzt);
	 * 
	 * Cell cells27=row.getCell(30);
	 * if(cells27!=null){chryt=changegeshi(cells27,isE2007);}
	 * regBaseZdjbxxdr1.setChrymc(chryt);
	 * 
	 * Cell cells28=row.getCell(31); if(cells28!=null) {
	 * chsjt=changegeshi(cells28,isE2007); SimpleDateFormat format = new
	 * SimpleDateFormat("yyyy-MM-dd"); Date date = null; try { date =
	 * format.parse(chsjt); regBaseZdjbxxdr1.setChsj(date); } catch (Exception
	 * ex) { System.out.println("发生异常的原因为 :"+ex.getMessage());
	 * ex.printStackTrace(); } }
	 * 
	 * Cell cells29=row.getCell(32);
	 * if(cells29!=null)ztt=changegeshi(cells29,isE2007);
	 * ztt=DictUtils.getDictValue(ztt, "reg_bus_bdcdyzt", "");
	 * regBaseZdjbxxdr1.setZt(ztt); regBaseZdjbxxdr1.setIsaudit("0");
	 * TempregBaseZdjbxxdr.add(regBaseZdjbxxdr1);
	 * 
	 * } else { //用户权限分配 User user = UserUtils.getUser(); Office office =
	 * officeService.get(user.getCurrentUser().getOffice().getId());
	 * if("S00001001007".equals(office.getCode())){ model.addAttribute("SH",
	 * office.getCode()); }else{ model.addAttribute("SH", office.getCode()); }
	 * if(StringUtils.isNotBlank(request.getParameter("optype"))){
	 * model.addAttribute("optype","1"); }
	 * if(StringUtils.isNotBlank(request.getParameter("WO"))){
	 * model.addAttribute("WO","1"); }
	 * if(StringUtils.isNotBlank(request.getParameter("scbj"))){
	 * model.addAttribute("scbj","1"); }
	 * if(StringUtils.isNotBlank(request.getParameter("ids"))){
	 * regBaseZdjbxxdr.setId(request.getParameter("ids")); }
	 * if(StringUtils.isNotBlank(request.getParameter("dyh"))){
	 * regBaseZdjbxxdr.setBdcdyh(request.getParameter("dyh")); } //TODO 1.
	 * 检查为什么isAudit是null //TODO 2. 判断页面显示是否需要考虑null的情况 Page<RegBaseZdjbxxdr>
	 * page = regBaseZdjbxxdrService.findPage(new Page<RegBaseZdjbxxdr>(request,
	 * response), regBaseZdjbxxdr); model.addAttribute("page", page);
	 * if(TempregBaseZdjbxxdr.size()>0) { for(int
	 * i=0;i<TempregBaseZdjbxxdr.size();i++){
	 * regBaseZdjbxxdrService.save(TempregBaseZdjbxxdr.get(i));
	 * 
	 * }} //model.addAttribute("TempregBaseZdjbxxdr", TempregBaseZdjbxxdr);
	 * //model.addAttribute("TempregBaseZdjbxxdr",
	 * JsonMapper.toJsonString(TempregBaseZdjbxxdr)); //model.addAttribute("dr",
	 * "jbxxdr"); // return "modules/reg/bus/regBaseZdjbxxdrList"; return
	 * "redirect:"+Global.getAdminPath()+"/reg/bus/regBaseZdjbxxdr/list"; } }
	 * catch(Exception e) { e.printStackTrace(); } } }
	 * if(TempregBaseZdjbxxdr.size()>0) { for(int
	 * i=0;i<TempregBaseZdjbxxdr.size();i++){
	 * regBaseZdjbxxdrService.save(TempregBaseZdjbxxdr.get(i)); }
	 * TempregBaseZdjbxxdr=new ArrayList<RegBaseZdjbxxdr>(); } //用户权限分配 User
	 * user = UserUtils.getUser(); Office office =
	 * officeService.get(user.getCurrentUser().getOffice().getId());
	 * if("S00001001007".equals(office.getCode())){ model.addAttribute("SH",
	 * office.getCode()); }else{ model.addAttribute("SH", office.getCode()); }
	 * if(StringUtils.isNotBlank(request.getParameter("optype"))){
	 * model.addAttribute("optype","1"); }
	 * if(StringUtils.isNotBlank(request.getParameter("WO"))){
	 * model.addAttribute("WO","1"); }
	 * if(StringUtils.isNotBlank(request.getParameter("scbj"))){
	 * model.addAttribute("scbj","1"); }
	 * if(StringUtils.isNotBlank(request.getParameter("ids"))){
	 * regBaseZdjbxxdr.setId(request.getParameter("ids")); }
	 * if(StringUtils.isNotBlank(request.getParameter("dyh"))){
	 * regBaseZdjbxxdr.setBdcdyh(request.getParameter("dyh")); } //TODO 1.
	 * 检查为什么isAudit是null //TODO 2. 判断页面显示是否需要考虑null的情况 Page<RegBaseZdjbxxdr>
	 * page = regBaseZdjbxxdrService.findPage(new Page<RegBaseZdjbxxdr>(request,
	 * response), regBaseZdjbxxdr); model.addAttribute("page", page); //
	 * model.addAttribute("TempregBaseZdjbxxdr", TempregBaseZdjbxxdr);
	 * //model.addAttribute("TempregBaseZdjbxxdr",
	 * JsonMapper.toJsonString(TempregBaseZdjbxxdr)); //
	 * model.addAttribute("dr", "jbxxdr"); // return
	 * "modules/reg/bus/regBaseZdjbxxdrList"; return
	 * "redirect:"+Global.getAdminPath()+"/reg/bus/regBaseZdjbxxdr/list"; }
	 * 
	 * catch (Exception e) { addMessage(redirectAttributes,
	 * "导入数据失败!失败信息:"+e.getMessage()); } return
	 * "redirect:"+Global.getAdminPath()+"/reg/bus/regBaseZdjbxxdr/list"; } else
	 * { addMessage(redirectAttributes, "导入失败,请先选择文件"); return
	 * "redirect:"+Global.getAdminPath()+"/reg/bus/regBaseZdjbxxdr/list"; } }
	 */
	@RequiresPermissions("reg:bus:regBaseZdjbxxdr:edit")
	@RequestMapping(value = "getHKVInfoindex")
	@ResponseBody
	public ModelMap getHKVInfoindex(HttpServletRequest request) {
		ModelMap modelMap = new ModelMap();
		modelMap.put("xq", DictUtils.getDictLabels(request.getParameter("xq"), "reg_bus_xq", ""));
		return modelMap;
	}

	@RequiresPermissions("reg:bus:regBaseZdjbxxdr:edit")
	@RequestMapping(value = "commitsave")
	@ResponseBody
	public ModelMap commitsave(HttpServletRequest request) {
		ModelMap modelMap = new ModelMap();
		modelMap.put("success", 0);
		// 获取提交的本条数据的对象
		String ids = request.getParameter("ids");
		RegBaseZdjbxxdr zdxxdr = regBaseZdjbxxdrService.get(ids);
		zdxxdr.setIsaudit("1");
		zdxxdr.setDjxl("204");
		zdxxdr.setZt("1");
		zdxxdr.setQllx("5");
		zdxxdr.setSfczr("1");
		zdxxdr.setQxdm(Global.getAreaCode());
		if (StringUtils.isNotBlank(request.getParameter("djq"))) {
			zdxxdr.setSeachcity(request.getParameter("djq"));
			zdxxdr.setSeachprov(request.getParameter("djq").substring(0, 6));
		}
		if (StringUtils.isNotBlank(request.getParameter("djzq"))) {
			zdxxdr.setSeachdistrict(request.getParameter("djzq"));
			zdxxdr.setZddm(zdxxdr.getSeachdistrict() + request.getParameter("tdsyqdm") + request.getParameter("zdtzm"));
			zdxxdr.setBdcdyh(
					request.getParameter("djzq") + request.getParameter("tdsyqdm") + request.getParameter("zdtzm"));
		}
		String msg = "";
		// 验证from页面字段
		if ("0".equals(modelMap.get("success").toString())) {
			if (StringUtils.isBlank(zdxxdr.getZddm()) || StringUtils.isBlank(zdxxdr.getBdcdyh())) {
				modelMap.put("success", "1");
				msg = "宗地代码或不动产单元号不能为空!";
			}
		}
		if ("0".equals(modelMap.get("success").toString())) {
			if (!"101".equals(zdxxdr.getQlxz()) && !"206".equals(zdxxdr.getQlxz()) && !"203".equals(zdxxdr.getQlxz())) {
				if (zdxxdr.getSyqqssj() == null) {
					modelMap.put("success", "1");
					msg = "使用权起始时间不能为空!";
				}
				if (zdxxdr.getSyqjssj() == null) {
					modelMap.put("success", "1");
					msg = "使用权结束时间不能为空!";
				}
			}
		}
		if ("0".equals(modelMap.get("success").toString())) {
			if (StringUtils.isBlank(zdxxdr.getTdsyqdm())) {
				modelMap.put("success", "1");
				msg = "土地所有权代码不能为空!";
			}
		}
		if ("0".equals(modelMap.get("success").toString())) {
			if (StringUtils.isBlank(zdxxdr.getZdmj())) {
				modelMap.put("success", "1");
				msg = "宗地面积不能为空,请确认!!!";
			}
		}
		if ("0".equals(modelMap.get("success").toString())) {
			if (zdxxdr.getZl().indexOf("X") > 0) {
				modelMap.put("success", "1");
				msg = "坐落中包含非法字符X,请确认!!!";
			}
		}
		if ("0".equals(modelMap.get("success").toString())) {
			String zdtzm = zdxxdr.getZdtzm();
			String tdsyqdm = zdxxdr.getTdsyqdm();
			if ("A".equals(zdtzm) || "C".equals(zdtzm)) {
				if ("G".equals(tdsyqdm) || "Z".equals(tdsyqdm)) {
					modelMap.put("success", "1");
					msg = "土地所有权代码与宗地特征码不匹配,不能保存!";
				}
			} else if ("B".equals(zdtzm) || "D".equals(zdtzm) || "E".equals(zdtzm) || "F".equals(zdtzm)
					|| "S".equals(zdtzm) || "X".equals(zdtzm)) {
				if ("Z".equals(tdsyqdm)) {
					modelMap.put("success", "1");
					msg = "土地所有权代码与宗地特征码不匹配,不能保存!";
				}
			} else if ("W".equals(zdtzm) || "Y".equals(zdtzm)) {
				if ("G".equals(tdsyqdm) || "J".equals(tdsyqdm)) {
					modelMap.put("success", "1");
					msg = "土地所有权代码与宗地特征码不匹配,不能保存!";
				}
			}
		}
		if ("0".equals(modelMap.get("success").toString())) {
			String zddm = zdxxdr.getZddm().substring(0, 14);
			String bdcdyh = zdxxdr.getBdcdyh().substring(0, 14);
			if (!zddm.equals(bdcdyh)) {
				modelMap.put("success", "1");
				msg = "宗地代码与不动产单元号前14位不一致";
			}
		}
		if ("0".equals(modelMap.get("success").toString())) {
			// 验证权利人信息
			// 查询当前权利人
			RegBusHisHouseQlr qlr = new RegBusHisHouseQlr();
			qlr.setYwh(zdxxdr.getYwh());
			List<RegBusHisHouseQlr> qlrlist = regBusHisHouseQlrService.findList(qlr);
			if (qlrlist.size() > 0) {
				for (int i = 0; i < qlrlist.size(); i++) {
					qlr = qlrlist.get(i);
					msg = IDCardValidate(qlr.getZjh(), qlr.getZjzl());
					if (!"YES".equals(msg)) {
						modelMap.put("success", "1");
						break;
					}
				}
			}
		}
		modelMap.put("msg", msg);
		if ("0".equals(modelMap.get("success").toString())) {
			regBaseZdjbxxdrService.save(zdxxdr);
			modelMap.put("regBaseZdjbxxdr", zdxxdr);
		}
		return modelMap;
	}

	/**
	 * 验证身份证
	 * 
	 * @param IDStr
	 * @return "YES" 代表合法的身份证 ,其他值代表错误信息
	 * @throws ParseException
	 */
	public static String IDCardValidate(String IDStr, String zjzl) {
		String tipInfo = "YES";// 记录错误信息
		String Ai = "";
		// 身份证号
		if ("1".equals(zjzl)) {
			if (null == IDStr || IDStr.trim().isEmpty())
				return "身份证号码长度应该为15位或18位。";

			// 判断号码的长度 15位或18位
			if (IDStr.length() != 15 && IDStr.length() != 18) {
				tipInfo = "身份证号码长度应该为15位或18位。";
				return tipInfo;
			}
			// 18位身份证前17位位数字,如果是15位的身份证则所有号码都为数字
			if (IDStr.length() == 18) {
				Ai = IDStr.substring(0, 17);
			} else if (IDStr.length() == 15) {
				Ai = IDStr.substring(0, 6) + "19" + IDStr.substring(6, 15);
			}
			if (isNumeric(Ai) == false) {
				tipInfo = "身份证15位号码都应为数字 ; 18位号码除最后一位外,都应为数字。";
				return tipInfo;
			}
			// // 判断出生年月是否有效
			// String strYear = Ai.substring(6, 10);// 年份
			// String strMonth = Ai.substring(10, 12);// 月份
			// String strDay = Ai.substring(12, 14);// 日期
			// if (isDate(strYear + "-" + strMonth + "-" + strDay) == false) {
			// tipInfo = "身份证出生日期无效。";
			// return tipInfo;
			// }
			// GregorianCalendar gc = new GregorianCalendar();
			// SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd");
			// try {
			// if ((gc.get(Calendar.YEAR) - Integer.parseInt(strYear)) > 150
			// || (gc.getTime().getTime() - s.parse(strYear + "-" + strMonth +
			// "-" + strDay).getTime()) < 0) {
			// tipInfo = "身份证生日不在有效范围。";
			// return tipInfo;
			// }
			// } catch (NumberFormatException e) {
			// e.printStackTrace();
			// } catch (java.text.ParseException e) {
			// e.printStackTrace();
			// }
			// if (Integer.parseInt(strMonth) > 12 || Integer.parseInt(strMonth)
			// == 0) {
			// tipInfo = "身份证月份无效";
			// return tipInfo;
			// }
			// if (Integer.parseInt(strDay) > 31 || Integer.parseInt(strDay) ==
			// 0) {
			// tipInfo = "身份证日期无效";
			// return tipInfo;
			// }
			// // 判断地区码是否有效
			// Hashtable areacode = GetAreaCode();
			// // 如果身份证前两位的地区码不在Hashtable,则地区码有误
			// if (areacode.get(Ai.substring(0, 2)) == null) {
			// tipInfo = "身份证地区编码错误。";
			// return tipInfo;
			// }
			// if (isVarifyCode(Ai, IDStr) == false) {
			// tipInfo = "身份证校验码无效,不是合法的身份证号码";
			// return tipInfo;
			// }
		}
		// 组织机构代码
		if ("6".equals(zjzl)) {
			if (iszzjgdm(IDStr) == false) {
				tipInfo = " 组织机构代码输入不合法!";
				return tipInfo;
			}
		}
		// 营业执照
		if ("7".equals(zjzl)) {
			if (isyyzz(IDStr) == false) {
				tipInfo = "营业执照输入不合法!";
				return tipInfo;
			}
		}
		if (!"7".equals(zjzl) && !"6".equals(zjzl) && !"1".equals(zjzl)) {
			if (isqtzjlx(IDStr) == false) {
				tipInfo = "【其他】证件类型只能以数字开头!";
				return tipInfo;
			}
		}
		return tipInfo;
	}

	/*
	 * 判断第18位校验码是否正确 第18位校验码的计算方式: 1. 对前17位数字本体码加权求和 公式为:S = Sum(Ai * Wi), i =
	 * 0, ... , 16 其中Ai表示第i个位置上的身份证号码数字值,Wi表示第i位置上的加权因子,其各位对应的值依次为: 7 9 10 5 8 4
	 * 2 1 6 3 7 9 10 5 8 4 2 2. 用11对计算结果取模 Y = mod(S, 11) 3. 根据模的值得到对应的校验码
	 * 对应关系为: Y值: 0 1 2 3 4 5 6 7 8 9 10 校验码: 1 0 X 9 8 7 6 5 4 3 2
	 */
	private static boolean isVarifyCode(String Ai, String IDStr) {
		String[] VarifyCode = { "1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2" };
		String[] Wi = { "7", "9", "10", "5", "8", "4", "2", "1", "6", "3", "7", "9", "10", "5", "8", "4", "2" };
		int sum = 0;
		for (int i = 0; i < 17; i++) {
			sum = sum + Integer.parseInt(String.valueOf(Ai.charAt(i))) * Integer.parseInt(Wi[i]);
		}
		int modValue = sum % 11;
		String strVerifyCode = VarifyCode[modValue];
		Ai = Ai + strVerifyCode;
		if (IDStr.length() == 18) {
			if (Ai.equals(IDStr) == false) {
				return false;
			}
		}
		return true;
	}

	/**
	 * 将所有地址编码保存在一个Hashtable中
	 * 
	 * @return Hashtable 对象
	 */
	private static Hashtable GetAreaCode() {
		Hashtable hashtable = new Hashtable();
		hashtable.put("11", "北京");
		hashtable.put("12", "天津");
		hashtable.put("13", "河北");
		hashtable.put("14", "山西");
		hashtable.put("15", "内蒙古");
		hashtable.put("21", "辽宁");
		hashtable.put("22", "吉林");
		hashtable.put("23", "黑龙江");
		hashtable.put("31", "上海");
		hashtable.put("32", "江苏");
		hashtable.put("33", "浙江");
		hashtable.put("34", "安徽");
		hashtable.put("35", "福建");
		hashtable.put("36", "江西");
		hashtable.put("37", "山东");
		hashtable.put("41", "河南");
		hashtable.put("42", "湖北");
		hashtable.put("43", "湖南");
		hashtable.put("44", "广东");
		hashtable.put("45", "广西");
		hashtable.put("46", "海南");
		hashtable.put("50", "重庆");
		hashtable.put("51", "四川");
		hashtable.put("52", "贵州");
		hashtable.put("53", "云南");
		hashtable.put("54", "西藏");
		hashtable.put("61", "陕西");
		hashtable.put("62", "甘肃");
		hashtable.put("63", "青海");
		hashtable.put("64", "宁夏");
		hashtable.put("65", "新疆");
		hashtable.put("71", "台湾");
		hashtable.put("81", "香港");
		hashtable.put("82", "澳门");
		hashtable.put("91", "国外");
		return hashtable;
	}

	/**
	 * 判断字符串是否为数字,0-9重复0次或者多次
	 * 
	 * @param strnum
	 * @return
	 */
	private static boolean isNumeric(String strnum) {
		Pattern pattern = Pattern.compile("[0-9]*");
		Matcher isNum = pattern.matcher(strnum);
		if (isNum.matches()) {
			return true;
		} else {
			return false;
		}
	}

	/**
	 * 功能:判断字符串出生日期是否符合正则表达式:包括年月日,闰年、平年和每月31天、30天和闰月的28天或者29天
	 * 
	 * @param string
	 * @return
	 */
	public static boolean isDate(String strDate) {
		Pattern pattern = Pattern.compile(
				"^((\\d{2}(([02468][048])|([13579][26]))[\\-\\/\\s]?((((0?[13578])|(1[02]))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])))))|(\\d{2}(([02468][1235679])|([13579][01345789]))[\\-\\/\\s]?((((0?[13578])|(1[02]))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/\\s]?((0?[1-9])|(1[0-9])|(2[0-8]))))))?$");
		Matcher m = pattern.matcher(strDate);
		if (m.matches()) {
			return true;
		} else {
			return false;
		}
	}

	/**
	 * 功能:判断组织机构代码的合法性
	 * 
	 * @param string
	 * @return
	 */
	public static boolean iszzjgdm(String IDStr) {
		Pattern pattern = Pattern.compile("^[a-zA-Z\\d]{8}\\-[a-zA-Z\\d]$");
		Matcher m = pattern.matcher(IDStr);
		if (m.matches()) {
			return true;
		} else {
			return false;
		}
	}

	/**
	 * 功能:判断营业执照的合法性
	 * 
	 * @param string
	 * @return
	 */
	public static boolean isyyzz(String IDStr) {
		Pattern pattern = Pattern.compile("^\\d{15}$|^[0-9a-zA-Z]{18}$");
		Matcher m = pattern.matcher(IDStr);
		if (m.matches()) {
			return true;
		} else {
			return false;
		}
	}

	/**
	 * 功能:判断其它证件类型的合法性
	 * 
	 * @param string
	 * @return
	 */
	public static boolean isqtzjlx(String IDStr) {
		Pattern pattern = Pattern.compile("^[0-9].*$");
		Matcher m = pattern.matcher(IDStr);
		if (m.matches()) {
			return true;
		} else {
			return false;
		}
	}

	/***
	 * @Title: 人员信息已引用的状态下需要反审核,查需是否能够反审核 @param @param request @param @return
	 * 设定文件 @return ModelMap 返回类型 @throws
	 */
	@RequiresPermissions("reg:base:regBasePerson:edit")
	@RequestMapping(value = "queryinfo")
	@ResponseBody
	public String queryinfo(String ids) {
		RegBasePerson regBasePerson = regBasePersonService.get(ids);
		String info = "0";
		int bz = 0;
		int sum = 0;// 记录引用次数
		// 开始各个表查询是否有多个地方引用此人信息,超过1个则提示不能反审核
	
		// 查询宗地基本信息
		if (bz == 0) {
			RegBaseZdjbxx zdjbxx = new RegBaseZdjbxx();
			zdjbxx.setSfzh(regBasePerson.getZjh());
			zdjbxx.setZjlx(regBasePerson.getZjzl());
			zdjbxx.setIslogout("13");
			List<RegBaseZdjbxx> zdjbxxlist = regBaseZdjbxxService.findList(zdjbxx);
			if (zdjbxxlist.size() > 1) {
				bz = 1;
			}
			if (zdjbxxlist.size() == 1) {
				sum = sum + 1;
			}
		}
		// 查询项目基本信息
		if (bz == 0) {
			RegBaseXm xmxx = new RegBaseXm();
			xmxx.setZjh(regBasePerson.getZjh());
			xmxx.setZjzl(regBasePerson.getZjzl());
			List<RegBaseXm> xmxxlist = regBaseXmService.findList(xmxx);
			if (xmxxlist.size() > 1) {
				bz = 1;
			}
			if (xmxxlist.size() == 1) {
				sum = sum + 1;
			}
		}
		// 查询权利人基本信息
		if (bz == 0) {
			String ywh = "";
			RegBusQlr qlrxx = new RegBusQlr();
			qlrxx.setZjh(regBasePerson.getZjh());
			qlrxx.setZjzl(regBasePerson.getZjzl());
			List<RegBusQlr> qlrxxlist = regBusQlrService.findList(qlrxx);
			int count = qlrxxlist.size();
			if (qlrxxlist.size() > 1) {
				for (int i = 0; i < count; i++) {
					qlrxx = qlrxxlist.get(i);
					if ("".equals(ywh)) {
						ywh = qlrxx.getYwh();
					} else {
						if (ywh.equals(qlrxx.getYwh())) {
							ywh = qlrxx.getYwh();
							bz = 0;
						} else {
							bz = 1;
							break;
						}
					}
				}
			}
			if (qlrxxlist.size() == 1) {
				sum = sum + 1;
				bz = 1;
			}
		}
		// 查询义务人基本信息
		if (bz == 0) {
			String ywh = "";
			RegBusYwr ywrxx = new RegBusYwr();
			ywrxx.setZjh(regBasePerson.getZjh());
			ywrxx.setZjzl(regBasePerson.getZjzl());
			List<RegBusYwr> ywrxxlist = regBusYwrService.findList(ywrxx);
			int count = ywrxxlist.size();
			if (ywrxxlist.size() > 1) {
				for (int i = 0; i < count; i++) {
					ywrxx = ywrxxlist.get(i);
					if ("".equals(ywh)) {
						ywh = ywrxx.getYwh();
					} else {
						if (ywh.equals(ywrxx.getYwh())) {
							ywh = ywrxx.getYwh();
							bz = 0;
						} else {
							bz = 1;
							break;
						}
					}
				}
			}
			if (ywrxxlist.size() == 1) {
				sum = sum + 1;
				bz = 1;
			}
		}
		// 查询历史权利人基本信息
		if (bz == 0) {
			String ywh = "";
			RegBusHisHouseQlr qlrhishousexx = new RegBusHisHouseQlr();
			qlrhishousexx.setZjh(regBasePerson.getZjh());
			qlrhishousexx.setZjzl(regBasePerson.getZjzl());
			List<RegBusHisHouseQlr> qlrhisxxlist = regBusHisHouseQlrService.findList(qlrhishousexx);
			int count = qlrhisxxlist.size();
			if (qlrhisxxlist.size() > 1) {
				for (int i = 0; i < count; i++) {
					qlrhishousexx = qlrhisxxlist.get(i);
					if ("".equals(ywh)) {
						ywh = qlrhishousexx.getYwh();
					} else {
						if (ywh.equals(qlrhishousexx.getYwh())) {
							ywh = qlrhishousexx.getYwh();
							bz = 0;
						} else {
							bz = 1;
							break;
						}
					}
				}
			}
			if (qlrhisxxlist.size() == 1) {
				sum = sum + 1;
				bz = 1;
			}
		}
		// 查询历史义务人基本信息
		if (bz == 0) {
			String ywh = "";
			RegBusHisHouseYwr ywrhishousexx = new RegBusHisHouseYwr();
			ywrhishousexx.setZjh(regBasePerson.getZjh());
			ywrhishousexx.setZjzl(regBasePerson.getZjzl());
			List<RegBusHisHouseYwr> ywrhisxxlist = regBusHisHouseYwrService.findList(ywrhishousexx);
			int count = ywrhisxxlist.size();
			if (ywrhisxxlist.size() > 1) {
				for (int i = 0; i < count; i++) {
					ywrhishousexx = ywrhisxxlist.get(i);
					if ("".equals(ywh)) {
						ywh = ywrhishousexx.getYwh();
					} else {
						if (ywh.equals(ywrhishousexx.getYwh())) {
							ywh = ywrhishousexx.getYwh();
							bz = 0;
						} else {
							bz = 1;
							break;
						}
					}
				}
			}
			if (ywrhisxxlist.size() == 1) {
				sum = sum + 1;
				bz = 1;
			}
		}
		if (bz == 1 || sum > 1) {
			info = "1";
		}
		if (bz == 0) {
			info = "0";
		}
		return info;
	}
}