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

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.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.StringUtils;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBasePerson;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusBdcqzsdjxx;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusQlr;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusYwr;
import com.thinkgem.jeesite.modules.reg.service.base.RegBasePersonService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusBdcqzsdjxxService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusYwrService;
import com.thinkgem.jeesite.modules.sys.utils.DictUtils;

/**
 * 新义务人信息维护Controller
 * @author xuyg
 * @version 2016-04-14
 */
@Controller
@RequestMapping(value = "${adminPath}/reg/bus/regBusYwr")
public class RegBusYwrController extends BaseController {

	@Autowired
	private RegBusYwrService regBusYwrService;
	@Autowired
	private RegBasePersonService regBasePersonService;
	@Autowired
	private RegBusBdcqzsdjxxService regBusBdcqzsdjxxService;
	
	
	@ModelAttribute
	public RegBusYwr get(@RequestParam(required=false) String id) {
		RegBusYwr entity = null;
		if (StringUtils.isNotBlank(id)){
			entity = regBusYwrService.get(id);
		}
		if (entity == null){
			entity = new RegBusYwr();
		}
		return entity;
	}
	
	@RequiresPermissions("reg:bus:regBusYwr:view")
	@RequestMapping(value = {"list", ""})
	public String list(RegBusYwr regBusYwr, HttpServletRequest request, HttpServletResponse response, Model model) {
		Page<RegBusYwr> page = regBusYwrService.findPage(new Page<RegBusYwr>(request, response), regBusYwr); 
		model.addAttribute("page", page);
		return "modules/reg/bus/regBusYwrList";
	}

	@RequiresPermissions("reg:bus:regBusYwr:view")
	@RequestMapping(value = "form")
	public String form(RegBusYwr regBusYwr, Model model) {
		model.addAttribute("regBusYwr", regBusYwr);
		return "modules/reg/bus/regBusYwrForm";
	}

	/**
	 * 判断多宗地或者多房屋的义务人是否一致
	 * @param request
	 * @return
	 */
	@RequiresPermissions("reg:bus:regBusBdcqzsdjxx:view")
	@RequestMapping(value = "isFlag")
	@ResponseBody
	public String isFlag(HttpServletRequest request,String ywhs,String dyxxdjId) {
		String id = "";
		if(dyxxdjId.equals("")){
			id = request.getParameter("ids");
		}else {
			id = dyxxdjId;
		}
		String bdcdyh = request.getParameter("bdcdyh");
		String[] ids = id.split(";");
		String success = "";
		for (int i = 0; i < ids.length; i++) {
			String ywr1size = "";
			String ywrsize = "";
			RegBusBdcqzsdjxx regBusBdcqzsdjxx = new RegBusBdcqzsdjxx();
			regBusBdcqzsdjxx = regBusBdcqzsdjxxService.get(ids[i]);
			RegBusYwr regBusYwr = new RegBusYwr();
			RegBusYwr regBusYwr1 = new RegBusYwr();
			if(regBusBdcqzsdjxx != null){
				if(!ywhs.equals("") && !bdcdyh.equals("")){
					regBusYwr.setYwh(ywhs);
					regBusYwr.setBdcdyh(bdcdyh);
					List<RegBusYwr> listregBusYwr = regBusYwrService.findList(regBusYwr);
					ywrsize = listregBusYwr.size()+"";
					regBusBdcqzsdjxx = regBusBdcqzsdjxxService.get(ids[i]);
					regBusYwr1.setYwh(regBusBdcqzsdjxx.getYwh());
					regBusYwr1.setBdcdyh(regBusBdcqzsdjxx.getBdcdyh());
					List<RegBusYwr> listregBusYwr1 = regBusYwrService.findList(regBusYwr1);
					String flag = "";
					ywr1size = listregBusYwr1.size()+"";
					if(listregBusYwr1.size() > 0){
						for (int j = 0; j < listregBusYwr1.size(); j++) {
							regBusYwr1 = listregBusYwr1.get(j);
							regBusYwr.setPcode(regBusYwr1.getPcode());
							List<RegBusYwr> listregBusYwrtmp = regBusYwrService.findList(regBusYwr);
							if(listregBusYwrtmp.size() == 0){
								flag = "1";
								break;
							}
						}
					}
					if(ywrsize.equals("0") || !ywrsize.equals(ywr1size) || flag.equals("1")){
						success = "0";
						break;
					}else {
						success = "1";
					}
				}else {
					regBusYwr.setYwh(regBusBdcqzsdjxx.getYwh());
					regBusYwr.setBdcdyh(regBusBdcqzsdjxx.getBdcdyh());
					List<RegBusYwr> listregBusYwr = regBusYwrService.findList(regBusYwr);
					ywrsize = listregBusYwr.size()+"";
					if(i > 0){
						regBusBdcqzsdjxx = regBusBdcqzsdjxxService.get(ids[i-1]);
						regBusYwr1.setYwh(regBusBdcqzsdjxx.getYwh());
						regBusYwr1.setBdcdyh(regBusBdcqzsdjxx.getBdcdyh());
						List<RegBusYwr> listregBusYwr1 = regBusYwrService.findList(regBusYwr1);
						String flag = "";
						ywr1size = listregBusYwr1.size()+"";
						if(listregBusYwr1.size() > 0){
							for (int j = 0; j < listregBusYwr1.size(); j++) {
								regBusYwr1 = listregBusYwr1.get(j);
								regBusYwr.setPcode(regBusYwr1.getPcode());
								List<RegBusYwr> listregBusYwrtmp = regBusYwrService.findList(regBusYwr);
								if(listregBusYwrtmp.size() == 0){
									flag = "1";
									break;
								}
							}
						}
						if(ywrsize.equals("0") || !ywrsize.equals(ywr1size) || flag.equals("1")){
							success = "0";
							break;
						}else {
							success = "1";
						}
					}
				}
			}
		}
		return success;
	}
	
