dc5f5072a3054fb61606e83a03ea1ae053287a8b.svn-base 40.5 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 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
/**
 * Copyright © 2015-2018 ODM All rights reserved.
 */
package com.thinkgem.jeesite.modules.reg.web.base;

import java.beans.PropertyDescriptor;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList;
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.commons.beanutils.PropertyUtilsBean;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import com.thinkgem.jeesite.common.config.Global;
import com.thinkgem.jeesite.common.mapper.JsonMapper;
import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.utils.StringUtils;
import com.thinkgem.jeesite.common.web.BaseController;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBaseC;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBaseH;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBaseXm;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBaseZrz;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusBdcqzsdjxx;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusBdcqzsdjxxRelationFwBdcdyh;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusRights;
import com.thinkgem.jeesite.modules.reg.service.base.RegBaseCService;
import com.thinkgem.jeesite.modules.reg.service.base.RegBaseHService;
import com.thinkgem.jeesite.modules.reg.service.base.RegBaseXmService;
import com.thinkgem.jeesite.modules.reg.service.base.RegBaseZrzService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusBdcqzsdjxxService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusRightsService;
import com.thinkgem.jeesite.modules.reg.utils.RegUtils;
import com.thinkgem.jeesite.modules.sys.entity.User;

/**
 * 层信息维护Controller
 * @author xuyg 
 * @version 2015-10-28
 */ 
@Controller
@RequestMapping(value = "${adminPath}/reg/base/regBaseC")
public class RegBaseCController extends BaseController {

	@Autowired
	private RegBaseHService regBaseHService;
	@Autowired
	private RegBaseCService regBaseCService;
	@Autowired
	private RegBaseZrzService regBaseZrzService;
	@Autowired
	private RegBaseXmService regBaseXmService;
	@Autowired
	private RegBusBdcqzsdjxxService regBusBdcqzsdjxxService;
	@Autowired
	private RegBusRightsService regBusRightsService;
	
	@ModelAttribute
	public RegBaseC get(@RequestParam(required=false) String id) {
		RegBaseC entity = null;
		if (StringUtils.isNotBlank(id)){
			entity = regBaseCService.get(id);
		}
		if (entity == null){
			entity = new RegBaseC();
		}
		return entity;
	}
	
	@RequiresPermissions("reg:base:regBaseC:view")
	@RequestMapping(value = {"list", ""})
	public String list(RegBaseC regBaseC, HttpServletRequest request, HttpServletResponse response, Model model) {
		RegBaseZrz regBaseZrz = null;
		String zrzid = request.getParameter("ZID");
		String dz = request.getParameter("DZ");
		String ljzh = request.getParameter("ljzh");
		String zrzh = request.getParameter("zrzh");
		RegBaseC regBaseCT = new RegBaseC();
		model.addAttribute("DZ", dz);
		if(StringUtils.isNotBlank(zrzid)){
			model.addAttribute("ZID", zrzid);
			regBaseC.setZid(zrzid);
			regBaseZrz = regBaseZrzService.get(zrzid);
			model.addAttribute("ZH", regBaseZrz.getZrzh());
			model.addAttribute("JZWMC", regBaseZrz.getGzwmc());
		}
		if(StringUtils.isBlank(zrzid) && StringUtils.isNotBlank(zrzh)) {
			regBaseZrz = regBaseZrzService.getByZrzh(zrzh);
			regBaseCT.setZrzh(zrzh);
			if(regBaseZrz != null) {
			
			model.addAttribute("JZWMC", regBaseZrz.getGzwmc());
			}
		}
		if(StringUtils.isNotBlank(ljzh)) {
			regBaseC.setLjzh(ljzh);
			regBaseCT.setLjzh(ljzh);
		}
		if(StringUtils.isNotBlank(request.getParameter("XMID"))){
			model.addAttribute("XMID", request.getParameter("XMID"));
		}else{
			model.addAttribute("XMID", regBaseZrz.getXmid());
		}
		String xmmc = request.getParameter("XMMC");
		if(StringUtils.isBlank(xmmc)){
			model.addAttribute("XMID", regBaseZrz.getXmid());
			model.addAttribute("XMMC", regBaseZrz.getXmmc());
		}else{
			model.addAttribute("XMMC", xmmc);
		}
		
		
		regBaseCT.setZid(zrzid);
		
		List<RegBaseC> zcList = regBaseCService.findList(regBaseCT);
		int zccount = zcList.size();

		Page<RegBaseC> page = regBaseCService.findPage(new Page<RegBaseC>(request, response), regBaseC); 
		model.addAttribute("page", page);
		model.addAttribute("cCount", zccount);
		return "modules/reg/base/regBaseCList";
	}
	
	/***
	* @Title: listView 
	* @Description: 用来返回一幢楼的所有层信息 
	* @param @param regBaseC
	* @param @param request
	* @param @param response
	* @param @param model
	* @param @return    设定文件 
	* @return String    返回类型 
	* @throws
	 */
	@RequiresPermissions("reg:base:regBaseC:view")
	@RequestMapping(value = "listView")
	public String listView(RegBaseC regBaseC, HttpServletRequest request, HttpServletResponse response, Model model) {
		RegBaseZrz regBaseZrz = null;
		if(StringUtils.isNotBlank(request.getParameter("ZID"))){
			model.addAttribute("ZID", request.getParameter("ZID"));
			model.addAttribute("XMMC", request.getParameter("XMMC"));
			regBaseC.setZid(request.getParameter("ZID"));
			regBaseZrz = regBaseZrzService.get(request.getParameter("ZID"));
			model.addAttribute("ZH", regBaseZrz.getZrzh());
		}
		Page<RegBaseC> page = regBaseCService.findPage(new Page<RegBaseC>(request, response), regBaseC); 
		model.addAttribute("page", page);
		model.addAttribute("cCount", page.getList().size());
		return "modules/reg/base/regBaseCListView";
	}
	
