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

import java.io.StringBufferInputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

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

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.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.google.common.collect.Lists;
import com.thinkgem.jeesite.common.config.Global;
import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.web.BaseController;
import com.thinkgem.jeesite.common.utils.DateUtils;
import com.thinkgem.jeesite.common.utils.StringUtils;
import com.thinkgem.jeesite.modules.reg.dao.bus.RegBusSfSubDao;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBaseH;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBaseHbhqk;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBaseSllm;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBaseZdjbxx;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusBdcqzsdjxx;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusDyaq;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusFdcq2;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusFz;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusGd;
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.RegBusSf;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusSfSub;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusSjchild;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusSjmain;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusSlsq;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusSz;
import com.thinkgem.jeesite.modules.reg.service.base.RegBaseHService;
import com.thinkgem.jeesite.modules.reg.service.base.RegBaseHbhqkService;
import com.thinkgem.jeesite.modules.reg.service.base.RegBaseSllmService;
import com.thinkgem.jeesite.modules.reg.service.base.RegBaseZdjbxxService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusBdcqzsdjxxService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusFdcq2Service;
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.RegBusSfService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusSlsqService;
import com.thinkgem.jeesite.modules.reg.utils.RegUtils;
import com.thinkgem.jeesite.modules.sys.entity.User;
import com.thinkgem.jeesite.modules.sys.utils.DictUtils;
import com.thinkgem.jeesite.modules.sys.utils.UserUtils;

/**
 * 收费信息维护Controller
 * @author xuyg
 * @version 2016-04-04
 */
@Controller
@RequestMapping(value = "${adminPath}/reg/bus/regBusSf")
public class RegBusSfController extends BaseController {

	@Autowired
	private RegBusSfService regBusSfService;
	@Autowired
	private RegBusBdcqzsdjxxService regBusBdcqzsdjxxService;
	@Autowired
	private RegBaseHbhqkService regBaseHbhqkService;
	@Autowired
	private RegBaseHService regBaseHService;
	@Autowired
	private RegBusQlrService regBusQlrService;
	@Autowired
	private RegBaseZdjbxxService regBaseZdjbxxService;
	@Autowired
	private RegBusSlsqService regBusSlsqService;
	@Autowired
	private RegBusSfSubDao regBusSfSubDao;
	@Autowired
	private RegBaseSllmService regBaseSllmService;
	@Autowired
	private RegBusFdcq2Service regBusFdcq2Service;
	@Autowired
	private RegBusRightsService regBusRightsService;
	
	@ModelAttribute
	public RegBusSf get(@RequestParam(required=false) String id) {
		RegBusSf entity = null;
		if (StringUtils.isNotBlank(id)){
			entity = regBusSfService.get(id);
		}
		if (entity == null){
			entity = new RegBusSf();
		}
		return entity;
	}
	
	@RequiresPermissions("reg:bus:regBusSf:view")
	@RequestMapping(value = {"list", ""})
	public String list(RegBusSf regBusSf, HttpServletRequest request, HttpServletResponse response, Model model) {
		String ywhStr = request.getParameter("ywh");
		String djlx = request.getParameter("djlx");
		String tzrxmStr = request.getParameter("tzrxm");
		String slsq = request.getParameter("slsq");
		
		//抵押的话反写实际付费人
//		RegBusBdcqzsdjxx djxxdy = new RegBusBdcqzsdjxx();
//		djxxdy.setYwh(ywhStr);
//		List<RegBusBdcqzsdjxx> djxxdylist = regBusBdcqzsdjxxService.findList(djxxdy);
//		if(djxxdylist.size() > 0){
//			djxxdy = djxxdylist.get(0);
//			if("5".equals(djxxdy.getRights())){
//				//查找权利人
//				RegBusQlr qlr = new RegBusQlr();
//				qlr.setYwh(ywhStr);
//				List<RegBusQlr> qlrlist = regBusQlrService.findListSxh(qlr);
//				for(int i=0;i<qlrlist.size();i++){
//					qlr = qlrlist.get(i);
//					if(qlr.getSxh() == 1){
//						tzrxmStr = qlr.getQlrmc();
//					}
//				}
//			}
//		}
		
		if(StringUtils.isNotBlank(ywhStr)){
			regBusSf.setYwh(ywhStr);
			model.addAttribute("ywh", ywhStr);
			model.addAttribute("djlx", djlx);
			model.addAttribute("tzrxm", tzrxmStr);
		}
		RegBusSlsq regBusSlsq = regBusSlsqService.getByYwh(ywhStr);
		if(regBusSlsq.getDjdl().equals("500") || regBusSlsq.getDjxl().equals("416")){//更正大类允许修改|房屋所有权更名
			model.addAttribute("LISTVIEW", "1");
		}
		//归档以后只能查看不能修改删除
		if(StringUtils.isNotBlank(request.getParameter("LISTVIEWS"))){
			model.addAttribute("LISTVIEWS", "1");
		}
		if(StringUtils.isNotBlank(request.getParameter("slsq"))){
			model.addAttribute("slsq", "1");
		}
		Page<RegBusSf> page = regBusSfService.findPage(new Page<RegBusSf>(request, response), regBusSf); 
		//判断当前是否已有收费记录
		if(page.getList().size()>0){
			model.addAttribute("ised", "1");
		}
		model.addAttribute("page", page);
		if(StringUtils.isNotBlank(slsq)){
			return "modules/reg/bus/regBusSlsqSfList";
		}else {
			return "modules/reg/bus/regBusSfList";
		}
	}
	/**
	 * 电子档案收费信息查看列表
	 * @param regBusSf
	 * @param model
	 * @param request
	 * @return
	 */
	@RequiresPermissions("reg:bus:regBusSf:view")
	@RequestMapping(value = "sflist")
	public String sflist(RegBusSf regBusSf, HttpServletRequest request, HttpServletResponse response, Model model) {
		model.addAttribute("ised", "1");
		Page<RegBusSf> page = regBusSfService.findPage(new Page<RegBusSf>(request, response), regBusSf); 
		model.addAttribute("page", page);
		return "modules/reg/bus/regBusSfshowList";
	}
	