	/**
	 * 房屋更名信息查询
	 * @param regBusBdcqzsdjxx
	 * @param request
	 * @param response
	 * @param model
	 * @return
	 */
	@RequiresPermissions("reg:bus:regBusYwr:view")
	@RequestMapping(value = "ywrfwgmdjlist")
	public String ywrfwgmdjlist(RegBusYwr regBusYwr, HttpServletRequest request, HttpServletResponse response, Model model) {
		String ywh = request.getParameter("YWH");
		String listView =  request.getParameter("LISTVIEWS");
		if(StringUtils.isNotBlank(ywh)){
			regBusYwr.setYwh(ywh);
			model.addAttribute("YWH", ywh);
		}
		if(StringUtils.isNotBlank(listView)){
			model.addAttribute("LISTVIEWS", listView);
		}
		Page<RegBusYwr> page = regBusYwrService.findPage(new Page<RegBusYwr>(request, response), regBusYwr); 
		model.addAttribute("page", page);
		return "modules/reg/bus/regBusywrfwgmdjList";
	}
	
	/**
	 * 房屋更名信息查询
	 * @param regBusBdcqzsdjxx
	 * @param request
	 * @param response
	 * @param model
	 * @return
	 */
	@RequiresPermissions("reg:bus:regBusYwr:view")
	@RequestMapping(value = "ywrfwgmqdjlist")
	public String ywrfwgmqdjlist(RegBusYwr regBusYwr, HttpServletRequest request, HttpServletResponse response, Model model) {
		String ywh = request.getParameter("YWH");
		String newywh = request.getParameter("newywh");
		String listView =  request.getParameter("LISTVIEWS");
		if(StringUtils.isNotBlank(ywh)){
			regBusYwr.setYwh(ywh);
			model.addAttribute("YWH", ywh);
		}
		if(StringUtils.isNotBlank(newywh)){
			model.addAttribute("newywh", newywh);
		}
		if(StringUtils.isNotBlank(listView)){
			model.addAttribute("LISTVIEWS", listView);
		}
		Page<RegBusYwr> page = regBusYwrService.findPage(new Page<RegBusYwr>(request, response), regBusYwr); 
		model.addAttribute("page", page);
		return "modules/reg/bus/regBusywrfwgmqdjList";
	}
	