	/***
	* @Title: listChoicedPreFwInfo 
	* @Description: 选择房屋后预不动产单元号显示页面
	* @param @param request
	* @param @param response
	* @param @param model
	* @param @return    设定文件 
	* @return String    返回类型 
	* @throws
	 */
	@RequiresPermissions("reg:base:regBaseC:view")
	@RequestMapping(value = "listChoicedPreFwInfo")
	public String listChoicedPreFwInfo(HttpServletRequest request, HttpServletResponse response, Model model) {
		List<String> fwxxlist = new ArrayList<String>();
		String selectedids = request.getParameter("selectedIDs");
		String zh = request.getParameter("zh");
		String ywh = request.getParameter("ywh");
		String zid = request.getParameter("ZID");
		/*
		//获取已登记信息里的宗地代码
		RegBusBdcqzsdjxx regBusBdcqzsdjxx = new RegBusBdcqzsdjxx();
		if(StringUtils.isNotBlank(ywh)){
			regBusBdcqzsdjxx.setYwh(ywh);
			List<RegBusBdcqzsdjxx> findList = regBusBdcqzsdjxxService.findList(regBusBdcqzsdjxx);
			if(findList.size()>0){
				regBusBdcqzsdjxx = findList.get(0);
			}
		}
		//把幢的ID存到登记信息里的 OLDID中;因为首次登记的话OLDID是空的,
		//做预告转移时需要选择楼盘信息表,然后需要ZID,所以这个时候把ZID存进OLDID字段中
		regBusBdcqzsdjxx.setOldid(zid);
		regBusBdcqzsdjxxService.save(regBusBdcqzsdjxx);
		*/
		//幢号字符串 -> 幢的不动产单元号
		//String zhStr = regBusBdcqzsdjxx.getZddm() + "F" + RegUtils.getZHhStrNum(zh);
		if(StringUtils.isNotBlank(selectedids)){
			String[] arrids = selectedids.split(";");
			for(int i=0; i<arrids.length; i++){
				//根据房屋ID获取房屋的房号
				RegBaseH regBaseH = regBaseHService.get(arrids[i]);
				//fwxxlist.add(zhStr + RegUtils.getZHhStrNum(regBaseH.getHh()+""));
				fwxxlist.add(regBaseH.getBdcdyh());
			}
			model.addAttribute("bdcdyhofhlist", fwxxlist);
		}
		
		//幢的不动产单元号
		RegBaseZrz regBaseZrz = regBaseZrzService.get(zid);
		model.addAttribute("bdcdyhofz", regBaseZrz.getBdcdyh());
		return "modules/reg/base/regBaseChoicedPreFwInfo";
	}
	
	/***
	* @Title: listChoicedPreFwInfo 
	* @Description: 选择房屋后预不动产单元号显示页面【首次的】
	* @param @param request
	* @param @param response
	* @param @param model
	* @param @return    设定文件 
	* @return String    返回类型 
	* @throws
	 */
	//@RequiresPermissions("reg:base:regBaseC:view")
	@RequestMapping(value = "listChoicedFwInfoToSlsq")
	public String listChoicedFwInfoToSlsq(HttpServletRequest request, HttpServletResponse response, Model model) {
		String ywh = request.getParameter("ywh");
		//获取已登记信息里的宗地代码
		RegBusBdcqzsdjxx regBusBdcqzsdjxx = new RegBusBdcqzsdjxx();
		if(StringUtils.isNotBlank(ywh)){
			regBusBdcqzsdjxx.setYwh(ywh);
			List<RegBusBdcqzsdjxx> findList = regBusBdcqzsdjxxService.findList(regBusBdcqzsdjxx);
			if(findList.size()>0){
				regBusBdcqzsdjxx = findList.get(0);
			}
		}
		//获取登记信息表的子表数据
		List<RegBaseH> hList = new ArrayList<RegBaseH>();
		RegBaseH regBaseH = regBaseHService.getdy(regBusBdcqzsdjxx.getBdcdyh());
		hList.add(regBaseH);
		model.addAttribute("hList", hList);
		return "modules/reg/base/regBaseChoicedFwInfoToSlsq";
	}
	
