f825e37691ada85ed022e5aee2111e50486410cd.svn-base 12.1 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
/**
 * Copyright © 2015-2018 ODM All rights reserved.
 */
package com.thinkgem.jeesite.modules.reg.service.bus;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.google.common.collect.Lists;
import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;
import com.thinkgem.jeesite.common.service.ServiceException;
import com.thinkgem.jeesite.modules.reg.dao.bus.RegBusQlrDao;
import com.thinkgem.jeesite.modules.reg.dao.bus.RegBusQlrRelationYwhDao;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBaseH;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusQlr;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusQlrRelationYwh;
import com.thinkgem.jeesite.modules.reg.service.base.RegBaseHService;
import com.thinkgem.jeesite.modules.sys.service.InterSiService;

/**
 * 权利人信息维护Service
 * @author xuyg
 * @version 2015-10-15
 */
@Service
@Transactional(readOnly = true)
public class RegBusQlrService extends CrudService<RegBusQlrDao, RegBusQlr> {
	@Autowired
	private RegBusQlrRelationYwhDao regBusQlrRelationYwhDao;
	@Autowired
	private InterSiService siService;
	@Autowired
	private RegBaseHService hService;
	
	public RegBusQlr get(String id) {
		return super.get(id);
	}
	public List<RegBusQlr> findByYwh(String ywh) {
		return super.findByYwh(ywh);
	}
	public List<RegBusQlr> findList(RegBusQlr regBusQlr) {
		return super.findList(regBusQlr);
	}
	public List<RegBusQlr> findList_1(RegBusQlr regBusQlr) {
		regBusQlr.setDelFlag("0");
		return super.findList_1(regBusQlr);
	}
	public List<RegBusQlr> findqlrgmList(RegBusQlr regBusQlr) {
		return dao.findqlrgmList(regBusQlr);
	}
	public List<RegBusQlr> findListdyh(RegBusQlr regBusQlr) {
		return dao.findListdyh(regBusQlr);
	}
	public List<RegBusQlr> findListSxh(RegBusQlr regBusQlr) {
		return super.findListSxh(regBusQlr);
	}
	
	public Page<RegBusQlr> findPage(Page<RegBusQlr> page, RegBusQlr regBusQlr) {
		return super.findPage(page, regBusQlr);
	}
	public Page<RegBusQlr> findPageSxh(Page<RegBusQlr> page, RegBusQlr regBusQlr) {
		return super.findPageSxh(page, regBusQlr);
	}
	
	public Page<RegBusQlr> findPage_1(Page<RegBusQlr> page, RegBusQlr regBusQlr) {
		return super.findPage_1(page, regBusQlr);
	}
	
	@Transactional(readOnly = false)
	public void save(RegBusQlr regBusQlr, Map<String,String> map) {
		super.save(regBusQlr);
		//为空情况下,填入刚刚生成的UUID
		if(map.size()>0 && StringUtils.isBlank(map.get("qlrid"))){
			map.put("qlrid", regBusQlr.getId());
			dao.insertRelationYwh(map);
		}
	}
	
	@Transactional(readOnly = false)
	public void saveqlr(RegBusQlr regBusQlr) {
		super.save(regBusQlr);
	}
	
	/**
	* @Title: relationYwh 
	* @Description: 权利人关联业务号
	* @param @param regBusQlr    设定文件 
	* @return void    返回类型 
	* @throws
	 */
	@Transactional(readOnly = false)
	public void insertRelationYwh(Map<String,String> map){
		dao.insertRelationYwh(map);
	}
	/***
	* @Title: updateRelationYwhIsuse 
	* @Description: 通过业务号和权利人ID更新 isuse字段为 0
	* @param @param map    设定文件 
	* @return void    返回类型 
	* @throws
	 */
	@Transactional(readOnly = false)
	public void updateRelationYwhIsuse(Map<String,String> map){
		dao.updateRelationYwhIsuse(map);
	}
	
	@Transactional(readOnly = false)
	public void delete(RegBusQlr regBusQlr) {
		super.delete(regBusQlr);
	}
	@Transactional(readOnly = false)
	public void deleteywh(String ywh) {
		dao.deleteywh(ywh);
	}
	@Transactional(readOnly = false)
	public void deleteqlr(RegBusQlr regBusQlr) {
		dao.deleteqlr(regBusQlr);
	}
	/***
	* @Title: getRegBusQlrByYwh 
	* @Description: 通过业务号获取权利人对象集合
	* @param @param ywhStr
	* @param @return    设定文件 
	* @return List<RegBusQlr>    返回类型 
	* @throws
	 */
	public List<RegBusQlr> getRegBusQlrByYwh(String ywhStr){
		List<RegBusQlr> regBusQlrList = new ArrayList<RegBusQlr>();
		if(StringUtils.isBlank(ywhStr)){
			return regBusQlrList;
		}
		//首先获取权利人 ID
		List<String> qlrIDList = new ArrayList<String>(); 
		RegBusQlrRelationYwh regBusQlrRelationYwh = new RegBusQlrRelationYwh();
		regBusQlrRelationYwh.setYwh(ywhStr);
		List<RegBusQlrRelationYwh> regBusQlrRelationYwhList = regBusQlrRelationYwhDao.findList(regBusQlrRelationYwh);
		if(regBusQlrRelationYwhList.size()>0){
			for(int i=0; i<regBusQlrRelationYwhList.size();i++){
				qlrIDList.add(regBusQlrRelationYwhList.get(i).getQlrid());
			}
		}
		//通过权利人ID获取权利人实体list
		if(qlrIDList.size()>0){
			for(int j=0; j<qlrIDList.size();j++){
				regBusQlrList.add(this.get(qlrIDList.get(j)));
			}
		}
		return regBusQlrList;
	}
	