	/**
	 * 房屋更名信息查询
	 * @param regBusBdcqzsdjxx
	 * @param request
	 * @param response
	 * @param model
	 * @return
	 */
	@RequiresPermissions("reg:bus:regBusYwr:view")
	@RequestMapping(value = "ywrdyfwgmdjlist")
	public String ywrdyfwgmdjlist(RegBusYwr regBusYwr, HttpServletRequest request, HttpServletResponse response, Model model) {
		String ywh = request.getParameter("YWH");
		String newywh = request.getParameter("newywh");
		String listView =  request.getParameter("LISTVIEWS");
		if(StringUtils.isNotBlank(ywh)){
			regBusYwr.setYwh(ywh);
			model.addAttribute("YWH", ywh);
		}
		if(StringUtils.isNotBlank(newywh)){
			model.addAttribute("newywh", newywh);
		}
		if(StringUtils.isNotBlank(request.getParameter("djlx"))){
			model.addAttribute("djlx", request.getParameter("djlx"));
		}
		if(StringUtils.isNotBlank(request.getParameter("bdcdyh"))){
			regBusYwr.setBdcdyh(request.getParameter("bdcdyh"));
		}
		if(StringUtils.isNotBlank(listView)){
			model.addAttribute("LISTVIEWS", listView);
		}
		Page<RegBusYwr> page = regBusYwrService.findPage(new Page<RegBusYwr>(request, response), regBusYwr); 
		model.addAttribute("page", page);
		return "modules/reg/bus/regBusywrdyfwgmdjList";
	}
	/**
	 * 房屋抵押更名后信息查询
	 * @param regBusBdcqzsdjxx
	 * @param request
	 * @param response
	 * @param model
	 * @return
	 */
	@RequiresPermissions("reg:bus:regBusYwr:view")
	@RequestMapping(value = "ywrhfwgmdjlist")
	public String ywrhfwgmdjlist(RegBusYwr regBusYwr, HttpServletRequest request, HttpServletResponse response, Model model) {
		String ywh = request.getParameter("YWH");
		String listView =  request.getParameter("LISTVIEWS");
		if(StringUtils.isNotBlank(ywh)){
			regBusYwr.setYwh(ywh);
			model.addAttribute("YWH", ywh);
		}
		if(StringUtils.isNotBlank(listView)){
			model.addAttribute("LISTVIEWS", listView);
		}
		Page<RegBusYwr> page = regBusYwrService.findPage(new Page<RegBusYwr>(request, response), regBusYwr); 
		model.addAttribute("page", page);
		return "modules/reg/bus/regBusywrhdyfwgmdjList";
	}
	
	/**
	 * 义务人更名from
	 * @param regBusQlr
	 * @param model
	 * @param request
	 * @return
	 */
	@RequiresPermissions("reg:bus:regBusYwr:view")
	@RequestMapping(value = "ywrgmform")
	public String ywrgmform(RegBusYwr regBusYwr, Model model, HttpServletRequest request) {
		model.addAttribute("regBusYwr", regBusYwr);
		String ids = request.getParameter("id");
		model.addAttribute("oldid", ids);
		String views = "";
		views = "modules/reg/bus/regBusYwrgmForm";
		//计算当前顺序号【注意:只有新增时才需要这个值】
		if(StringUtils.isBlank(regBusYwr.getId())){
			model.addAttribute("SXH", getYwrmcOrderNumber(request.getParameter("YWH")));
		}
		//查看标示
		if(StringUtils.isNotBlank(request.getParameter("VIEWS"))){
			model.addAttribute("VIEWS", request.getParameter("VIEWS"));
		}
		//业务号
		if(StringUtils.isNotBlank(request.getParameter("YWH"))){
			model.addAttribute("YWH", request.getParameter("YWH"));
			model.addAttribute("BDCDYH", request.getParameter("BDCDYH"));
		}
		if(StringUtils.isNotBlank(request.getParameter("djlx"))){
			model.addAttribute("djlx", request.getParameter("djlx"));
		}
		System.out.println();request.getParameter("YWH");
		//修改
		if(StringUtils.isNotBlank(request.getParameter("XG"))){
			model.addAttribute("XG", "1");
		}
		if(StringUtils.isNotBlank(request.getParameter("dybj"))){
			views = "modules/reg/bus/regBusYwrdygmForm";
		}
		return views;
	}
	