	@RequiresPermissions("reg:bus:regBusSf:view")
	@RequestMapping(value = "form")
	public String form(RegBusSf regBusSf, Model model, HttpServletRequest request) {
		User user = UserUtils.getUser();
		String ywhStr = request.getParameter("ywh");
		String djlx = request.getParameter("djlx");
		String tzrxmStr = request.getParameter("tzrxm");
		String slsq = request.getParameter("slsq");
		if(StringUtils.isNotBlank(ywhStr)){
			model.addAttribute("ywh", ywhStr);
			model.addAttribute("djlx", djlx);
			model.addAttribute("tzrxm", tzrxmStr);
			model.addAttribute("YSDM",request.getParameter("YSDM"));
			
			RegBusSf regBusSftmp = new RegBusSf();
			regBusSftmp.setYwh(ywhStr);
			List<RegBusSf> findList = regBusSfService.findList(regBusSftmp);
			if(findList.size() > 0){
				regBusSftmp = findList.get(0);
				RegBusSfSub regBusSfSub = new RegBusSfSub();
				regBusSfSub.setMainId(regBusSftmp);
				List<RegBusSfSub> findList2 = regBusSfSubDao.findList(regBusSfSub);
				if(findList2.size() > 0){
					for (int i = 0; i < findList2.size(); i++) {
						regBusSfSub = findList2.get(i);
						if(regBusSfSub.getSfkmmc().equals("1")){
							model.addAttribute("zzsl", regBusSfSub.getSfjs());
							model.addAttribute("yszzje", regBusSfSub.getYsje());
							model.addAttribute("sszzje", regBusSfSub.getSsje());
						}else if(regBusSfSub.getSfkmmc().equals("2")){
							model.addAttribute("fzzsl", regBusSfSub.getSfjs());
							model.addAttribute("ysfzzje", regBusSfSub.getYsje());
							model.addAttribute("ssfzzje", regBusSfSub.getSsje());
						}else if(regBusSfSub.getSfkmmc().equals("3")){
							model.addAttribute("jbzzsl", regBusSfSub.getSfjs());
							model.addAttribute("ysjbzzje", regBusSfSub.getYsje());
							model.addAttribute("ssjbzzje", regBusSfSub.getSsje());
						}else if(regBusSfSub.getSfkmmc().equals("4")){
							model.addAttribute("jbfzzsl", regBusSfSub.getSfjs());
							model.addAttribute("ysjbfzzje", regBusSfSub.getYsje());
							model.addAttribute("ssjbfzzje", regBusSfSub.getSsje());
						}else if(regBusSfSub.getSfkmmc().equals("5")){
							model.addAttribute("gyrsl", regBusSfSub.getSfjs());
							model.addAttribute("ysgbf", regBusSfSub.getYsje());
							model.addAttribute("ssgbf", regBusSfSub.getSsje());
						}
					}
				}
			}else {
				Map<String, String> map = sfwhCkChoice(ywhStr, djlx);
				model.addAttribute("jbzzsl", Integer.valueOf(String.valueOf(map.get("jbzzsl"))));
				model.addAttribute("jbzzje", Integer.valueOf(String.valueOf(map.get("jbzzje"))));
				model.addAttribute("jbfzzsl", Integer.valueOf(String.valueOf(map.get("jbfzzsl"))));
				model.addAttribute("jbfzzje", Integer.valueOf(String.valueOf(map.get("jbfzzje"))));
				model.addAttribute("zzsl", Integer.valueOf(String.valueOf(map.get("zzsl"))));
				model.addAttribute("zzje", Integer.valueOf(String.valueOf(map.get("zzje"))));
				model.addAttribute("fzzsl", Integer.valueOf(String.valueOf(map.get("fzzsl"))));
				model.addAttribute("fzzje", Integer.valueOf(String.valueOf(map.get("fzzje"))));
				model.addAttribute("gyrsl", Integer.valueOf(String.valueOf(map.get("gyrsl"))));
				model.addAttribute("gbf", Integer.valueOf(String.valueOf(map.get("gbf"))));
				model.addAttribute("NAME", user.getName());
			}
		}
		//查看标示
		if(StringUtils.isNotBlank(request.getParameter("VIEWS"))){
			model.addAttribute("VIEWS", request.getParameter("VIEWS"));
		}
		if(StringUtils.isNotBlank(request.getParameter("optype"))){
			model.addAttribute("optype", request.getParameter("optype"));
		}
		if(StringUtils.isNotBlank(request.getParameter("slsq"))){
			model.addAttribute("slsq", "1");
		}
		model.addAttribute("regBusSf", regBusSf);
		if(StringUtils.isNotBlank(slsq)){
//			return "modules/reg/bus/regBusSlsqSfForm";
			return "modules/reg/bus/regBusSlsqSfNewForm";
		}else {
//			return "modules/reg/bus/regBusSfForm";
			return "modules/reg/bus/regBusSfNewForm";
		}
	}
	
	/**
	 * 电子档案收费信息查看from
	 * @param regBusSf
	 * @param model
	 * @param request
	 * @return
	 */
	@RequiresPermissions("reg:bus:regBusSf:view")
	@RequestMapping(value = "sfform")
	public String sfform(RegBusSf regBusSf, Model model, HttpServletRequest request) {
		String ids = request.getParameter("id");
		regBusSf = regBusSfService.get(ids);
		model.addAttribute("regBusSf", regBusSf);
		return "modules/reg/bus/regBusSfshowForm";
	}
	