	/***
	* @Title:  
	* @Description: 选择房屋后预不动产单元号显示页面【转移|预告转移】
	* @param @param request
	* @param @param response
	* @param @param model
	* @param @return    设定文件 
	* @return String    返回类型 
	* @throws
	 */
	@RequiresPermissions("reg:base:regBaseC:view")
	@RequestMapping(value = "oneChoicedFwInfoToSlsq")
	public String oneChoicedFwInfoToSlsq(HttpServletRequest request, HttpServletResponse response, Model model) {
		String selectedids = request.getParameter("selectedIDs"); 
		String ywhStr = request.getParameter("ywh");
		List<RegBaseH> hList = new ArrayList<RegBaseH>();
		RegBaseH regBaseH = new RegBaseH();
		//选择房屋后加载到受理页面
		if(StringUtils.isNotBlank(selectedids)){
			String[] arrids = selectedids.split(";");
			for(int i=0; i<arrids.length; i++){
				//根据房屋ID获取房屋的房号
				regBaseH = regBaseHService.get(arrids[i]);
			}
		}
		//已登记后,受理页面加载房屋信息
		if(StringUtils.isNotBlank(ywhStr)){
			RegBusBdcqzsdjxx regBusBdcqzsdjxx = new RegBusBdcqzsdjxx();
			regBusBdcqzsdjxx.setYwh(ywhStr);
			List<RegBusBdcqzsdjxx> bdcqzsList = regBusBdcqzsdjxxService.findList(regBusBdcqzsdjxx);
			if(bdcqzsList.size()>0){
				regBusBdcqzsdjxx = bdcqzsList.get(0);
			}
			//房屋信息状态改变
		    regBaseH = regBaseHService.getdy(regBusBdcqzsdjxx.getBdcdyh());
		}
		hList.add(regBaseH);
		model.addAttribute("hList", hList);
		return "modules/reg/base/regBaseChoicedFwInfoToSlsq";
	}
	
	
	/***
	* @Title: zchGuideListView 
	* @Description: 楼盘信息表 
	* @param @param regBaseC
	* @param @param request
	* @param @param response
	* @param @param model
	* @param @return    设定文件 
	* @return String    返回类型 
	* @throws 
	 */
	@RequiresPermissions("reg:base:regBaseC:view")
	@RequestMapping(value = "zchGuideListView")
	public String zchGuideListView(RegBaseC regBaseC, RegBaseH regBaseH, HttpServletRequest request, HttpServletResponse response, Model model) {
		RegBaseZrz regBaseZrz = null;
		if(StringUtils.isNotBlank(request.getParameter("LJZH"))){
			
			model.addAttribute("ZID", request.getParameter("ZRZH"));
			model.addAttribute("XMMC", request.getParameter("XMMC"));
			regBaseC.setLjzh(request.getParameter("LJZH"));
			regBaseZrz = regBaseZrzService.getByZrzh(request.getParameter("ZRZH"));
			model.addAttribute("ZH", regBaseZrz.getZrzh());
			model.addAttribute("JZWMC", regBaseZrz.getGzwmc());
			//model.addAttribute("ZSCJZMJ", regBaseZrz.getScjzmj());
		}
		if(StringUtils.isNotBlank(request.getParameter("ywh"))){
			model.addAttribute("ywh", request.getParameter("ywh"));
		}
		String djlx = "";
		if(StringUtils.isNotBlank(request.getParameter("djlx"))){
			djlx = request.getParameter("djlx");
			model.addAttribute("DJLX", djlx);
		}
		String tz = request.getParameter("tz");
		if(StringUtils.isNotBlank(tz)){
			model.addAttribute("tz", tz);
		}
		//构建自己的层户列表数据结构
		//获取幢包含的层列表
		regBaseC.setLjzh(request.getParameter("LJZH"));
		List<RegBaseC> regBaseCList = regBaseCService.findList(regBaseC);
		model.addAttribute("regBaseCList", regBaseCList);
		model.addAttribute("cCount", regBaseCList.size());
		//获取层包含的户列表
		List<RegBaseH> regBaseHList = new ArrayList<RegBaseH>();
		List<RegBaseH> regBaseAllHList = new ArrayList<RegBaseH>();
		//幢包含所有的户数
		int hCount = 0;
		int tmpMaxCount = 0;
		Double zchmjs = 0.0;
		RegBusRights regBusRights = new RegBusRights();
		for(int i=0; i<regBaseCList.size(); i++){
			//设置获取户列表的层ID
			regBaseH.setCid(regBaseCList.get(i).getId());
			regBaseHList = regBaseHService.findList(regBaseH);
			//添加页面户需要的model
			//计算幢包含的所有户数
			hCount += regBaseHList.size();
			//获取最大的层中户数算法
			int maxNumbers = getMaxColNumber(regBaseHList);
			if(tmpMaxCount < maxNumbers){
				tmpMaxCount = maxNumbers;
			}
			//计算本层所有户的实测面积
			Double chmjs = 0.0;
			if(djlx.equals("441")){//房屋物理灭失
				for(int a = 0; a < regBaseHList.size(); a ++){
					RegBaseH regBaseHT = regBaseHList.get(a);
					chmjs += regBaseHT.getScjzmj();
					if(regBaseHT.getIschafeng().equals("0") && regBaseHT.getIsyiyi().equals("0") 
							&& regBaseHT.getIsdiya().equals("0")){
						regBusRights.setBdcdyh(regBaseHT.getBdcdyh());
						List<RegBusRights> findListRights = regBusRightsService.findList(regBusRights);
						if(findListRights.size() > 0){
							regBusRights = findListRights.get(0);
							if(regBusRights.getXtxq() == null && regBusRights.getStxq() == null){
								regBaseHT.setStatus("yesMs");
							}else{
								regBaseHT.setStatus("noMs");
							}
						}else{//未登记数据,可灭失
							regBaseHT.setStatus("yesMs");
						}
					}else{
						regBaseHT.setStatus("noMs");
					}
				}
			}else{
				for(int a=0; a<regBaseHList.size(); a++){
					RegBaseH regBaseHT = regBaseHList.get(a);
					chmjs += regBaseHT.getScjzmj();
				}
			}
			regBaseAllHList.addAll(regBaseHList);
			RegBaseC regBaseCT = new RegBaseC();
			regBaseCT = regBaseCList.get(i);
			regBaseCT.setChjzmj(chmjs);
			zchmjs += chmjs;
		}
		BigDecimal b = new BigDecimal(zchmjs);
		model.addAttribute("ZSCJZMJ", b.setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue());
		model.addAttribute("regBaseAllHList", regBaseAllHList);
		
		//添加页面层需要的model
		/*
		//获取层包含的户列表
		List<RegBaseH> regBaseHList = null;
		//幢包含所有的户数
		int hCount = 0;
		int tmpMaxCount = 0;
		for(int i=0; i<regBaseCList.size(); i++){
			//设置获取户列表的层ID
			regBaseH.setCid(regBaseCList.get(i).getId());
			regBaseHList = regBaseHService.findList(regBaseH);
			//添加页面户需要的model
			model.addAttribute("option" + i, regBaseHList);
			//计算幢包含的所有户数
			hCount += regBaseHList.size();
			//获取最大的层中户数算法
			if(tmpMaxCount < regBaseHList.size()){
				tmpMaxCount = regBaseHList.size();
			}
		}
		*/
		model.addAttribute("hCount", hCount);
		//再构造一个表头
		List<Integer> intS = new ArrayList<Integer>();
		//表头个数 【用最大的层中户数】
		for(int i=0; i<tmpMaxCount; i++){
			intS.add(i+1);
		}
		model.addAttribute("intS", intS);
		model.addAttribute("ZID", request.getParameter("ZRZH"));
		String views="";
		if("1".equals(tz)){
			if(djlx.equals("803") || djlx.equals("806")){
				model.addAttribute("DJLX", djlx);
				views = "modules/reg/base/regBaseHouseZCHGuideListView";
			}
		}else if("3".equals(tz)){
			if(djlx.equals("207") || djlx.equals("302")){
				model.addAttribute("DJLX", djlx);
				views = "modules/reg/base/regBaseHouseZCHGuideListView";
			}
		}else{
			if(djlx.equals("207") || djlx.equals("803") || djlx.equals("213") || djlx.equals("429")){
				views = "modules/reg/base/regBaseZCHGuideListView";
			}else if(djlx.equals("905") || djlx.equals("907")){//房屋查封和预查封
				views = "modules/reg/base/regBaseFwcfZCHGuideListView";
			}else if(djlx.equals("703")){//房屋异议`
				views = "modules/reg/base/regBaseFwyyZCHGuideListView";
			}else if (djlx.equals("403") ){//房屋分割
				views = "modules/reg/bus/change/houseviews/regBaseHChangeZCHGuideListView";
			}else if (djlx.equals("1") || djlx.equals("2") || djlx.equals("3")){//房屋历史,登记类型无法传递只能为空1首次历史入口 2抵押历史入口3预告历史入口
				model.addAttribute("DJLX", djlx);
				views = "modules/reg/base/regBaseHouseZCHGuideListView";
			}else if(djlx.equals("910")){
				//楼盘查封
				views="modules/reg/base/regBaseLpcfZCHGuideListView";
			}else if(djlx.equals("912")){
				views="modules/reg/base/regBaseLpcfzxZCHGuideListView";
			}else if(djlx.equals("441")){//房屋所有权灭失
				views="modules/reg/base/regBaseHouseMsListView";
			}
			model.addAttribute("DJLX", djlx);
		}
		return views;
	}
	