	/**
	 * 义务人添加权利人信息
	 * @param regBusYwr
	 * @param model
	 * @param request
	 * @return
	 */
	@RequiresPermissions("reg:bus:regBusYwr:view")
	@RequestMapping(value = "gmyrform")
	public String gmyrform(RegBusYwr regBusYwr, Model model, HttpServletRequest request) {
		String views="";
		views = "modules/reg/bus/regBusYwrgmForm";
		Map<String,String> map = new HashMap<String,String>();
		if(StringUtils.isNotBlank(request.getParameter("YWH"))){
			model.addAttribute("YWH", request.getParameter("YWH"));
			model.addAttribute("BDCDYH", request.getParameter("BDCDYH"));
		}
		if(StringUtils.isNotBlank(request.getParameter("XG"))){
			model.addAttribute("XG", "1");
		}
		if(StringUtils.isNotBlank(request.getParameter("oldid"))){
			model.addAttribute("oldid", request.getParameter("oldid"));
		}
		//计算当前顺序号【注意:只有新增时才需要这个值】
		if(StringUtils.isBlank(request.getParameter("optype"))){
			model.addAttribute("SXH", getYwrmcOrderNumber(request.getParameter("YWH")));
		}
		String ids = request.getParameter("ids");
		RegBasePerson person = new RegBasePerson();
		person = regBasePersonService.get(ids);
		regBusYwr.setQlrmc(person.getRymc());
		regBusYwr.setZjzl(person.getZjzl());
		regBusYwr.setDz(person.getDz());
		regBusYwr.setZjh(person.getZjh());
		regBusYwr.setHjszss(person.getHjszss());
		regBusYwr.setXb(person.getXb());
		regBusYwr.setDh(person.getDh());
		regBusYwr.setYb(person.getYb());
		regBusYwr.setGzdw(person.getGzdw());
		regBusYwr.setDzyj(person.getDzyj());
		regBusYwr.setDlrmc(person.getDlrymc());
		regBusYwr.setDljgmc(person.getDljg());
		regBusYwr.setDlrdh(person.getDlrydh());
		regBusYwr.setBz(person.getBz());
		regBusYwr.setQlrlx(person.getRylx());
		regBusYwr.setHjszss(person.getHjszss());
		regBusYwr.setPcode(person.getPcode());
		regBusYwr.setSfczr(DictUtils.getDictValue("是", "yes_no",""));
		regBusYwr.setId("");
		if(StringUtils.isNotBlank(person.getRymc())){
			map.put("QLR", person.getRymc());
		}
		if(StringUtils.isNotBlank(person.getDz())){
			map.put("ZL", person.getDz());
		}
		model.addAttribute("pcode", person.getPcode());
		model.addAttribute("maps", map);
		model.addAttribute("regBusYwr", regBusYwr);
		if(StringUtils.isNoneBlank(request.getParameter("dybj"))){
			views = "modules/reg/bus/regBusYwrdygmForm";
		}
		return views;
	}
	