	/***
	* @Title: sfwhCkChoiceForm 
	* @Description: 收费维护参考表单
	* @param @param regBusBdcqzsdjxx
	* @param @param request
	* @param @param response
	* @param @param model
	* @param @return    设定文件 
	* @return String    返回类型 
	* @throws
	 */
	@RequiresPermissions("reg:bus:regBusBdcqzsdjxx:view")
	@RequestMapping(value = "sfwhCkChoiceForm")
	public String sfwhCkChoiceForm(RegBusBdcqzsdjxx regBusBdcqzsdjxx, HttpServletRequest request, HttpServletResponse response, Model model) {
		String ywh = request.getParameter("YWH");
		String djlx = request.getParameter("djlx");
		String tzrxm = request.getParameter("tzrxm");
		model.addAttribute("ywh", ywh);
		model.addAttribute("djlx", djlx);
		model.addAttribute("tzrxm", tzrxm);
		Map<String, String> map = sfwhCkChoice(ywh, djlx);
		model.addAttribute("jbzzsl", Integer.valueOf(String.valueOf(map.get("jbzzsl"))));
		model.addAttribute("jbzzje", Integer.valueOf(String.valueOf(map.get("jbzzje"))));
		model.addAttribute("jbfzzsl", Integer.valueOf(String.valueOf(map.get("jbfzzsl"))));
		model.addAttribute("jbfzzje", Integer.valueOf(String.valueOf(map.get("jbfzzje"))));
		model.addAttribute("zzsl", Integer.valueOf(String.valueOf(map.get("zzsl"))));
		model.addAttribute("zzje", Integer.valueOf(String.valueOf(map.get("zzje")))
				+Integer.valueOf(String.valueOf(map.get("jbzzje"))));
		model.addAttribute("fzzsl", Integer.valueOf(String.valueOf(map.get("fzzsl"))));
		model.addAttribute("fzzje", Integer.valueOf(String.valueOf(map.get("fzzje")))
				+Integer.valueOf(String.valueOf(map.get("jbfzzje"))));
		model.addAttribute("gyrsl", Integer.valueOf(String.valueOf(map.get("gyrsl"))));
		model.addAttribute("gbf", Integer.valueOf(String.valueOf(map.get("gbf"))));
		model.addAttribute("hjje", String.valueOf(map.get("hjje")));
		return "modules/reg/bus/change/houseviews/sfwhCkChoiceForm";
	}
	