	/***
	* @Title: openHouseView 
	* @Description: 楼盘信息表 
	* @param @param regBaseC
	* @param @param request
	* @param @param response
	* @param @param model
	* @param @return    设定文件 
	* @return String    返回类型 
	* @throws 
	 */
	@RequestMapping(value = "openHouseView")
	public String openHouseView(RegBaseC regBaseC, HttpServletRequest request, HttpServletResponse response, Model model) {
		RegBaseZrz regBaseZrz = null;
		String bdcdyh = request.getParameter("bdcdyh");
		String ywh = request.getParameter("ywh");
		RegBusBdcqzsdjxx regBusBdcqzsdjxx = new RegBusBdcqzsdjxx();
		List<RegBusBdcqzsdjxx> findListDjxx = new ArrayList<RegBusBdcqzsdjxx>();
		if(StringUtils.isNotBlank(ywh)){
			regBusBdcqzsdjxx.setYwh(ywh);
			regBusBdcqzsdjxx.setIslogout("13");
			findListDjxx = regBusBdcqzsdjxxService.findList(regBusBdcqzsdjxx);
		}
		if(StringUtils.isNotBlank(bdcdyh)){ 
			String regBaseZrzdyh = bdcdyh.substring(0, 24)+"0000";
			regBaseZrz = regBaseZrzService.getRegBaseZrz(regBaseZrzdyh);
			model.addAttribute("XMMC", regBaseZrz.getXmmc());
			regBaseC.setZid(regBaseZrz.getId());
			model.addAttribute("ZH", regBaseZrz.getZrzh());
			model.addAttribute("JZWMC", regBaseZrz.getGzwmc());
		}
		//构建自己的层户列表数据结构
		//获取幢包含的层列表
		//regBaseC.setZid(request.getParameter("ZID"));
		List<RegBaseC> regBaseCList = regBaseCService.findList(regBaseC);
		model.addAttribute("regBaseCList", regBaseCList);
		model.addAttribute("cCount", regBaseCList.size());
		//获取层包含的户列表
		List<RegBaseH> regBaseHList = new ArrayList<RegBaseH>();
		List<RegBaseH> regBaseAllHList = new ArrayList<RegBaseH>();
		RegBaseH regBaseH = new RegBaseH();
		//幢包含所有的户数
		//int hCount = 0;
		int tmpMaxCount = 0;
		Double zchmjs = 0.0;
		DecimalFormat df = new DecimalFormat("0.00"); 
		for(int i=0; i<regBaseCList.size(); i++){
			logger.info("ch==={}",regBaseCList.get(i).getCh());
			//设置获取户列表的层ID
			regBaseH.setCid(regBaseCList.get(i).getId());
			regBaseHList = regBaseHService.findList(regBaseH);
			//计算本层所有户的实测面积
			Double chmjs = 0.0;
			for(int a=0; a<regBaseHList.size(); a++){
				RegBaseH regBaseHT = regBaseHList.get(a);
				chmjs += regBaseHT.getScjzmj();
				if(findListDjxx.size() > 0){
					for (int j = 0; j < findListDjxx.size(); j++) {
						regBusBdcqzsdjxx = findListDjxx.get(j);
						if(regBaseHT.getBdcdyh().equals(regBusBdcqzsdjxx.getBdcdyh())){
							regBaseHT.setStatus("bj");//临时赋值为bj,表示当前业务中的房屋
							break;
						}
					}
				}
			}
			RegBaseC regBaseCT = new RegBaseC();
			regBaseCT = regBaseCList.get(i);
			regBaseCT.setChjzmj(chmjs);
			zchmjs += chmjs;
			//添加页面户需要的model
			//计算幢包含的所有户数
			//hCount += regBaseHList.size();
			//获取最大的层中户数算法
			int maxNumbers = getMaxColNumber(regBaseHList);
			if(tmpMaxCount < maxNumbers){
				tmpMaxCount = maxNumbers;
			}
			regBaseAllHList.addAll(regBaseHList);
		}
		model.addAttribute("ZSCJZMJ", df.format(zchmjs));
		model.addAttribute("regBaseAllHList", regBaseAllHList);
		int hCount = regBaseAllHList.size();
		model.addAttribute("hCount", hCount);
		//再构造一个表头
		List<Integer> intS = new ArrayList<Integer>();
		//表头个数 【用最大的层中户数】
		for(int i=0; i<tmpMaxCount; i++){
			intS.add(i+1);
		}
		model.addAttribute("intS", intS);
		if(StringUtils.isNotBlank(request.getParameter("cxfs"))){
			model.addAttribute("cxfs", request.getParameter("cxfs"));//查询统计--基础信息查询楼盘传入标记
		}
		if(StringUtils.isNotBlank(request.getParameter("DJLX"))){
			model.addAttribute("DJLX", request.getParameter("DJLX"));
		}
		model.addAttribute("ZID", regBaseZrz.getId());
		return "modules/reg/base/regBaseZCHGuideView";
	}
	