	/**
	 * 义务人更名保存
	 * @param regBusYwr
	 * @param model
	 * @param request
	 * @param redirectAttributes
	 * @return
	 */
	@RequiresPermissions("reg:bus:regBusYwr:edit")
	@RequestMapping(value = "gmsave")
	@ResponseBody
	public ModelMap gmsave(RegBusYwr regBusYwr, Model model, HttpServletRequest request, RedirectAttributes redirectAttributes) {
		ModelMap  modelMap = new ModelMap();
		modelMap.put("success", 1);
		String ywhStr= request.getParameter("YWH");//当前业务号
		//获取单元号
		String dyh ="";
		regBusYwr.setYwh(ywhStr);
		//业务号跟权利人关联 
		Map<String,String> map = new HashMap<String,String>();
		Object djxl = request.getParameter("DJLX");
//		String pcode = request.getParameter("pcode");
//		if(StringUtils.isNotBlank(pcode)){
//			regBusYwr.setPcode(pcode);
//		}
		System.out.println(request.getParameter("oldid"));
		//获取要更名的业务数据
		RegBusYwr ywrshow = regBusYwrService.get(request.getParameter("oldid"));
		String sxh = ywrshow.getSxh();
		String ysdm = ywrshow.getYsdm();
		if(sxh.equals("1")){
			RegBusBdcqzsdjxx regBusBdcqzsdjxxtmp = new RegBusBdcqzsdjxx();
			regBusBdcqzsdjxxtmp.setYwh(ywhStr);
			List<RegBusBdcqzsdjxx> findList = regBusBdcqzsdjxxService.findList(regBusBdcqzsdjxxtmp);
			if(findList.size()>0){
				dyh = findList.get(0).getBdcdyh();
				//同步更新已登记信息权利人
				for(int i=0;i<findList.size();i++){
					regBusBdcqzsdjxxtmp = findList.get(i);
					regBusBdcqzsdjxxtmp.setQlrmc(regBusYwr.getQlrmc());
					regBusBdcqzsdjxxtmp.setGyqk( DictUtils.getDictLabel(regBusYwr.getGyfs(),"reg_bus_gyfs", ""));
					regBusBdcqzsdjxxService.save(regBusBdcqzsdjxxtmp);
				}
			}
		}
		//通过oldid要更名的业务数据是否与当前业务号一样,一样就直接更新此条数据,不一样说明还未对以前的权利人进行更名则直接新增
		if(!ywrshow.getYwh().equals(ywhStr)){
				RegBusYwr yw = new RegBusYwr();
				yw.setPcode(regBusYwr.getPcode());
				yw.setYwh(regBusYwr.getYwh());
				List<RegBusYwr>  qllist = regBusYwrService.findList(yw);
				if(qllist.size() <= 0){
					//首先获取权利人 ID个数
					int qlrmcOrderNumber = 0;
					RegBusYwr ywr2 = new RegBusYwr();
					ywr2.setYwh(regBusYwr.getYwh());
					List<RegBusYwr> ywrlist = regBusYwrService.findList(ywr2);
					int count = ywrlist.size();
					if(count > 0){
						qlrmcOrderNumber = ywrlist.size() + 1;
					}else{
						 qlrmcOrderNumber = 1;
					}
					regBusYwr.setSxh(String.valueOf(qlrmcOrderNumber));
					regBusYwr.setYsdm("2003000000");
					regBusYwr.setBdcdyh(dyh);
					regBusYwrService.save(regBusYwr);
					addMessage(redirectAttributes, "保存权利人信息成功");
					modelMap.put("success", 0);
				}else{
					if(qllist.size() > 0){
						regBusYwr.setId(qllist.get(0).getId());
						regBusYwr.setBdcdyh(dyh);
						regBusYwr.setSxh(qllist.get(0).getSxh());
						regBusYwr.setGyqk(DictUtils.getDictLabel(regBusYwr.getGyfs(),"reg_bus_gyfs", ""));
						regBusYwrService.save(regBusYwr);
						addMessage(redirectAttributes, "保存权利人信息成功");
						modelMap.put("success", 0);
					}
				} 
				
				//修改人员信息的状态为已引用
				if(StringUtils.isNotBlank(regBusYwr.getZjh())){
					RegBasePerson regBasePerson = new RegBasePerson();
					regBasePerson.setZjh(regBusYwr.getZjh());
					regBasePerson.setZjzl(regBusYwr.getZjzl());
					List<RegBasePerson> findPersonList = regBasePersonService.findList(regBasePerson);
					if(findPersonList.size()>0){
						regBasePerson = findPersonList.get(0);
						regBasePerson.setIsaudit("2");
						regBasePersonService.save(regBasePerson);
						modelMap.put("success", 0);
					}
				}
		}else{
			ywrshow = regBusYwr;
			ywrshow.setSxh(sxh);
			ywrshow.setYsdm(ysdm);
			ywrshow.setBdcdyh(dyh);
			ywrshow.setId(request.getParameter("oldid"));
			regBusYwrService.save(ywrshow);
			modelMap.put("success", 0);
		}
		return modelMap;
	}
	