	/***
	* @Title: sfwhCkChoiceForm 
	* @Description: 收费维护参考标准
	* @param @param regBusBdcqzsdjxx
	* @param @param request
	* @param @param response
	* @param @param model
	* @param @return    设定文件 
	* @return String    返回类型 
	* @throws
	 */
	public Map sfwhCkChoice(String ywh,String djlx) {
		int zzsl = 0;//登记费(住宅)基数
		int fzzsl = 0;//登记费(非住宅)基数
		int gyrsl = 0;//共有人数量
		int jbfzzsl = 0;//减半非住宅基数
		int jbzzsl = 0;//减半住宅基数
		String flag = "";//判断是否符合只收取工本费条件 
		RegBusBdcqzsdjxx regBusBdcqzsdjxx = new RegBusBdcqzsdjxx();
		regBusBdcqzsdjxx.setYwh(ywh);
		regBusBdcqzsdjxx.setIslogout("0");
		List<RegBusBdcqzsdjxx> listDjxx= regBusBdcqzsdjxxService.findList(regBusBdcqzsdjxx);
		if(listDjxx.size() > 0){//非注销、非查封业务
			regBusBdcqzsdjxx = listDjxx.get(0);
			RegBusQlr regBusQlr = new RegBusQlr();
			regBusQlr.setYwh(ywh);
			List<RegBusQlr> listregBusQlr = regBusQlrService.findListSxh(regBusQlr);
			String qlrlx = "";
			if(listregBusQlr.size() > 0){
				qlrlx = listregBusQlr.get(0).getQlrlx();
			}
			RegBusSlsq regBusSlsq = regBusSlsqService.getByYwh(regBusBdcqzsdjxx.getYwh());
			if(regBusSlsq.getDjdl().equals("700") //预告登记不收费
					|| (regBusSlsq.getTzrxm().equals("不动产登记局") || regBusSlsq.getDjdl().equals("300") || regBusSlsq.getDjdl().equals("500"))//不动产登记局的变更更正不收费 
					|| qlrlx.equals("5")){//权利人类型为小微企业
			}else{
				RegBaseZdjbxx regBaseZdjbxxt = new RegBaseZdjbxx();
				regBaseZdjbxxt.setBdcdyh(regBusBdcqzsdjxx.getBdcdyh().substring(0, 19));
				regBaseZdjbxxt.setIslogout("13");
				List<RegBaseZdjbxx> findListt = regBaseZdjbxxService.findList(regBaseZdjbxxt);
				if(findListt.size() > 0){
					regBaseZdjbxxt = findListt.get(0);
					if(regBaseZdjbxxt.getQllx().equals("5")){//宅基地使用权
						
						if(regBusBdcqzsdjxx.getBdcdyh().substring(19, 20).equals("W")){
							flag = "1";
						}else if(regBusBdcqzsdjxx.getBdcdyh().substring(19, 20).equals("F")){
							//房屋所属土地是宅基地使用权
							if(regBusBdcqzsdjxx.getRights().equals("1")){
								flag = "1";
							}
						}
					}
				}
				
				if(djlx.equals("1001") || djlx.equals("1002") || djlx.equals("1003") || djlx.equals("1004") || flag.equals("1")){
					if(listregBusQlr.size() > 0){
						gyrsl = listregBusQlr.size();
					}
				}else {
					if(regBusBdcqzsdjxx.getBdcqzh() != null){
						if(regBusBdcqzsdjxx.getBdcqzh().contains("不动产权")){//证明不收取工本费
							if(listregBusQlr.size() > 0){
								gyrsl = listregBusQlr.size()-1;
							}
						}
					}else {
						gyrsl = listregBusQlr.size()-1;
					}
					RegBusFdcq2 fdcq = new RegBusFdcq2();
					RegBaseH regBaseH = new RegBaseH();
					String jbdiczddm = "";
					String diczddm = "";
					String jbdicfzddm = "";
					String dicfzddm = "";
					String status = "";
					RegBaseZdjbxx regBaseZdjbxx = new RegBaseZdjbxx();
					RegBaseZdjbxx regBaseZdjbxxtmp = new RegBaseZdjbxx();
					RegBaseSllm regBaseSllm = new RegBaseSllm();
					for (int i = 0; i < listDjxx.size(); i++) {
						regBusBdcqzsdjxx = listDjxx.get(i);
						if(regBusBdcqzsdjxx.getStatus() != null){
							status = regBusBdcqzsdjxx.getStatus();
						}
						if(djlx.equals("418") || djlx.equals("419") || djlx.equals("406") || djlx.equals("407") 
								|| djlx.equals("403") || djlx.equals("404") || djlx.equals("427") || djlx.equals("428") 
								|| djlx.equals("810") || djlx.equals("811") 
								|| djlx.equals("420") || djlx.equals("421") || djlx.equals("416") || djlx.equals("422") 
								|| djlx.equals("819") || djlx.equals("410") || djlx.equals("411") 
								|| djlx.equals("601") || djlx.equals("602") || djlx.equals("604") || djlx.equals("607") 
								|| djlx.equals("605") || djlx.equals("606") || djlx.equals("608") || djlx.equals("609") 
								|| djlx.equals("701") || djlx.equals("702") || djlx.equals("704") || djlx.equals("703") 
								|| djlx.equals("414") || djlx.equals("415") || djlx.equals("417") || djlx.equals("610")){
							if(regBusBdcqzsdjxx.getBdcdyh().substring(19, 20).equals("W")){
								regBaseZdjbxxtmp.setBdcdyh(regBusBdcqzsdjxx.getBdcdyh());
								regBaseZdjbxxtmp.setIslogout("13");
								List<RegBaseZdjbxx> findList = regBaseZdjbxxService.findList(regBaseZdjbxxtmp);
								if(findList.size() > 0){
									regBaseZdjbxx = findList.get(0);
									if(regBaseZdjbxx.getYt() != null){
										if(regBaseZdjbxx.getYt().equals("住宅用地") || regBaseZdjbxx.getYt().equals("商业、住宅用地")   
											|| regBaseZdjbxx.getYt().equals("农村宅基地") || regBaseZdjbxx.getYt().equals("城镇住宅用地")){
											if(StringUtils.isNotBlank(jbdiczddm)){
												jbdiczddm += ","+ regBusBdcqzsdjxx.getZddm();
											}else {
												jbdiczddm = regBusBdcqzsdjxx.getZddm();
											}
										}else{
											if(StringUtils.isNotBlank(jbdicfzddm)){
												jbdicfzddm += ","+ regBusBdcqzsdjxx.getZddm();
											}else {
												jbdicfzddm = regBusBdcqzsdjxx.getZddm();
											}
										}
									}
								}
							}else if(regBusBdcqzsdjxx.getBdcdyh().substring(19, 20).equals("F")){
								if(djlx.equals("609") || djlx.equals("812") 
										|| (djlx.equals("402") && !status.equals("97"))
										|| djlx.equals("403") || djlx.equals("404")
										|| djlx.equals("427") || djlx.equals("428")
										|| djlx.equals("810") || djlx.equals("811")){
									RegBaseHbhqk regBaseHbhqk = new RegBaseHbhqk();
									regBaseHbhqk.setYwh(regBusBdcqzsdjxx.getYwh());
									if(djlx.equals("403") || djlx.equals("404")){
										regBaseHbhqk.setBdcdyh(regBusBdcqzsdjxx.getBdcdyh());
									}
									List<RegBaseHbhqk> findList = regBaseHbhqkService.findList(regBaseHbhqk);
									if(findList.size() > 0){
										regBaseHbhqk = findList.get(0);
										regBaseH = regBaseHService.get(regBaseHbhqk.getHid());
									}
								}else{
									regBaseH = regBaseHService.getIslogout(regBusBdcqzsdjxx.getBdcdyh());
								}
								if(regBaseH != null){
									if(regBaseH.getFwyt1().equals("10") || regBaseH.getFwyt1().equals("11") 
											|| regBaseH.getFwyt1().equals("12") || regBaseH.getFwyt1().equals("13") 
											|| regBaseH.getFwyt1().equals("111") || regBaseH.getFwyt1().equals("112")
											|| regBaseH.getFwyt1().equals("802") || regBaseH.getFwyt1().equals("804") || regBaseH.getFwyt1().equals("85")){
										//4廉租住房,3公共租赁住房,6经济适用住房,15移民搬迁安置房
										if(!regBaseH.getFwxz().equals("4") && !regBaseH.getFwxz().equals("3") 
												&& !regBaseH.getFwxz().equals("6") && !regBaseH.getFwxz().equals("15")){
											if(StringUtils.isNotBlank(jbdiczddm)){
												if(djlx.equals("403") || djlx.equals("404")){
													jbdiczddm += ","+ regBusBdcqzsdjxx.getBdcdyh();
												}else{
													jbdiczddm += ","+ regBusBdcqzsdjxx.getZddm();
												}
											}else {
												if(djlx.equals("403") || djlx.equals("404")){
													jbdiczddm += ","+ regBusBdcqzsdjxx.getBdcdyh();
												}else{
													jbdiczddm = regBusBdcqzsdjxx.getZddm();
												}
											}
										}
									}else {
										if(StringUtils.isNotBlank(jbdicfzddm)){
											jbdicfzddm += ","+ regBusBdcqzsdjxx.getZddm();
										}else {
											jbdicfzddm = regBusBdcqzsdjxx.getZddm();
										}
									}
								}
							}if(regBusBdcqzsdjxx.getBdcdyh().substring(19, 20).equals("L")){
								regBaseSllm.setBdcdyh(regBusBdcqzsdjxx.getBdcdyh());
								regBaseSllm.setIslogout("13");
								List<RegBaseSllm> findList = regBaseSllmService.findList(regBaseSllm);
								if(findList.size() > 0){
									regBaseSllm = findList.get(0);
									if(StringUtils.isNotBlank(jbdicfzddm)){
										jbdicfzddm += ","+ regBusBdcqzsdjxx.getZddm();
									}else {
										jbdicfzddm = regBusBdcqzsdjxx.getZddm();
									}
								}
							}
						}else{
							if(regBusBdcqzsdjxx.getBdcdyh().substring(19, 20).equals("F")){
								if(djlx.equals("609") || djlx.equals("812") 
										|| (djlx.equals("402") && !status.equals("97")) 
										|| djlx.equals("403") || djlx.equals("404")
										|| djlx.equals("427") || djlx.equals("428")
										|| djlx.equals("810") || djlx.equals("811")){
									RegBaseHbhqk regBaseHbhqk = new RegBaseHbhqk();
									regBaseHbhqk.setYwh(regBusBdcqzsdjxx.getYwh());
									List<RegBaseHbhqk> findList = regBaseHbhqkService.findList(regBaseHbhqk);
									if(findList.size() > 0){
										regBaseHbhqk = findList.get(0);
										regBaseH = regBaseHService.get(regBaseHbhqk.getHid());
									}
								}else{
									regBaseH = regBaseHService.getIslogout(regBusBdcqzsdjxx.getBdcdyh());
								}
								fdcq.setBdcdyh(regBusBdcqzsdjxx.getBdcdyh());
								fdcq.setYwh(ywh);
								List<RegBusFdcq2> findListfdcqt = regBusFdcq2Service.findList(fdcq);
								fdcq = new RegBusFdcq2();
								if(findListfdcqt.size()>0){
									fdcq=findListfdcqt.get(0);
								}
								//转移是房屋用途和房屋性质会发生变化,户信息是登簿时才生效,以户作为判断标准收费不对
								if("302".equals(djlx)){
									if(fdcq != null){
										if(fdcq.getGhyt().equals("10") || fdcq.getGhyt().equals("11")
												|| fdcq.getGhyt().equals("12") || fdcq.getGhyt().equals("13") 
												|| fdcq.getGhyt().equals("111") || fdcq.getGhyt().equals("112")
												|| fdcq.getGhyt().equals("802") || fdcq.getGhyt().equals("804") || fdcq.getGhyt().equals("85")){
											//4廉租住房,3公共租赁住房,6经济适用住房,15移民搬迁安置房
											if(!("4".equals(fdcq.getFwxz()) || "3".equals(fdcq.getFwxz())
														||"6".equals(fdcq.getFwxz()) || "15".equals(fdcq.getFwxz()))){
												if(StringUtils.isNotBlank(diczddm)){
													diczddm += ","+ regBusBdcqzsdjxx.getZddm();
												}else {
													diczddm = regBusBdcqzsdjxx.getZddm();
												}
											}
										}else {
											if(StringUtils.isNotBlank(dicfzddm)){
												dicfzddm += ","+ regBusBdcqzsdjxx.getZddm();
											}else {
												dicfzddm = regBusBdcqzsdjxx.getZddm();
											}
										}
									}
								}else{//其他业务还是以户信息为准收费
									if(regBaseH != null){
										if(regBaseH.getFwyt1().equals("10") || regBaseH.getFwyt1().equals("11")
												|| regBaseH.getFwyt1().equals("12") || regBaseH.getFwyt1().equals("13") 
												|| regBaseH.getFwyt1().equals("111") || regBaseH.getFwyt1().equals("112")
												|| regBaseH.getFwyt1().equals("802") || regBaseH.getFwyt1().equals("804")  || regBaseH.getFwyt1().equals("85")){
											//4廉租住房,3公共租赁住房,6经济适用住房,15移民搬迁安置房
											if(!("4".equals(regBaseH.getFwxz()) || "3".equals(regBaseH.getFwxz())
														||"6".equals(regBaseH.getFwxz()) || "15".equals(regBaseH.getFwxz()))){
												if(StringUtils.isNotBlank(diczddm)){
													diczddm += ","+ regBusBdcqzsdjxx.getZddm();
												}else {
													diczddm = regBusBdcqzsdjxx.getZddm();
												}
											}
										}else {
											if(StringUtils.isNotBlank(dicfzddm)){
												dicfzddm += ","+ regBusBdcqzsdjxx.getZddm();
											}else {
												dicfzddm = regBusBdcqzsdjxx.getZddm();
											}
										}
									}
								}
							}else if(regBusBdcqzsdjxx.getBdcdyh().substring(19, 20).equals("W")){//土地业务
								if(regBusBdcqzsdjxx.getBdcqzh() != null){
									if(regBusBdcqzsdjxx.getBdcqzh().contains("不动产权证书")){//证明不收取工本费
										gyrsl = (listregBusQlr.size()-1) * listDjxx.size();
									}
								}else {
									gyrsl = (listregBusQlr.size()-1) * listDjxx.size();
								}
								regBaseZdjbxx.setBdcdyh(regBusBdcqzsdjxx.getBdcdyh());
								regBaseZdjbxx.setIslogout("13");
								List<RegBaseZdjbxx> findList = regBaseZdjbxxService.findList(regBaseZdjbxx);
								if(findList.size() > 0){
									regBaseZdjbxx = findList.get(0);
									if(regBaseZdjbxx.getYt() != null){
										if(regBaseZdjbxx.getYt().equals("住宅用地") || regBaseZdjbxx.getYt().equals("商业、住宅用地")   
											|| regBaseZdjbxx.getYt().equals("农村宅基地") || regBaseZdjbxx.getYt().equals("城镇住宅用地")){
											if(StringUtils.isNotBlank(diczddm)){
												diczddm += ","+ regBusBdcqzsdjxx.getZddm();
											}else {
												diczddm = regBusBdcqzsdjxx.getZddm();
											}
										}else{
											if(StringUtils.isNotBlank(dicfzddm)){
												dicfzddm += ","+ regBusBdcqzsdjxx.getZddm();
											}else {
												dicfzddm = regBusBdcqzsdjxx.getZddm();
											}
										}
									}
								}
							}else if(regBusBdcqzsdjxx.getBdcdyh().substring(19, 20).equals("L")){//林权业务
								regBaseSllm.setBdcdyh(regBusBdcqzsdjxx.getBdcdyh());
								regBaseSllm.setIslogout("13");
								List<RegBaseSllm> findList = regBaseSllmService.findList(regBaseSllm);
								if(findList.size() > 0){
									regBaseSllm = findList.get(0);
									if(StringUtils.isNotBlank(dicfzddm)){
										dicfzddm += ","+ regBusBdcqzsdjxx.getZddm();
									}else {
										dicfzddm = regBusBdcqzsdjxx.getZddm();
									}
								}
							}
						}
					}
					if(!djlx.equals("207") && !djlx.equals("302") && !djlx.equals("402") && !djlx.equals("416") && !djlx.equals("214") 
					   && !djlx.equals("215")){
						//获取该房屋所属土地的不重复宗地的数量
						if(!jbdicfzddm.equals("")){
							String aaArray[] = jbdicfzddm.split(",");
							String[] rowsTemp = RegUtils.strReplace(aaArray); 
							jbfzzsl = jbfzzsl + rowsTemp.length;
						} if(!jbdiczddm.equals("")){
							String aaArray[] = jbdiczddm.split(",");
							String[] rowsTemp = RegUtils.strReplace(aaArray); 
							jbzzsl = jbzzsl + rowsTemp.length;
						}
						if(!dicfzddm.equals("")){
							String Array[] = dicfzddm.split(",");
//							String[] rowsTmp = RegUtils.strReplace(Array); 
//							fzzsl = fzzsl + rowsTmp.length;
							fzzsl = fzzsl + Array.length;
						} if(!diczddm.equals("")){
							String Array[] = diczddm.split(",");
							String[] rowsTmp = RegUtils.strReplace(Array); 
							zzsl = zzsl + rowsTmp.length;
						}
					}else{
						//一笔业务为一件
						if(!dicfzddm.equals("")){
							fzzsl = 1;
						}else if(!diczddm.equals("")){
							zzsl = 1;
						}else if(!jbdicfzddm.equals("")){
							jbfzzsl = 1;
						}else if(!jbdiczddm.equals("")){
							jbzzsl = 1;
						}
					}
				}
				
				//换证补证只收取工本费
				//只有是房屋所有权的,产权来源是析产的时候才进此判断
				RegBusFdcq2 fdcqcqly = new RegBusFdcq2();
				fdcqcqly.setBdcdyh(regBusBdcqzsdjxx.getBdcdyh());
				fdcqcqly.setYwh(ywh);
				List<RegBusFdcq2> findListcqly = regBusFdcq2Service.findList(fdcqcqly);
				if(findListcqly.size()>0 ){
					fdcqcqly=findListcqly.get(0);
					if(StringUtils.isNotBlank(fdcqcqly.getCqly())){
						if(fdcqcqly.getCqly().equals("9") && listregBusQlr.size() > 0){
							gyrsl = listregBusQlr.size();
							zzsl =0;
							fzzsl=0;
							jbzzsl=0;
							jbfzzsl=0;
						}
					}
				}
			}
			if(regBusSlsq.getSqfbcz() == 0){//打印一个权利人的证,只收一个权利人费用
				if(djlx.equals("1001") || djlx.equals("1002") || djlx.equals("1003") || djlx.equals("1004") || flag.equals("1")){
					gyrsl = 1;
				}else{
					gyrsl = 0;
				}
			}
			
		}
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("jbzzsl", jbzzsl);// 减半住宅数量
		map.put("jbzzje", jbzzsl*40);//减半住宅金额
		map.put("jbfzzsl", jbfzzsl);//减半非住宅数量
		map.put("jbfzzje", jbfzzsl*275);//减半非住宅金额
		map.put("zzsl", zzsl);//住宅数量
		map.put("zzje", zzsl*80);//住宅金额
		map.put("fzzsl", fzzsl);//非住宅数量
		map.put("fzzje", fzzsl*550);//非住宅金额
		map.put("gyrsl", gyrsl);//共有人数量
		map.put("gbf", gyrsl*10);//工本费
		int hjje = jbzzsl*40+zzsl*80+fzzsl*550+jbfzzsl*275+gyrsl*10;
		map.put("hjje", hjje+"元");//合计金额
		return map;
	}
	