	/*** @Title: zchChoiceListView 
	* @Description: 楼盘信息表 【选择使用】
	* @param @param regBaseC
	* @param @param request
	* @param @param response
	* @param @param model
	* @param @return    设定文件 
	* @return String    返回类型 
	* @throws 
	 */
	@RequiresPermissions("reg:base:regBaseC:view")
	@RequestMapping(value = "zchChoiceListView")
	public String zchChoiceListView(RegBaseC regBaseC, RegBaseH regBaseH, HttpServletRequest request, HttpServletResponse response, Model model) {
		String zrzid = "";
		String regedId = request.getParameter("selectedID");
		RegBusBdcqzsdjxx regBusBdcqzsdjxxtmp = new RegBusBdcqzsdjxx();
		regBusBdcqzsdjxxtmp = regBusBdcqzsdjxxService.get(regedId);
		if(StringUtils.isNotBlank(regBusBdcqzsdjxxtmp.getOldid())){
			zrzid = regBusBdcqzsdjxxtmp.getOldid();
		}
		
		RegBaseZrz regBaseZrz = null;
		if(StringUtils.isNotBlank(zrzid)){
			model.addAttribute("ZID", zrzid);
			model.addAttribute("XMMC", request.getParameter("XMMC"));
			regBaseC.setZid(zrzid);
			regBaseZrz = regBaseZrzService.get(zrzid);
			model.addAttribute("ZH", regBaseZrz.getZrzh());
			model.addAttribute("JZWMC", regBaseZrz.getGzwmc());
			model.addAttribute("ZSCJZMJ", regBaseZrz.getScjzmj());
		}
		if(StringUtils.isNotBlank(request.getParameter("ywh"))){
			model.addAttribute("ywh", request.getParameter("ywh"));
		}
		//构建自己的层户列表数据结构
		//获取幢包含的层列表
		regBaseC.setZid(zrzid);
		List<RegBaseC> regBaseCList = regBaseCService.findList(regBaseC);
		//添加页面层需要的model
		model.addAttribute("regBaseCList", regBaseCList);
		model.addAttribute("cCount", regBaseCList.size());
		//获取层包含的户列表
		List<RegBaseH> regBaseHList = null;
		//幢包含所有的户数
		int hCount = 0;
		int tmpMaxCount = 0;
		for(int i=0; i<regBaseCList.size(); i++){
			//设置获取户列表的层ID
			regBaseH.setCid(regBaseCList.get(i).getId());
			regBaseHList = regBaseHService.findList(regBaseH);
			//添加页面户需要的model
			model.addAttribute("option" + i, regBaseHList);
			//计算幢包含的所有户数
			hCount += regBaseHList.size();
			//获取最大的层中户数算法
			if(tmpMaxCount < regBaseHList.size()){
				tmpMaxCount = regBaseHList.size();
			}
		}
		model.addAttribute("hCount", hCount);
		//再构造一个表头
		List<Integer> intS = new ArrayList<Integer>();
		//表头个数 【用最大的层中户数】
		for(int i=0; i<tmpMaxCount; i++){
			intS.add(i+1);
		}
		model.addAttribute("intS", intS);
		//登记类型
		model.addAttribute("DJLX", request.getParameter("djlx"));
		model.addAttribute("selectedID", request.getParameter("selectedID"));
		return "modules/reg/base/regBaseZCHChoiceListView";
	}
	
	
	/*** @Title: zchListView 
	* @Description: 楼盘信息表 【立体展示使用】
	* @param @param regBaseC
	* @param @param request
	* @param @param response
	* @param @param model
	* @param @return    设定文件 
	* @return String    返回类型 
	* @throws 
	 */
	@RequestMapping(value = "zchListView")
	public String zchListView(RegBaseC regBaseC, RegBaseH regBaseH, HttpServletRequest request, HttpServletResponse response, Model model) {
		String zid = request.getParameter("ZID");
		String CID = request.getParameter("CID");
		String hlb = request.getParameter("hlb");
		String zrzh = request.getParameter("ZRZH");
	    String ljzh = request.getParameter("LJZH");
		if(StringUtils.isNotBlank(hlb)){
			if(StringUtils.isNotBlank(CID)){
				RegBaseC c = regBaseCService.get(CID);
				zid = c.getZid();
			}else{
				zid = "";
			}
		}
		RegBaseZrz regBaseZrz = null;
		if(StringUtils.isNotBlank(zid)){
			model.addAttribute("ZID", zid);
			model.addAttribute("XMMC", request.getParameter("XMMC"));
			regBaseC.setZid(zid);
			regBaseZrz = regBaseZrzService.get(zid);
			model.addAttribute("ZH", regBaseZrz.getZrzh());
			model.addAttribute("JZWMC", regBaseZrz.getGzwmc());
			//model.addAttribute("ZSCJZMJ", regBaseZrz.getScjzmj());
		}
		
		if(StringUtils.isBlank(zid) && StringUtils.isNotBlank(zrzh)) {
			regBaseZrz = regBaseZrzService.getByZrzh(zrzh);
			regBaseC.setZrzh(zrzh);
			if(regBaseZrz != null) {
			zid = regBaseZrz.getId();
			model.addAttribute("ZID", zid);
			model.addAttribute("XMMC", request.getParameter("XMMC"));
			model.addAttribute("ZH", regBaseZrz.getZrzh());
			model.addAttribute("JZWMC", regBaseZrz.getGzwmc());
			}
		}
		if(StringUtils.isNotBlank(ljzh)) {
			regBaseC.setLjzh(ljzh);
		}
		//构建自己的层户列表数据结构
		//获取幢包含的层列表
		regBaseC.setZid(zid);
		List<RegBaseC> regBaseCList = regBaseCService.findList(regBaseC);
		
		//添加页面层需要的model
		model.addAttribute("regBaseCList", regBaseCList);
		
		model.addAttribute("cCount", regBaseCList.size());
		//获取层包含的户列表
		List<RegBaseH> regBaseHList = new ArrayList<RegBaseH>();
		List<RegBaseH> regBaseAllHList = new ArrayList<RegBaseH>();
		//幢包含所有的户数
		int hCount = 0;
		int tmpMaxCount = 0;
		Double zchmjs = 0.0;
		for(int i=0; i<regBaseCList.size(); i++){
			//设置获取户列表的层ID
			regBaseH.setCid(regBaseCList.get(i).getId());
			regBaseHList = regBaseHService.findList(regBaseH);
			//添加页面户需要的model
			//计算幢包含的所有户数
			hCount += regBaseHList.size();
			//获取最大的层中户数算法
			int maxNumbers = getMaxColNumber(regBaseHList);
			if(tmpMaxCount < maxNumbers){
				tmpMaxCount = maxNumbers;
			}
			regBaseAllHList.addAll(regBaseHList);
			//计算本层所有户的实测面积
			Double chmjs = 0.0;
			for(int a=0; a<regBaseHList.size(); a++){
				RegBaseH regBaseHT = regBaseHList.get(a);
				chmjs += regBaseHT.getScjzmj();
			}
			RegBaseC regBaseCT = new RegBaseC();
			regBaseCT = regBaseCList.get(i);
			regBaseCT.setChjzmj(chmjs);
			zchmjs += chmjs;
		}
		BigDecimal   b   =   new   BigDecimal(zchmjs);
		model.addAttribute("ZSCJZMJ", b.setScale(2,BigDecimal.ROUND_HALF_UP).doubleValue());
		model.addAttribute("regBaseAllHList", regBaseAllHList);
		model.addAttribute("hCount", hCount);
		//再构造一个表头
		List<Integer> intS = new ArrayList<Integer>();
		//表头个数 【用最大的层中户数】  这里需要改造下,
		for(int i=0; i<tmpMaxCount; i++){
			intS.add(i+1);
		}
		model.addAttribute("intS", intS);
		return "modules/reg/base/regBaseZCHListView";
	}
	
