a6cb8e5ed9fb84e75dbeba84bbdf3df6e9243ebc.svn-base 3.15 KB
package com.thinkgem.jeesite.modules.information.service;

import java.sql.Date;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.google.common.collect.Lists;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.google.common.collect.Maps;
import com.thinkgem.jeesite.common.utils.JsonUtil;
import com.thinkgem.jeesite.modules.reg.dao.base.RegBaseHDao;
import com.thinkgem.jeesite.modules.reg.dao.base.RegBaseZrzDao;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBaseH;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBaseZrz;
import com.thinkgem.jeesite.common.utils.StringUtils;

@Service
@Transactional(readOnly = true)
public class InformationService {
	
	@Autowired
	private RegBaseHDao regBaseHDao;
	@Autowired
	private RegBaseZrzDao  regBaseZrzDao;
	
	public Map getInformation(String  jsonstr) {
	
		Map resmap = Maps.newHashMap();
		List jsonList = JsonUtil.ObjectToList(jsonstr);
		for (int i = 0; i < jsonList.size(); i++) {
			Map jsonobj = (Map)jsonList.get(i);
			String lcdm = jsonobj.containsKey("lcdm")?jsonobj.get("lcdm").toString() : "";
			String lcxlmc = jsonobj.containsKey("lcxlmc")?jsonobj.get("lcxlmc").toString() : "";//流程小类名称
			String qydm = jsonobj.containsKey("qydm")?jsonobj.get("qydm").toString() : "";//区域代码

			if( StringUtils.isEmpty(lcdm) || StringUtils.isEmpty(qydm) ) {
				resmap.put("data", false);	
				resmap.put("rtnMessage", "缺少必传参数,请补充!");
				resmap.put("txStatus", "0");	
				return resmap;
			}else {
				if(jsonobj.containsKey("bdcdyh")) {
					Map ckeckBd = Maps.newHashMap();
					List bdcdyhList = jsonobj.containsKey("bdcdyh")? (List)jsonobj.get("bdcdyh") : Lists.newArrayList();
					ckeckBd = ckeckBdcdyh(bdcdyhList);
					resmap.put("data",ckeckBd);
				}
			}
		}
		return resmap;
	}
    
	/**
	 * 	4.5根据房屋不动产单元号提取不动产单元信息
	 * @param bdcdyhList
	 * @return
	 */
	private Map ckeckBdcdyh(List bdcdyhList) {
		List list = new ArrayList();
		Map resmap = Maps.newHashMap();
		for (int j = 0; j < bdcdyhList.size(); j++) {
			RegBaseH regBaseH = new RegBaseH();
			regBaseH.setBdcdyh(bdcdyhList.get(j).toString());
			String setBdcd = bdcdyhList.get(j).toString();
			RegBaseH h = regBaseHDao.findByBdcdyh(regBaseH);
			if(h == null  ) {
				resmap.put("data", false);	
				resmap.put("rtnMessage", "不动产单元号:"+bdcdyhList.get(j).toString()+"查询的有效证号与已传输证号不符,请核验!");
				resmap.put("txStatus", "0");
				return resmap;
			}
			String bdcqzs = (String) bdcdyhList.get(j);
			String bdcqzsSub = bdcqzs.substring(0, 24);
			String regBaseZrz  =  regBaseZrzDao.findByBdcqzsSub(bdcqzsSub);
			String  subs =  regBaseZrz.substring(0, 10);
			
			Map map = Maps.newHashMap();
			map.put("jgsj",subs);
			map.put("zh","");
			map.put("syqjssj","");
			map.put("syqqssj","");
			map.put("sfyg","");
			map.put("sfygdy","");
			map.put("sfdyi","");
			list.add(map);
		}
		resmap.put("bdcxx",list);
		return resmap;
		
	}
	
}