	@RequiresPermissions("reg:bus:regBusSf:view")
	@RequestMapping(value = "printView")
	public String printView(RegBusSf regBusSf, HttpServletRequest request, HttpServletResponse response, Model model) {
		//当前的业务号
		String ywhStr = request.getParameter("ywh"); 
		if(StringUtils.isNotBlank(ywhStr)){
			model.addAttribute("ywh", ywhStr);
		}
		//需要把本次收费的概要信息显示下
		regBusSf.setYwh(ywhStr);
		List<RegBusSf> findList = regBusSfService.findList(regBusSf);
		regBusSf = findList.get(0);
		
		List<RegBusSfSub> regBusSfSubList = Lists.newArrayList();
		String id= "";
		if(findList.size()>0){
			id = regBusSf.getId();
			regBusSf = regBusSfService.get(id);
		}
		//详细收费项目
		regBusSfSubList = regBusSf.getRegBusSfSubList();
		int count = regBusSfSubList.size();
		Double sfzje = 0.0;
		if(count>0){
			for(int i=0; i<count; i++){
				RegBusSfSub regBusSfSub = regBusSfSubList.get(i);
				Double sub_sfzje = 0.0;
				if(regBusSfSub.getSsje() != null && regBusSfSub.getSfjs() != null){
					sub_sfzje = Double.valueOf(regBusSfSub.getSsje())*Double.valueOf(regBusSfSub.getSfjs());
					sfzje += sub_sfzje;
				}
			}
		}
		model.addAttribute("sfzje", sfzje);
		model.addAttribute("ffry", regBusSf.getSjffr());
		return "modules/reg/print/feesPrint";
	}
	@RequiresPermissions("reg:bus:regBusSf:view")
	@RequestMapping(value = "getFeePrintData")
	@ResponseBody
	public ModelMap getFeePrintData(RegBusSf regBusSf, HttpServletRequest request, HttpServletResponse response, Model model) {
		//当前的业务号
		String ywhStr = request.getParameter("ywh");
		Map<String,String> map = new HashMap<String,String>();
		regBusSf.setYwh(ywhStr);
		List<RegBusSf> findList = regBusSfService.findList(regBusSf);
		regBusSf = findList.get(0);
		
		List<RegBusSfSub> regBusSfSubList = Lists.newArrayList();
		String id= "";
		if(findList.size()>0){
			id = regBusSf.getId();
			regBusSf = regBusSfService.get(id);
		}
		
		map.put("jfry", regBusSf.getSjffr());
		String yearStr = DateUtils.getYear();
		String monthStr = DateUtils.getMonth();
		String dayStr = DateUtils.getDay();
		map.put("yearStr", yearStr);
		map.put("monthStr", monthStr);
		map.put("dayStr", dayStr);
		
		//详细收费项目
		regBusSfSubList = regBusSf.getRegBusSfSubList();
		int count = regBusSfSubList.size();
		
		Double sfzje = 0.0;
		if(count>0){
			for(int i=0; i<count; i++){
				RegBusSfSub regBusSfSub = regBusSfSubList.get(i);
				map.put("sfxm"+(i+1), DictUtils.getDictLabel(regBusSfSub.getSfkmmc(), "reg_bus_sfxm", ""));
				map.put("sfsl"+(i+1), regBusSfSub.getSfjs());
				//map.put("sfdw"+i, regBusSfSub.getZkhysje());
				//map.put("sfdj"+i, regBusSfSub.());
				String sfjeStr = "";
				Double sub_sfzje = 0.0;
				if(regBusSfSub.getSsje() != null && regBusSfSub.getSfjs() != null){
					sub_sfzje = Double.valueOf(regBusSfSub.getSsje())*Double.valueOf(regBusSfSub.getSfjs());
					sfjeStr = String.valueOf(sub_sfzje);
					sfzje += sub_sfzje;
				}
				map.put("sfje"+(i+1), sfjeStr);
			}
		}
		if(count < 3){
			map.put("sfxm3", "");
			map.put("sfsl3", "");
			map.put("sfje3", "");
		}
		map.put("sfzje", String.valueOf(sfzje));
		map.put("skdw", regBusSf.getSfdw());
		map.put("sfry", regBusSf.getSfry());
		ModelMap modelMap = new ModelMap();
        modelMap.put("data", map);
        return modelMap;
	}