	@RequiresPermissions("reg:bus:regBusYwr:edit")
	@RequestMapping(value = "save")
	public String save(RegBusYwr regBusYwr, Model model, RedirectAttributes redirectAttributes) {
		if (!beanValidator(model, regBusYwr)){
			return form(regBusYwr, model);
		}
		regBusYwrService.save(regBusYwr);
		//修改人员信息的状态为已引用
		if(StringUtils.isNotBlank(regBusYwr.getZjh())){
			RegBasePerson regBasePerson = new RegBasePerson();
			regBasePerson.setZjh(regBusYwr.getZjh());
			regBasePerson.setZjzl(regBusYwr.getZjzl());
			List<RegBasePerson> findPersonList = regBasePersonService.findList(regBasePerson);
			if(findPersonList.size()>0){
				regBasePerson = findPersonList.get(0);
				regBasePerson.setIsaudit("2");
				regBasePersonService.save(regBasePerson);
			}
		}
		addMessage(redirectAttributes, "保存新义务人信息成功");
		return "redirect:"+Global.getAdminPath()+"/reg/bus/regBusYwr/?repage";
	}
	
	@RequiresPermissions("reg:bus:regBusYwr:edit")
	@RequestMapping(value = "delete")
	public String delete(RegBusYwr regBusYwr, RedirectAttributes redirectAttributes) {
		regBusYwrService.delete(regBusYwr);
		addMessage(redirectAttributes, "删除新义务人信息成功");
		return "redirect:"+Global.getAdminPath()+"/reg/bus/regBusYwr/?repage";
	}
	
	/**
	 * 更名义务人删除
	 * @param regBusYwr
	 * @param redirectAttributes
	 * @param request
	 * @return
	 */
	@RequiresPermissions("reg:bus:regBusYwr:edit")
	@RequestMapping(value = "deletegmywr")
	public String deletegmywr(RegBusYwr regBusYwr, RedirectAttributes redirectAttributes, HttpServletRequest request) {
		if(StringUtils.isNotBlank(request.getParameter("YWH"))){
			regBusYwrService.delete(regBusYwr); 
		}
		addMessage(redirectAttributes, "删除权利人信息成功!");
		return "redirect:"+Global.getAdminPath()+"/reg/bus/regBusYwr/ywrfwgmdjlist?YWH="+request.getParameter("YWH");
	}
	
	/***
	* @Title: getQlrmcOrderNumber 
	* @Description: 通过业务号获取当前权利人在此业务中的顺序号 
	* @param @param ywhStr
	* @param @return    设定文件 
	* @return String    返回类型 
	* @throws
	 */
	public int getYwrmcOrderNumber(String ywhStr){
		int ywrmcOrderNumber = 1;//默认为001
		if(StringUtils.isBlank(ywhStr)){
			return ywrmcOrderNumber;
		}
		//首先获取权利人 ID个数
		RegBusYwr ywr = new RegBusYwr();
		ywr.setYwh(ywhStr);
		List<RegBusYwr> ywrlist = regBusYwrService.findList(ywr);
		int count = ywrlist.size();
		if(count > 0){
			ywrmcOrderNumber = ywrlist.size() + 1;
		}
		return ywrmcOrderNumber;
	}
}