	/***
	* @Title: getRegBusQlrmcByYwh 
	* @Description: 通过业务号获取权利人名称
	* @param @param ywhStr
	* @param @return    设定文件 
	* @return List<RegBusQlr>    返回类型 
	* @throws
	 */
	public String getRegBusQlrmcByYwh(String ywhStr){
		String qlrmc = "";
		if(StringUtils.isBlank(ywhStr)){
			return qlrmc;
		}
		List<RegBusQlr> regBusQlrList = this.getRegBusQlrByYwh(ywhStr);
		//开始构造权利人姓名字符串
		if(regBusQlrList.size()>0){
			for(int k=0; k<regBusQlrList.size(); k++){
				qlrmc += regBusQlrList.get(k).getQlrmc() + " ";
			}
		}
		return qlrmc;
	}
	
	/***
	* @Title: getRegBusZjzlByYwh 
	* @Description: 通过业务号获取证件种类
	* @param @param ywhStr
	* @param @return    设定文件 
	* @return zjzl    返回类型 
	* @throws
	 */
	public String getRegBusZjzlByYwh(String ywhStr){
		String zjzl = "";
		if(StringUtils.isBlank(ywhStr)){
			return zjzl;
		}
		List<RegBusQlr> regBusQlrList = this.getRegBusQlrByYwh(ywhStr);
		//开始构造权利人姓名字符串
		//if(regBusQlrList.size()>0){
			//for(int k=0; k<regBusQlrList.size(); k++){
				zjzl = regBusQlrList.get(0).getZjzl();//默认取一个证件类型
			//}
		//}
		return zjzl;
	}
	
	/***
	* @Title: getRegBusZjhmByYwh 
	* @Description: 通过业务号获取证件号码
	* @param @param ywhStr
	* @param @return    设定文件 
	* @return zjhm    返回类型 
	* @throws
	 */
	public String getRegBusZjhmByYwh(String ywhStr){
		String zjhm = "";
		if(StringUtils.isBlank(ywhStr)){
			return zjhm;
		}
		List<RegBusQlr> regBusQlrList = this.getRegBusQlrByYwh(ywhStr);
		//开始构造权利人姓名字符串
		//if(regBusQlrList.size()>0){
			//for(int k=0; k<regBusQlrList.size(); k++){
				zjhm = regBusQlrList.get(0).getZjh();//默认取一个证件类型
			//}
		//}
		return zjhm;
	}
	
	/***
	* @Title: getRegBusGyqkByYwh 
	* @Description: 通过业务号获取共有情况
	* @param @param ywhStr
	* @param @return    设定文件 
	* @return gyqk    返回类型 
	* @throws
	 */
	public String getRegBusGyqkByYwh(String ywhStr){
		String gyqk = "";
		if(StringUtils.isBlank(ywhStr)){
			return gyqk;
		}
		List<RegBusQlr> regBusQlrList = this.getRegBusQlrByYwh(ywhStr);
		//开始构造权利人姓名字符串
		//if(regBusQlrList.size()>0){
			//for(int k=0; k<regBusQlrList.size(); k++){
				gyqk = regBusQlrList.get(0).getGyqk();//默认取一个共有情况
			//}
		//}
		return gyqk;
	}
	
	/***
	* @Title: getRegBusGyqkByYwh 
	* @Description: 通过业务号获取权利人类型
	* @param @param ywhStr
	* @param @return    设定文件 
	* @return qlrlx    返回类型 
	* @throws
	 */
	public String getRegBusQlrlxByYwh(String ywhStr){
		String qlrlx = "";
		if(StringUtils.isBlank(ywhStr)){
			return qlrlx;
		}
		List<RegBusQlr> regBusQlrList = this.getRegBusQlrByYwh(ywhStr);
		//开始构造权利人姓名字符串
		//if(regBusQlrList.size()>0){
			//for(int k=0; k<regBusQlrList.size(); k++){
				qlrlx = regBusQlrList.get(0).getQlrlx();//默认取一个权利人类型
			//}
		//}
		return qlrlx;
	}
	