	@RequiresPermissions("reg:bus:regBusSjmain:edit")
	@RequestMapping(value = "isnotsfed")
	@ResponseBody
	public ModelMap isnotsfed(HttpServletRequest request) {
		String ywh = request.getParameter("YWH");
		RegBusSf regBusSf = new RegBusSf();
		regBusSf.setYwh(ywh);
		List<RegBusSf> findList = regBusSfService.findList(regBusSf);
		ModelMap modelMap = new ModelMap();
		if(findList.size()>0){
			modelMap.put("data", "1");
		}else{
			modelMap.put("data", "0");//还没有做缮证记录维护
		}
        return modelMap;
	}

	@RequestMapping(value = "save")
	public String save(RegBusSf regBusSf, Model model, RedirectAttributes redirectAttributes, HttpServletRequest request) {
		if (!beanValidator(model, regBusSf)){
			return form(regBusSf, model, request);
		}
		String ywh = request.getParameter("ywh");
		String slsq = request.getParameter("slsq");
		String tzrxm = request.getParameter("tzrxm");
		String djlx = request.getParameter("djlx");
		if(StringUtils.isBlank(request.getParameter("slsq"))){
			slsq = "";
		}
		regBusSfService.save(regBusSf);
		addMessage(redirectAttributes, "保存收费信息成功");
		return "redirect:"+Global.getAdminPath()+"/reg/bus/regBusSf/?repage&ywh="+ywh+"&tzrxm="+tzrxm+"&slsq="+slsq+"&djlx="+djlx;
	}
	