	/**
	* @Title: getMaxColNumber 
	* @Description: 获取户信息列表里xy中的y的最大值
	* @param @param regBaseHList
	* @param @return    设定文件 
	* @return int    返回类型 
	* @throws
	 */
	public int getMaxColNumber(List<RegBaseH> regBaseHList){
		int retStr = regBaseHList.size();//默认返回这一层的户数,作为本层的最大户数【常规楼盘建立够用了】
		int[] colNumbers = new int[retStr];
		if(retStr > 0){
			RegBaseH regBaseH = new RegBaseH();
			for(int i=0; i<retStr; i++){
				regBaseH = regBaseHList.get(i);
				if(regBaseH.getXyposition().indexOf("-") != -1){
					regBaseH.setXyposition(regBaseH.getXyposition().replaceAll("-", ""));
				}
				//这里的colvalue值需要考虑到100层【10001】以上,1000层以上就不考虑了 
				if(regBaseH.getXyposition().length() >= 6){//100100
					colNumbers[i] = Integer.parseInt(regBaseH.getXyposition().substring(3));
				}else if(regBaseH.getXyposition().length() >= 4){
					if(Integer.parseInt(regBaseH.getEndc()) >= 100){//1001
						colNumbers[i] = Integer.parseInt(regBaseH.getXyposition().substring(3));
					}else{
						if(Integer.valueOf(regBaseH.getHh()) >= 100){//3位户号
							if(Integer.parseInt(regBaseH.getEndc()) >= 10){// 10100 - 99100 
								colNumbers[i] = Integer.parseInt(regBaseH.getXyposition().substring(2));
							}else{//1100 - 9100
								colNumbers[i] = Integer.parseInt(regBaseH.getXyposition().substring(1));
							}
						}else{//2位户号 110(不存在) 1010
							colNumbers[i] = Integer.parseInt(regBaseH.getXyposition().substring(2));
						}
					} 
				}else if(regBaseH.getXyposition().length() >= 3){
					if(Integer.parseInt(regBaseH.getEndc()) >= 100){//1100
						colNumbers[i] = Integer.parseInt(regBaseH.getXyposition().substring(1));
					}else{//101
						colNumbers[i] = Integer.parseInt(regBaseH.getXyposition().substring(1));
					}
				}
			}
		}
		int tempMaxNumbers = 0;
		for(int j=0; j<colNumbers.length; j++){
			if(tempMaxNumbers < colNumbers[j]){
				tempMaxNumbers = colNumbers[j];
			}
		}
		retStr = tempMaxNumbers;
		return retStr;
	}


	
	@RequiresPermissions("reg:base:regBaseC:view")
	@RequestMapping(value = "form")
	public String form(RegBaseC regBaseC, Model model, HttpServletRequest request) {
		String dz = request.getParameter("DZ");
		model.addAttribute("DZ", dz);
		model.addAttribute("regBaseC", regBaseC);
		//查看标示
		if(StringUtils.isNotBlank(request.getParameter("VIEWS"))){
			model.addAttribute("VIEWS", request.getParameter("VIEWS"));
		}
		String xg = "";
		if(StringUtils.isNotBlank(request.getParameter("xg"))){
			xg = request.getParameter("xg");
		}
		String zid = request.getParameter("ZID");
		//获取当前幢中已有层的数量
		RegBaseC regBaseCTmp = new RegBaseC();
		regBaseCTmp.setZid(zid);
		regBaseCTmp.setIsnegativelayer("0");//获取正层
		List<RegBaseC> findCList = regBaseCService.findList(regBaseCTmp);
		int currentCCount = 0;
		currentCCount = findCList.size();
		String STR_FORMAT = "0000";
		DecimalFormat df = new DecimalFormat(STR_FORMAT);  
		if(currentCCount>0){
			model.addAttribute("currentCCount", currentCCount);
			if(StringUtils.isBlank(request.getParameter("xg"))){
				regBaseC.setSjc(String.valueOf(currentCCount+1));
				regBaseC.setCh(df.format(currentCCount+1));
			}
		}else{
			model.addAttribute("currentCCount", 0);
			regBaseC.setSjc(String.valueOf(currentCCount+1));
			if(StringUtils.isBlank(request.getParameter("xg"))){
				regBaseC.setCh(df.format(currentCCount+1));
			}
		}
		
		//统计当前负向层数
		RegBaseC regBaseCDXTmp = new RegBaseC();
		regBaseCDXTmp.setZid(zid);
		regBaseCDXTmp.setIsnegativelayer("1");//获取负层
		List<RegBaseC> findCDXList = regBaseCService.findList(regBaseCDXTmp);
		int dxcount = findCDXList.size();
		if(dxcount > 0){
			model.addAttribute("ZCDXCS", dxcount);
		}else{
			model.addAttribute("ZCDXCS", 0);
		}
		
		String xmid = request.getParameter("XMID");
		if(StringUtils.isNotBlank(zid)){
			model.addAttribute("ZID", zid);
		}
		if(StringUtils.isNotBlank(xmid)){
			model.addAttribute("XMID", xmid);
		}
		//通过幢ID获取幢的幢号、层数、建筑面积
		RegBaseZrz regBaseZrz = regBaseZrzService.get(zid);
		if(StringUtils.isBlank(regBaseC.getId())){
			model.addAttribute("ZH", regBaseZrz.getZrzh());
			model.addAttribute("ZCS", regBaseZrz.getZcs());
			model.addAttribute("JZMJ", regBaseZrz.getScjzmj());
			model.addAttribute("ZZDCS", regBaseZrz.getDscs());
			model.addAttribute("ZDXCS", regBaseZrz.getDxcs());
		}
		if(StringUtils.isNotBlank(xmid)){
			model.addAttribute("XMMC", regBaseZrz.getXmmc());
		}
		return "modules/reg/base/regBaseCForm";
	}