	/***
	* @Title: getRegBusYwrmcByYwh 
	* @Description: 通过业务号获取义务人名称
	* @param @param ywhStr
	* @param @return    设定文件 
	* @return ywrmc   返回类型 
	* @throws
	 */
	public String getRegBusYwrmcByYwh(String ywhStr){
		String ywrmc = "";
		if(StringUtils.isBlank(ywhStr)){
			return ywrmc;
		}
		List<RegBusQlr> regBusQlrList = this.getRegBusQlrByYwh(ywhStr);
		//开始构造权利人姓名字符串
		if(regBusQlrList.size()>0){
			for(int k=0; k<regBusQlrList.size(); k++){
				ywrmc += regBusQlrList.get(k).getYwrmc() + " ";
			}
		}
		return ywrmc;
	}
	
	/***
	* @Title: getRegBusYwrZjzlByYwh 
	* @Description: 通过业务号获取义务人证件种类
	* @param @param ywhStr
	* @param @return    设定文件 
	* @return ywrzjzl    返回类型 
	* @throws
	 */
	public String getRegBusYwrZjzlByYwh(String ywhStr){
		String ywrzjzl = "";
		if(StringUtils.isBlank(ywhStr)){
			return ywrzjzl;
		}
		List<RegBusQlr> regBusQlrList = this.getRegBusQlrByYwh(ywhStr);
		//开始构造权利人姓名字符串
		//if(regBusQlrList.size()>0){
			//for(int k=0; k<regBusQlrList.size(); k++){
				ywrzjzl = regBusQlrList.get(0).getYwrzjzl();//默认取一个证件类型
			//}
		//}
		return ywrzjzl;
	}
	
	/***
	* @Title: getRegBusYwrZjhmByYwh 
	* @Description: 通过业务号获取证件号码
	* @param @param ywhStr
	* @param @return    设定文件 
	* @return zjhm    返回类型 
	* @throws
	 */
	public String getRegBusYwrZjhmByYwh(String ywhStr){
		String ywrzjhm = "";
		if(StringUtils.isBlank(ywhStr)){
			return ywrzjhm;
		}
		List<RegBusQlr> regBusQlrList = this.getRegBusQlrByYwh(ywhStr);
		//开始构造权利人姓名字符串
		//if(regBusQlrList.size()>0){
			//for(int k=0; k<regBusQlrList.size(); k++){
				ywrzjhm = regBusQlrList.get(0).getYwrzjh();//默认取一个证件类型
			//}
		//}
		return ywrzjhm;
	}
	public String findMaxYwhLs() {
		return dao.findMaxYwhLs();
	}
	public RegBusQlr getQlrByDy(String dyh) {
		// TODO Auto-generated method stub
		return dao.getQlrByDy(dyh);
	}
	public List<String> findryywh(RegBusQlr regBusQlr) {
		return dao.findryywh(regBusQlr);
	}
	public String findMaxYwhNf() {
		// TODO Auto-generated method stub
		return dao.findMaxYwhNf();
	}
	public List<RegBusQlr> findListNF(RegBusQlr regBusQlr) {
		// TODO Auto-generated method stub
		return dao.findListNF(regBusQlr);
	}
	
	//用于人像比对
	public RegBusQlr findByPic(String ywh, String sxh) {
		// TODO Auto-generated method stub
		return dao.findByPic(ywh,sxh);
	}
	
	
	@Transactional(readOnly = false)
	public Map interSi(String data, String interdata, String si_code, String ywh, String sxh) throws JsonParseException, JsonMappingException, ServiceException, IOException {
		Map map = new HashedMap();
			map = siService.si_post(data, interdata,si_code);
			RegBusQlr regBusQlr = findByPic(ywh,sxh);
			regBusQlr.setPiczt((String)map.get("rxbdzt"));
			super.save(regBusQlr);
		return map;
	}
	
	
	public List<Map> DjxxSelect(RegBusQlr qlr) {
		// TODO Auto-generated method stub
		List<Map> datalist = Lists.newArrayList();
		List<Map> list = dao.DjxxSelect(qlr);
		if(list.size()>0) {
			for(int i=0;i<list.size();i++) {
				Map map = list.get(i);
				String bdcdyh = map.get("BDCDYH").toString();
				RegBaseH h = hService.getdy(bdcdyh);
				String right = "";
				String zt="";
				if(h != null && h.getRights().equals("1")) {
					right = "预";
				}
				if(!h.getIsyiyi().equals("0")) {
					zt = zt + "异议  ";
				}else if(!h.getIschafeng().equals("0")) {
					zt = zt +right + "查封  ";
				}else if(!h.getIsdiya().equals("0")) {
					zt = zt +right + "抵押  ";
				}
				map.put("zt", zt);
				datalist.add(map);
			}
		}
		
		return datalist;
	}
	public List<Map<String, String>> getBdcxxByBdcqzh(RegBusQlr ryxx) {
		// TODO Auto-generated method stub
		return dao.getBdcxxByBdcqzh(ryxx);
	}
	public List<RegBusQlr> findDyr(String string, String string2) {
		// TODO Auto-generated method stub
		return dao.findDyr(string,string2);
	}
	
	public Page<RegBusQlr> findPage_nf(Page<RegBusQlr> page, RegBusQlr regBusQlr) {
		regBusQlr.setPage(page);
		page.setList(findListNF(regBusQlr));
		return page;
	}
		
}