	/***
	* @Title: sfSave 
	* @Description: 收费系统自动维护
	* @param @param regBusBdcqzsdjxx
	* @param @param request
	* @param @param response
	* @param @param model
	* @param @return    设定文件 
	* @return String    返回类型 
	* @throws
	 */
	@RequestMapping(value = "sfsave")
	public String sfSave(RegBusSf regBusSf, Model model, RedirectAttributes redirectAttributes, HttpServletRequest request) {
		String ywh = request.getParameter("ywh");
		String djlx = request.getParameter("djlx");
		String tzrxm = request.getParameter("tzrxm");
		String slsq = request.getParameter("slsq");
		String zzsl = request.getParameter("zzsl");
		String yszzje = request.getParameter("yszzje");
		String sszzje = request.getParameter("sszzje");
		String fzzsl = request.getParameter("fzzsl");
		String ysfzzje = request.getParameter("ysfzzje");
		String ssfzzje = request.getParameter("ssfzzje");
		String jbzzsl = request.getParameter("jbzzsl");
		String ysjbzzje = request.getParameter("ysjbzzje");
		String ssjbzzje = request.getParameter("ssjbzzje");
		String jbfzzsl = request.getParameter("jbfzzsl");
		String ysjbfzzje = request.getParameter("ysjbfzzje");
		String ssjbfzzje = request.getParameter("ssjbfzzje");
		String gyrsl = request.getParameter("gyrsl");
		String ysgbf = request.getParameter("ysgbf");
		String ssgbf = request.getParameter("ssgbf");
		if(StringUtils.isBlank(request.getParameter("slsq"))){
			slsq = "";
		}
		regBusSfService.save(regBusSf);
		RegBusSfSub regBusSfSub = new RegBusSfSub();
		regBusSf.setYwh(ywh);
		List<RegBusSf> findList = regBusSfService.findList(regBusSf);
		if(findList.size() > 0){
			regBusSf = findList.get(0);
			regBusSfSub.setMainId(regBusSf);
			List<RegBusSfSub> findList2 = regBusSfSubDao.findList(regBusSfSub);
			if(findList2.size() > 0){
				for (int i = 0; i < findList2.size(); i++) {
					regBusSfSub = findList2.get(i);
					if(regBusSfSub.getSfkmmc().equals("1")){
						regBusSfSub.setSfjs(zzsl);
						regBusSfSub.setYsje(yszzje);
						regBusSfSub.setSsje(sszzje);
					}else if(regBusSfSub.getSfkmmc().equals("2")){
						regBusSfSub.setSfjs(fzzsl);
						regBusSfSub.setYsje(ysfzzje);
						regBusSfSub.setSsje(ssfzzje);
					}else if(regBusSfSub.getSfkmmc().equals("3")){
						regBusSfSub.setSfjs(jbzzsl);
						regBusSfSub.setYsje(ysjbzzje);
						regBusSfSub.setSsje(ssjbzzje);
					}else if(regBusSfSub.getSfkmmc().equals("4")){
						regBusSfSub.setSfjs(jbfzzsl);
						regBusSfSub.setYsje(ysjbfzzje);
						regBusSfSub.setSsje(ssjbfzzje);
					}else if(regBusSfSub.getSfkmmc().equals("5")){
						regBusSfSub.setSfjs(gyrsl);
						regBusSfSub.setYsje(ysgbf);
						regBusSfSub.setSsje(ssgbf);
					}
					regBusSfSub.preUpdate();
					regBusSfSubDao.update(regBusSfSub);
				}
			}else {
				regBusSfSub.setId(null);
				regBusSfSub.setSflx("1");
				regBusSfSub.setSfkmmc("1");
				regBusSfSub.setSfjs(zzsl);
				regBusSfSub.setYsje(yszzje);
				regBusSfSub.setSsje(sszzje);
				regBusSfSub.preInsert();
				regBusSfSubDao.insert(regBusSfSub);
				regBusSfSub.setSfkmmc("2");
				regBusSfSub.setSfjs(fzzsl);
				regBusSfSub.setYsje(ysfzzje);
				regBusSfSub.setSsje(ssfzzje);
				regBusSfSub.preInsert();
				regBusSfSubDao.insert(regBusSfSub);
				regBusSfSub.setSfkmmc("3");
				regBusSfSub.setSfjs(jbzzsl);
				regBusSfSub.setYsje(ysjbzzje);
				regBusSfSub.setSsje(ssjbzzje);
				regBusSfSub.preInsert();
				regBusSfSubDao.insert(regBusSfSub);
				regBusSfSub.setSfkmmc("4");
				regBusSfSub.setSfjs(jbfzzsl);
				regBusSfSub.setYsje(ysjbfzzje);
				regBusSfSub.setSsje(ssjbfzzje);
				regBusSfSub.preInsert();
				regBusSfSubDao.insert(regBusSfSub);
				regBusSfSub.setSfkmmc("5");
				regBusSfSub.setSfjs(gyrsl);
				regBusSfSub.setYsje(ysgbf);
				regBusSfSub.setSsje(ssgbf);
				regBusSfSub.preInsert();
				regBusSfSubDao.insert(regBusSfSub);
			}
		}
		addMessage(redirectAttributes, "保存收费信息成功");
		return "redirect:"+Global.getAdminPath()+"/reg/bus/regBusSf/?repage&ywh="+ywh+"&tzrxm="+tzrxm+"&slsq="+slsq+"&djlx="+djlx;
	}
	