	@RequiresPermissions("reg:base:regBaseC:edit")
	@RequestMapping(value = "save")
	public String save(RegBaseC regBaseC, Model model, RedirectAttributes redirectAttributes, HttpServletRequest request) {
		if (!beanValidator(model, regBaseC)){
			return form(regBaseC, model, request);
		}
		String dz = request.getParameter("DZ");
		model.addAttribute("DZ", dz);
		String zid = "";
		if(StringUtils.isBlank(regBaseC.getId())){
			if(StringUtils.isNotBlank(request.getParameter("zid"))){
				zid = request.getParameter("zid");
			}
		}else{
			zid = regBaseC.getZid();
		}
		regBaseC.setZid(zid);
		if("1".equals(regBaseC.getIsnegativelayer())){//负层
			int currentCCount = 0;
			//取层号最大数加一
			if (StringUtils.isNotBlank(zid)) {
				RegBaseC  zrz = new RegBaseC();
				zrz.setZid(zid);
				zrz.setIsnegativelayer("1");
				List<RegBaseC> zrzlist =  regBaseCService.findcsxhList(zrz);
				if(zrzlist.size() > 0){
					zrz  = zrzlist.get(0);
					currentCCount =  Math.abs(Integer.parseInt(zrz.getCh()));
				}else{
					currentCCount = 0;
				}
			}
			String STR_FORMAT = "0000";
			DecimalFormat df = new DecimalFormat(STR_FORMAT);  
			//层号
			regBaseC.setCh("-"+df.format(currentCCount+1));
			//实际层
			regBaseC.setSjc(String.valueOf(-(currentCCount+1)));
			//名义层
			regBaseC.setMyc("负"+regBaseC.getMyc());
			
//			层号
//			regBaseC.setCh("-"+regBaseC.getCh());
//			实际层
//			regBaseC.setSjc(-(regBaseC.getSjc()));
//			名义层
//			regBaseC.setMyc("负"+regBaseC.getMyc());
		}
		
		regBaseCService.save(regBaseC);
		addMessage(redirectAttributes, "保存层信息成功");
		return "redirect:"+Global.getAdminPath()+"/reg/base/regBaseC/list?repage&ZID="+ zid+"&DZ="+dz;
	}
	
	@RequiresPermissions("reg:base:regBaseC:edit")
	@RequestMapping(value = "savebat")
	public String savebat(RegBaseC regBaseC, Model model, RedirectAttributes redirectAttributes, HttpServletRequest request) {
		if (!beanValidator(model, regBaseC)){
			return form(regBaseC, model, request);
		}
		String dz = request.getParameter("DZ");
		model.addAttribute("DZ", dz);
		String zid = "";
		if(StringUtils.isNotBlank(request.getParameter("zid"))){
			zid = request.getParameter("zid");
		} 
		//获取当前项目中已有幢的数量
		RegBaseC regBaseCTmp = new RegBaseC();
		regBaseCTmp.setZid(zid);
		regBaseCTmp.setIsnegativelayer(regBaseC.getIsnegativelayer());//判断是正还是负层
		List<RegBaseC> findCList = regBaseCService.findList(regBaseCTmp);
		int currentCCount = findCList.size();
		if("0".equals(regBaseC.getIsnegativelayer())){//正层
			//取层号最大数加一
			if (StringUtils.isNotBlank(zid)) {
				RegBaseC  zrz = new RegBaseC();
				zrz.setZid(zid);
				List<RegBaseC> zrzlist =  regBaseCService.findcsxhList(zrz);
				if(zrzlist.size() > 0){
					zrz  = zrzlist.get(0);
					if(zrz.getCh().startsWith("-")){
						currentCCount = 0;
					}else{
						currentCCount = Integer.parseInt(zrz.getCh());
					}
				}else{
					currentCCount = 0;
				}
			}
		}
		//批量生成多栋楼盘信息
		//层号、实际层、名义层,如果是负层的话要注意,层号从1往上累计,
		String genCount = request.getParameter("genCount");
		for(int i=0; i<Integer.parseInt(genCount); i++){
			if("0".equals(regBaseC.getIsnegativelayer())){//正层
				//层号
				regBaseC.setCh(RegUtils.getNextZrzSort(Integer.toString(currentCCount+i)));
				//实际层 
				regBaseC.setSjc(String.valueOf(currentCCount+i+1));
				
				//名义层
				regBaseC.setMyc(RegUtils.getNextZrzSort(Integer.toString(currentCCount+i)));
			}else{
				//层号
				regBaseC.setCh("-"+RegUtils.getNextZrzSort(Integer.toString(currentCCount+i)));
				//实际层
				regBaseC.setSjc(String.valueOf(-(currentCCount+i+1)));

				//名义层
				regBaseC.setMyc("负"+RegUtils.getNextZrzSort(Integer.toString(currentCCount+i)));
			}
			regBaseCService.savebat(regBaseC);
		}
		addMessage(redirectAttributes, "批量保存层【"+ genCount +"】条信息成功");
		return "redirect:"+Global.getAdminPath()+"/reg/base/regBaseC/list?repage&ZID="+ zid+"&DZ="+dz;
	}
	