	@RequestMapping(value = "delete")
	public String delete(RegBusSf regBusSf, RedirectAttributes redirectAttributes, HttpServletRequest request) {
		String slsq = request.getParameter("slsq");
		if(StringUtils.isBlank(request.getParameter("slsq"))){
			slsq = "";
		}
		String ywh = request.getParameter("ywh");
		String tzrxm = request.getParameter("tzrxm");
		String djlx = request.getParameter("djlx");
		regBusSfService.delete(regBusSf);
		addMessage(redirectAttributes, "删除收费信息成功");
		return "redirect:"+Global.getAdminPath()+"/reg/bus/regBusSf/?repage&ywh="+ywh+"&slsq="+slsq+"&tzrxm="+tzrxm+"&djlx="+djlx;
	}

	/**
	 * 判断是否维护收费信息
	 * @param request
	 * @return
	 */
	@RequiresPermissions("reg:bus:regBusSf:view")
	@RequestMapping(value = "flagSfxx")
	@ResponseBody
	public ModelMap flagSfxx(HttpServletRequest request) {
		ModelMap modelMap = new ModelMap();
		String ywh = request.getParameter("ywh");
		modelMap.put("success", 1);
		RegBusSf regBusSf = new RegBusSf();
		regBusSf.setYwh(ywh);
		List<RegBusSf> findList = regBusSfService.findList(regBusSf);
		if(findList.size() > 0){
			modelMap.put("success", 0);
		}
		return modelMap;
	}
}