	@RequiresPermissions("reg:base:regBaseC:edit")
	@RequestMapping(value = "audit")
	@Transactional
	public String audit(RegBaseC regBaseC, HttpServletRequest request,Model model, RedirectAttributes redirectAttributes) {
		String dz = request.getParameter("DZ");
		model.addAttribute("DZ", dz);
		regBaseC = regBaseCService.get(regBaseC.getId());
		//设置该数据已经被审核
		regBaseC.setIsaudit("1");
		regBaseCService.save(regBaseC);
		addMessage(redirectAttributes, "层信息审核成功!");
		return "redirect:"+Global.getAdminPath()+"/reg/base/regBaseC/list?repage&ZID="+request.getParameter("ZID")+"&DZ="+dz;
	}
	
	/***
	* @Title: batAudit 
	* @Description: 批量审核所有层
	* @param @param regBaseC
	* @param @param request
	* @param @param redirectAttributes
	* @param @return    设定文件 
	* @return String    返回类型 
	* @throws
	 */
	@RequiresPermissions("reg:base:regBaseC:edit")
	@RequestMapping(value = "batAudit")
	@Transactional
	public String batAudit(RegBaseC regBaseC, HttpServletRequest request,Model model, RedirectAttributes redirectAttributes) {
		String dz = request.getParameter("DZ");
		model.addAttribute("DZ", dz);
		String zid = request.getParameter("ZID");
		regBaseC.setZid(zid);
		List<RegBaseC> findCList = regBaseCService.findList(regBaseC);
		int count = findCList.size();
		if(count>0){
			for(int i=0; i<count; i++){
				regBaseC = findCList.get(i);
				if(!"0".equals(regBaseC.getIsaudit()) && !"".equals(regBaseC.getIsaudit()) && regBaseC.getIsaudit() != null){
					continue;
				}
				//设置该数据已经被审核
				regBaseC.setIsaudit("1");
				regBaseCService.save(regBaseC);
			}
		}
		addMessage(redirectAttributes, "批量层信息审核成功!");
		return "redirect:"+Global.getAdminPath()+"/reg/base/regBaseC/list?repage&ZID="+request.getParameter("ZID")+"&DZ="+dz;
	}
	
	@RequiresPermissions("reg:base:regBaseC:edit")
	@RequestMapping(value = "unaudit")
	@Transactional
	public String unaudit(RegBaseC regBaseC, HttpServletRequest request,Model model, RedirectAttributes redirectAttributes) {
		String dz = request.getParameter("DZ");
		model.addAttribute("DZ", dz);
		regBaseC = regBaseCService.get(regBaseC.getId());
		//设置该数据已经被审核
		regBaseC.setIsaudit("0");
		regBaseCService.save(regBaseC);
		addMessage(redirectAttributes, "层信息反审核成功!");
		return "redirect:"+Global.getAdminPath()+"/reg/base/regBaseC/list?repage&ZID="+request.getParameter("ZID")+"&DZ="+dz;
	}
	
	@RequiresPermissions("reg:base:regBaseC:edit")
	@RequestMapping(value = "isdelete")
	@ResponseBody
	public ModelMap isdelete(RegBaseC regBaseC, HttpServletRequest request) {
		ModelMap modelMap = new ModelMap();
		modelMap.put("data", "0");//默认没有被引用
		RegBaseH regBaseH = new RegBaseH();
		regBaseH.setCid(regBaseC.getId());
		regBaseH.setIsaudit("2");
		List<RegBaseH> regBaseHList = regBaseHService.findList(regBaseH);
		if(regBaseHList.size()>0){
			modelMap.put("data", "1");//已经有已引用的户信息记录
		}
		
		RegBaseC regBasecnew = regBaseCService.get(regBaseC.getId());
		RegBaseC regBasecnew_1 = new RegBaseC();
		regBasecnew_1.setZid(regBasecnew.getZid());
		List<RegBaseC> regBasecList = regBaseCService.findcsxhList(regBasecnew_1);
		if(regBasecList.size() > 0){
			regBasecnew_1 = regBasecList.get(0);
			if(Integer.parseInt(regBasecnew_1.getCh()) != Integer.parseInt(regBasecnew.getCh())){
				modelMap.put("bj", "1");
			}
		}
        return modelMap;
	}
	
	@RequiresPermissions("reg:base:regBaseC:edit")
	@RequestMapping(value = "delete")
	public String delete(RegBaseC regBaseC, RedirectAttributes redirectAttributes, HttpServletRequest request,Model model) {
		regBaseCService.cdelete(regBaseC);//彻底删除
		String zid = "";
		String dz = request.getParameter("DZ");
		model.addAttribute("DZ", dz);
		if(StringUtils.isNotBlank(request.getParameter("ZID"))){
			zid = request.getParameter("ZID");
		}
		//开始删除层下的户信息
		RegBaseH regBaseH = new RegBaseH();
		regBaseH.setCid(regBaseC.getId());
		List<RegBaseH> regBaseHList = new ArrayList<RegBaseH>();
		regBaseHList = regBaseHService.findList(regBaseH);
		for(int i=0; i<regBaseHList.size(); i++){
			regBaseHService.hdelete(regBaseHList.get(i));//彻底删除
		}
		addMessage(redirectAttributes, "删除层以及层下的户信息成功");
		return "redirect:"+Global.getAdminPath()+"/reg/base/regBaseC/list?repage&ZID="+ zid+"&DZ="+dz;
	}

	//将javabean实体类转为map类型,然后返回一个map类型的值
	public static Map<String, Object> beanToMap(Object obj) {
		Map<String, Object> params = new HashMap<String, Object>(0);
		try {
			PropertyUtilsBean propertyUtilsBean = new PropertyUtilsBean();
			PropertyDescriptor[] descriptors = propertyUtilsBean.getPropertyDescriptors(obj);
			for (int i = 0; i < descriptors.length; i++) {
				String name = descriptors[i].getName();
				if (!"class".equals(name)) {
					params.put(name.toUpperCase(),propertyUtilsBean.getNestedProperty(obj, name));
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return params;
	}

}