|  |  |  | @ -1,6 +1,8 @@ | 
			
		
	
		
			
				
					|  |  |  |  | package com.platform.service.impl; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | import java.io.File; | 
			
		
	
		
			
				
					|  |  |  |  | import java.util.ArrayList; | 
			
		
	
		
			
				
					|  |  |  |  | import java.util.Arrays; | 
			
		
	
		
			
				
					|  |  |  |  | import java.util.Calendar; | 
			
		
	
		
			
				
					|  |  |  |  | import java.util.Collections; | 
			
		
	
		
			
				
					|  |  |  |  | import java.util.HashMap; | 
			
		
	
	
		
			
				
					|  |  |  | @ -11,16 +13,26 @@ import javax.annotation.Resource; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | import org.springframework.stereotype.Service; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | import com.base.Custom4exception; | 
			
		
	
		
			
				
					|  |  |  |  | import com.base.CustomException; | 
			
		
	
		
			
				
					|  |  |  |  | import com.platform.dao.DataInfoDao; | 
			
		
	
		
			
				
					|  |  |  |  | import com.platform.dao.GatherOracleDao; | 
			
		
	
		
			
				
					|  |  |  |  | import com.platform.dao.PreDataInfoDao; | 
			
		
	
		
			
				
					|  |  |  |  | import com.platform.entities.CheckoutEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.platform.entities.DataInfoEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.platform.entities.GatherOracleInfo; | 
			
		
	
		
			
				
					|  |  |  |  | import com.platform.entities.PreDataInfo; | 
			
		
	
		
			
				
					|  |  |  |  | import com.platform.oracle.OracleConnector; | 
			
		
	
		
			
				
					|  |  |  |  | import com.platform.service.DataInfoService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.platform.service.ICheckoutService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.platform.service.thread.ThreadCheckoutStandardOracle; | 
			
		
	
		
			
				
					|  |  |  |  | import com.platform.service.thread.ThreadExtractStandardSqlServer; | 
			
		
	
		
			
				
					|  |  |  |  | import com.platform.utils.BeanCopy; | 
			
		
	
		
			
				
					|  |  |  |  | import com.platform.utils.CacheOracleCheckoutEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.platform.utils.Configs; | 
			
		
	
		
			
				
					|  |  |  |  | import com.platform.utils.Constant; | 
			
		
	
		
			
				
					|  |  |  |  | import com.platform.utils.DateForm; | 
			
		
	
		
			
				
					|  |  |  |  | import com.platform.utils.FileOperateHelper; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | @Service(value = "checkoutService") | 
			
		
	
		
			
				
					|  |  |  |  | public class CheckoutServiceImpl implements ICheckoutService { | 
			
		
	
	
		
			
				
					|  |  |  | @ -33,6 +45,9 @@ public class CheckoutServiceImpl implements ICheckoutService { | 
			
		
	
		
			
				
					|  |  |  |  | 	 | 
			
		
	
		
			
				
					|  |  |  |  | 	@Resource(name = "dataInfoDao") | 
			
		
	
		
			
				
					|  |  |  |  | 	private DataInfoDao dataInfoDao; | 
			
		
	
		
			
				
					|  |  |  |  | 	 | 
			
		
	
		
			
				
					|  |  |  |  | 	@Resource(name = "gatherOracleDao") | 
			
		
	
		
			
				
					|  |  |  |  | 	private GatherOracleDao gatherOracleDao; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	@Override | 
			
		
	
		
			
				
					|  |  |  |  | 	public List<CheckoutEntity> findAll() throws Exception { | 
			
		
	
	
		
			
				
					|  |  |  | @ -84,31 +99,73 @@ public class CheckoutServiceImpl implements ICheckoutService { | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	@Override | 
			
		
	
		
			
				
					|  |  |  |  | 	public List<CheckoutEntity> checkAll(List<CheckoutEntity> list) throws Exception { | 
			
		
	
		
			
				
					|  |  |  |  | 		List<CheckoutEntity> oracleList = new ArrayList<CheckoutEntity>(); | 
			
		
	
		
			
				
					|  |  |  |  | 		List<CheckoutEntity> sqlServerList = new ArrayList<CheckoutEntity>(); | 
			
		
	
		
			
				
					|  |  |  |  | 		 | 
			
		
	
		
			
				
					|  |  |  |  | 		for (CheckoutEntity checkoutEntity : list) { | 
			
		
	
		
			
				
					|  |  |  |  | 			if (checkoutEntity.getDataId() == 0) { | 
			
		
	
		
			
				
					|  |  |  |  | 				continue; | 
			
		
	
		
			
				
					|  |  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  |  | 			if ("SQL SERVER".equals(checkoutEntity.getDataBaseType())) { | 
			
		
	
		
			
				
					|  |  |  |  | 				sqlServerList.add(checkoutEntity); | 
			
		
	
		
			
				
					|  |  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  |  | 			else if ("ORACLE".equals(checkoutEntity.getDataBaseType())) { | 
			
		
	
		
			
				
					|  |  |  |  | 				oracleList.add(checkoutEntity); | 
			
		
	
		
			
				
					|  |  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 		// sql Server校验
 | 
			
		
	
		
			
				
					|  |  |  |  | 		for (CheckoutEntity checkoutEntity : sqlServerList) { | 
			
		
	
		
			
				
					|  |  |  |  | 			if (checkoutEntity.getDataId() == 0) { | 
			
		
	
		
			
				
					|  |  |  |  | 				continue; | 
			
		
	
		
			
				
					|  |  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  |  | 			DataInfoEntity data = new DataInfoEntity(); | 
			
		
	
		
			
				
					|  |  |  |  | 			this.checkSqlServerOne(checkoutEntity); | 
			
		
	
		
			
				
					|  |  |  |  | 			data.setId(checkoutEntity.getDataId()); | 
			
		
	
		
			
				
					|  |  |  |  | 			data.setPayResultLast(checkoutEntity.getPayResultLast()); | 
			
		
	
		
			
				
					|  |  |  |  | 			data.setExecResultLast(checkoutEntity.getExecResultLast()); | 
			
		
	
		
			
				
					|  |  |  |  | 			data.setCheckoutFlag(checkoutEntity.getCheckoutFlag()); | 
			
		
	
		
			
				
					|  |  |  |  | 			dataInfoDao.update(data); | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 		//oracle 校验
 | 
			
		
	
		
			
				
					|  |  |  |  | 		for (CheckoutEntity checkoutEntity : oracleList) { | 
			
		
	
		
			
				
					|  |  |  |  | 			if (checkoutEntity.getDataId() == 0) { | 
			
		
	
		
			
				
					|  |  |  |  | 				continue; | 
			
		
	
		
			
				
					|  |  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  |  | 			DataInfoEntity data = new DataInfoEntity(); | 
			
		
	
		
			
				
					|  |  |  |  | 			// 状态改为 正则校验   Constant.CHECKOUTFLAG_TWO
 | 
			
		
	
		
			
				
					|  |  |  |  | 			this.checkOracleOne(checkoutEntity); | 
			
		
	
		
			
				
					|  |  |  |  | 			data.setId(checkoutEntity.getDataId()); | 
			
		
	
		
			
				
					|  |  |  |  | 			data.setPayResultLast(checkoutEntity.getPayResultLast()); | 
			
		
	
		
			
				
					|  |  |  |  | 			data.setExecResultLast(checkoutEntity.getExecResultLast()); | 
			
		
	
		
			
				
					|  |  |  |  | 			data.setCheckoutFlag(checkoutEntity.getCheckoutFlag()); | 
			
		
	
		
			
				
					|  |  |  |  | 			dataInfoDao.update(data); | 
			
		
	
		
			
				
					|  |  |  |  | 			String kuberTaskName = checkoutEntity.getAreaCode().toLowerCase()+"-" | 
			
		
	
		
			
				
					|  |  |  |  | 					+ checkoutEntity.getSysCode() + "-" + checkoutEntity.getDataVersion(); | 
			
		
	
		
			
				
					|  |  |  |  | 			if(!CacheOracleCheckoutEntity.getCheckKeys().contains(kuberTaskName)){ | 
			
		
	
		
			
				
					|  |  |  |  | 				CacheOracleCheckoutEntity.putCheck(kuberTaskName, checkoutEntity); | 
			
		
	
		
			
				
					|  |  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 		//TODO 如果  CacheOracleCheckoutEntity.getCheckKeys() 有数据则启动 kuber客户端请求,尝试链接oracle,并查询标准表是否存在
 | 
			
		
	
		
			
				
					|  |  |  |  | 		if ( CacheOracleCheckoutEntity.getCheckKeys().size() > 0) { | 
			
		
	
		
			
				
					|  |  |  |  | 			new ThreadCheckoutStandardOracle(dataInfoDao).start(); | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 		 List<CheckoutEntity> result = new ArrayList<CheckoutEntity>(); | 
			
		
	
		
			
				
					|  |  |  |  | 		if (list.size() > 0) { | 
			
		
	
		
			
				
					|  |  |  |  | 			result = findByCity(list.get(0).getCityName()); | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 		Map<String, CheckoutEntity> map = new HashMap<String, CheckoutEntity>(); | 
			
		
	
		
			
				
					|  |  |  |  | 		for (CheckoutEntity checkoutEntity : list) { | 
			
		
	
		
			
				
					|  |  |  |  | 			checkOne(checkoutEntity); | 
			
		
	
		
			
				
					|  |  |  |  | 			map.put(checkoutEntity.getAreaCode()+ "_" +checkoutEntity.getSysCode()+ "_" +checkoutEntity.getDataVersion(),checkoutEntity); | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 		for (int i = 0; i < result.size(); i++) { | 
			
		
	
		
			
				
					|  |  |  |  | 			CheckoutEntity checkoutEntity = result.get(i); | 
			
		
	
		
			
				
					|  |  |  |  | 			String area_sys = checkoutEntity.getAreaCode()+ "_" +checkoutEntity.getSysCode()+ "_" +checkoutEntity.getDataVersion(); | 
			
		
	
		
			
				
					|  |  |  |  | 			if (map.containsKey(area_sys)) { | 
			
		
	
		
			
				
					|  |  |  |  | 				result.set(i, map.get(area_sys)); | 
			
		
	
		
			
				
					|  |  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  |  | 		}	 | 
			
		
	
		
			
				
					|  |  |  |  | //		Map<String, CheckoutEntity> map = new HashMap<String, CheckoutEntity>();
 | 
			
		
	
		
			
				
					|  |  |  |  | //		for (CheckoutEntity checkoutEntity : list) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //			DataInfoEntity data = new DataInfoEntity();
 | 
			
		
	
		
			
				
					|  |  |  |  | //			//校验当前的数据:
 | 
			
		
	
		
			
				
					|  |  |  |  | //			checkOne(checkoutEntity);
 | 
			
		
	
		
			
				
					|  |  |  |  | //			data.setId(checkoutEntity.getDataId());
 | 
			
		
	
		
			
				
					|  |  |  |  | //			data.setPayResultLast(checkoutEntity.getPayResultLast());
 | 
			
		
	
		
			
				
					|  |  |  |  | //			data.setExecResultLast(checkoutEntity.getExecResultLast());
 | 
			
		
	
		
			
				
					|  |  |  |  | //			data.setCheckoutFlag(checkoutEntity.getCheckoutFlag());
 | 
			
		
	
		
			
				
					|  |  |  |  | //			dataInfoDao.update(data);
 | 
			
		
	
		
			
				
					|  |  |  |  | //			map.put(checkoutEntity.getAreaCode()+ "_" +checkoutEntity.getSysCode()+ "_" +checkoutEntity.getDataVersion(),checkoutEntity);
 | 
			
		
	
		
			
				
					|  |  |  |  | //		}
 | 
			
		
	
		
			
				
					|  |  |  |  | //		for (int i = 0; i < result.size(); i++) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //			CheckoutEntity checkoutEntity = result.get(i);
 | 
			
		
	
		
			
				
					|  |  |  |  | //			String area_sys = checkoutEntity.getAreaCode()+ "_" +checkoutEntity.getSysCode()+ "_" +checkoutEntity.getDataVersion();
 | 
			
		
	
		
			
				
					|  |  |  |  | //			if (map.containsKey(area_sys)) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //				result.set(i, map.get(area_sys));
 | 
			
		
	
		
			
				
					|  |  |  |  | //			}
 | 
			
		
	
		
			
				
					|  |  |  |  | //		}	
 | 
			
		
	
		
			
				
					|  |  |  |  | 		 | 
			
		
	
		
			
				
					|  |  |  |  | 		return result; | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
	
		
			
				
					|  |  |  | @ -137,21 +194,6 @@ public class CheckoutServiceImpl implements ICheckoutService { | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 	 | 
			
		
	
		
			
				
					|  |  |  |  | 	/** 校验 | 
			
		
	
		
			
				
					|  |  |  |  | 	 * @param ck | 
			
		
	
		
			
				
					|  |  |  |  | 	 * @return | 
			
		
	
		
			
				
					|  |  |  |  | 	 */ | 
			
		
	
		
			
				
					|  |  |  |  | 	private CheckoutEntity checkOne(CheckoutEntity ck) { | 
			
		
	
		
			
				
					|  |  |  |  | 		String pay = ck.getPayResult(); | 
			
		
	
		
			
				
					|  |  |  |  | 		String exec = ck.getExecResult(); | 
			
		
	
		
			
				
					|  |  |  |  | 		ck.setPayResultLast(isY(pay)); | 
			
		
	
		
			
				
					|  |  |  |  | 		ck.setExecResultLast(isY(exec)); | 
			
		
	
		
			
				
					|  |  |  |  | 		ck.setCheckResult(isY(pay, exec)); | 
			
		
	
		
			
				
					|  |  |  |  | 		// 1:已校验
 | 
			
		
	
		
			
				
					|  |  |  |  | 		ck.setCheckoutFlag("1"); | 
			
		
	
		
			
				
					|  |  |  |  | 		return ck; | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	@Override | 
			
		
	
		
			
				
					|  |  |  |  | 	public List<CheckoutEntity> findByCity(String city) throws Exception { | 
			
		
	
		
			
				
					|  |  |  |  | 		CheckoutEntity cksql = new CheckoutEntity(); | 
			
		
	
	
		
			
				
					|  |  |  | @ -162,18 +204,19 @@ public class CheckoutServiceImpl implements ICheckoutService { | 
			
		
	
		
			
				
					|  |  |  |  | 		cksql.setCollectingTime(time); | 
			
		
	
		
			
				
					|  |  |  |  | 		cksql.setCityName(city); | 
			
		
	
		
			
				
					|  |  |  |  | 		 | 
			
		
	
		
			
				
					|  |  |  |  | 		List<CheckoutEntity> resul = new ArrayList<CheckoutEntity>(); | 
			
		
	
		
			
				
					|  |  |  |  | 		Map<String,CheckoutEntity> resul = new HashMap<String,CheckoutEntity>(); | 
			
		
	
		
			
				
					|  |  |  |  | 		Map<String,CheckoutEntity> nodata = new HashMap<String,CheckoutEntity>(); | 
			
		
	
		
			
				
					|  |  |  |  | 		List<CheckoutEntity> list = preDataInfoDao.findByCity(cksql); | 
			
		
	
		
			
				
					|  |  |  |  | 		int length = list.size(); | 
			
		
	
		
			
				
					|  |  |  |  | 		for (int i = 0; i < length; i++) { | 
			
		
	
		
			
				
					|  |  |  |  | 			CheckoutEntity preDataInfo = list.get(i); | 
			
		
	
		
			
				
					|  |  |  |  | 			if (null != preDataInfo.getPayResultLast() &&  | 
			
		
	
		
			
				
					|  |  |  |  | 					preDataInfo.getPayResultLast().equals(preDataInfo.getExecResultLast()) &&  | 
			
		
	
		
			
				
					|  |  |  |  | 					"是".equals(preDataInfo.getExecResultLast())) { | 
			
		
	
		
			
				
					|  |  |  |  | 				preDataInfo.setCheckResult("是"); | 
			
		
	
		
			
				
					|  |  |  |  | 			}else if(null != preDataInfo.getPayResultLast() && null != preDataInfo.getExecResultLast() && !"-".equals(preDataInfo.getPayResultLast()) && !"-".equals(preDataInfo.getExecResultLast())){ | 
			
		
	
		
			
				
					|  |  |  |  | 				preDataInfo.setCheckResult("否"); | 
			
		
	
		
			
				
					|  |  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  |  | //			if (null != preDataInfo.getPayResultLast() && 
 | 
			
		
	
		
			
				
					|  |  |  |  | //					preDataInfo.getPayResultLast().equals(preDataInfo.getExecResultLast()) && 
 | 
			
		
	
		
			
				
					|  |  |  |  | //					"是".equals(preDataInfo.getExecResultLast())) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //				preDataInfo.setCheckResult("是");
 | 
			
		
	
		
			
				
					|  |  |  |  | //			}else if(null != preDataInfo.getPayResultLast() && null != preDataInfo.getExecResultLast() && !"-".equals(preDataInfo.getPayResultLast()) && !"-".equals(preDataInfo.getExecResultLast())){
 | 
			
		
	
		
			
				
					|  |  |  |  | //				preDataInfo.setCheckResult("否");
 | 
			
		
	
		
			
				
					|  |  |  |  | //			}
 | 
			
		
	
		
			
				
					|  |  |  |  | 			preDataInfo.setId(i); | 
			
		
	
		
			
				
					|  |  |  |  | 			preDataInfo.setCollUpdate(isY(preDataInfo.getCollUpdate())); | 
			
		
	
		
			
				
					|  |  |  |  | 			if (preDataInfo.getDataVersion() < 1) { | 
			
		
	
	
		
			
				
					|  |  |  | @ -181,14 +224,54 @@ public class CheckoutServiceImpl implements ICheckoutService { | 
			
		
	
		
			
				
					|  |  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  |  | 			if (null != preDataInfo.getCollectingTime()) { | 
			
		
	
		
			
				
					|  |  |  |  | 				if (c2.getTime().before(DateForm.string2DateByDay(preDataInfo.getCollectingTime()))) { | 
			
		
	
		
			
				
					|  |  |  |  | 					resul.add(preDataInfo); | 
			
		
	
		
			
				
					|  |  |  |  | 					resul.put(preDataInfo.getAreaCode()+"_"+preDataInfo.getSysCode()+"_"+preDataInfo.getDataId(), preDataInfo); | 
			
		
	
		
			
				
					|  |  |  |  | 				} | 
			
		
	
		
			
				
					|  |  |  |  | 				else { | 
			
		
	
		
			
				
					|  |  |  |  | 					preDataInfo.setDataId(0); | 
			
		
	
		
			
				
					|  |  |  |  | 					preDataInfo.setPath(null); | 
			
		
	
		
			
				
					|  |  |  |  | 					preDataInfo.setDataVersion(0); | 
			
		
	
		
			
				
					|  |  |  |  | 					preDataInfo.setExecResult(null); | 
			
		
	
		
			
				
					|  |  |  |  | 					preDataInfo.setExecResultLast(null); | 
			
		
	
		
			
				
					|  |  |  |  | 					preDataInfo.setPayResult(null); | 
			
		
	
		
			
				
					|  |  |  |  | 					preDataInfo.setPayResultLast(null); | 
			
		
	
		
			
				
					|  |  |  |  | 					preDataInfo.setCheckoutFlag(null); | 
			
		
	
		
			
				
					|  |  |  |  | 					preDataInfo.setCollection("否"); | 
			
		
	
		
			
				
					|  |  |  |  | 					//data_id 已经为 0
 | 
			
		
	
		
			
				
					|  |  |  |  | 					nodata.put(preDataInfo.getAreaCode()+"_"+preDataInfo.getSysCode(), preDataInfo); | 
			
		
	
		
			
				
					|  |  |  |  | 				} | 
			
		
	
		
			
				
					|  |  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  |  | 			else{ | 
			
		
	
		
			
				
					|  |  |  |  | 				resul.add(preDataInfo); | 
			
		
	
		
			
				
					|  |  |  |  | 				nodata.put(preDataInfo.getAreaCode()+"_"+preDataInfo.getSysCode(), preDataInfo); | 
			
		
	
		
			
				
					|  |  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 		return resul; | 
			
		
	
		
			
				
					|  |  |  |  | 		List<String> keyList = new ArrayList<String>(); | 
			
		
	
		
			
				
					|  |  |  |  | 		for (String nodatakey : nodata.keySet()) { | 
			
		
	
		
			
				
					|  |  |  |  | 			keyList.add(nodatakey); | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 		 | 
			
		
	
		
			
				
					|  |  |  |  | 		List<CheckoutEntity> resultList = new ArrayList<CheckoutEntity>(); | 
			
		
	
		
			
				
					|  |  |  |  | 		for (String key : resul.keySet()) { | 
			
		
	
		
			
				
					|  |  |  |  | 			//如果有 校验失败的结果则  为否
 | 
			
		
	
		
			
				
					|  |  |  |  | 			CheckoutEntity tmp = resul.get(key); | 
			
		
	
		
			
				
					|  |  |  |  | 			if(!Constant.CHECKOUT_STATUS_ZERO.equals(tmp.getPayResultLast()) && !Constant.CHECKOUT_STATUS_ZERO.equals(tmp.getExecResultLast())){ | 
			
		
	
		
			
				
					|  |  |  |  | 				if (Constant.CHECKOUT_STATUS_FOUR.equals(tmp.getPayResultLast()) || Constant.CHECKOUT_STATUS_FOUR.equals(tmp.getExecResultLast())) { | 
			
		
	
		
			
				
					|  |  |  |  | 					tmp.setCheckResult(Constant.ORACLE_CHECK_REULT_ONE); | 
			
		
	
		
			
				
					|  |  |  |  | 				} | 
			
		
	
		
			
				
					|  |  |  |  | 				else if(!Constant.CHECKOUT_STATUS_TWO.equals(tmp.getPayResultLast()) && !Constant.CHECKOUT_STATUS_TWO.equals(tmp.getExecResultLast())){ | 
			
		
	
		
			
				
					|  |  |  |  | 					tmp.setCheckResult(Constant.ORACLE_CHECK_REULT_ZERO); | 
			
		
	
		
			
				
					|  |  |  |  | 				} | 
			
		
	
		
			
				
					|  |  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  |  | 			resultList.add(resul.get(key)); | 
			
		
	
		
			
				
					|  |  |  |  | 			for (String nodatakey : keyList) { | 
			
		
	
		
			
				
					|  |  |  |  | 				if (key.contains(nodatakey)) { | 
			
		
	
		
			
				
					|  |  |  |  | 					nodata.remove(nodatakey); | 
			
		
	
		
			
				
					|  |  |  |  | 				} | 
			
		
	
		
			
				
					|  |  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 		for (String key : nodata.keySet()) { | 
			
		
	
		
			
				
					|  |  |  |  | 			resultList.add(nodata.get(key)); | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 		return resultList; | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	@Override | 
			
		
	
	
		
			
				
					|  |  |  | @ -333,6 +416,89 @@ public class CheckoutServiceImpl implements ICheckoutService { | 
			
		
	
		
			
				
					|  |  |  |  | 		return true; | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	/** 校验sqlServer单条记录 | 
			
		
	
		
			
				
					|  |  |  |  | 		 * @param ck | 
			
		
	
		
			
				
					|  |  |  |  | 		 * @return | 
			
		
	
		
			
				
					|  |  |  |  | 		 */ | 
			
		
	
		
			
				
					|  |  |  |  | 	private CheckoutEntity checkSqlServerOne(CheckoutEntity ck) { | 
			
		
	
		
			
				
					|  |  |  |  | 		//TODO 校验: sqlserver数据-查看脚本在不在? 支付:standard_pay_地区_系统码.sql ?,支付:standard_indicate_地区_系统码.sql ?
 | 
			
		
	
		
			
				
					|  |  |  |  | 		//TODO  sqlserver校验结果记录进数据库,
 | 
			
		
	
		
			
				
					|  |  |  |  | 		String pay = ck.getPayResult(); | 
			
		
	
		
			
				
					|  |  |  |  | 		String exec = ck.getExecResult(); | 
			
		
	
		
			
				
					|  |  |  |  | 		ck.setCheckResult("是"); | 
			
		
	
		
			
				
					|  |  |  |  | 		if (Constant.CHECKOUT_STATUS_ZERO.equals(ck.getPayResultLast())) { | 
			
		
	
		
			
				
					|  |  |  |  | 			if ("y".equals(pay) || "Y".equals(pay)) { | 
			
		
	
		
			
				
					|  |  |  |  | 				String payFilePath = FileOperateHelper.addLastSeparator(ck.getPath())+Constant.standard_pay | 
			
		
	
		
			
				
					|  |  |  |  | 						+ ck.getAreaCode().toLowerCase()+ck.getSysCode()+".sql"; | 
			
		
	
		
			
				
					|  |  |  |  | 				File f = new File(payFilePath); | 
			
		
	
		
			
				
					|  |  |  |  | 				if(f.exists()){ | 
			
		
	
		
			
				
					|  |  |  |  | 					ck.setPayResultLast(Constant.CHECKOUT_STATUS_THREE); | 
			
		
	
		
			
				
					|  |  |  |  | 				} | 
			
		
	
		
			
				
					|  |  |  |  | 				else | 
			
		
	
		
			
				
					|  |  |  |  | 				{ | 
			
		
	
		
			
				
					|  |  |  |  | 					ck.setPayResultLast(Constant.CHECKOUT_STATUS_FOUR); | 
			
		
	
		
			
				
					|  |  |  |  | 				} | 
			
		
	
		
			
				
					|  |  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  |  | 			else { | 
			
		
	
		
			
				
					|  |  |  |  | 				//校验结果:成功或失败   0:未校验,1:不需校验,2:正在校验,3:校验成功,4:校验失败,5:待抽取,6:正在抽取,7:抽取完成
 | 
			
		
	
		
			
				
					|  |  |  |  | 				ck.setPayResultLast(Constant.CHECKOUT_STATUS_ONE); | 
			
		
	
		
			
				
					|  |  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 		if (Constant.CHECKOUT_STATUS_ZERO.equals(ck.getExecResultLast())){ | 
			
		
	
		
			
				
					|  |  |  |  | 			if ("y".equals(exec) || "Y".equals(exec)) { | 
			
		
	
		
			
				
					|  |  |  |  | 				String execFilePath = FileOperateHelper.addLastSeparator(ck.getPath())+Constant.standard_indicate | 
			
		
	
		
			
				
					|  |  |  |  | 					+ ck.getAreaCode().toLowerCase()+ck.getSysCode()+".sql"; | 
			
		
	
		
			
				
					|  |  |  |  | 				File f = new File(execFilePath); | 
			
		
	
		
			
				
					|  |  |  |  | 				if (f.exists()) { | 
			
		
	
		
			
				
					|  |  |  |  | 					ck.setExecResultLast(Constant.CHECKOUT_STATUS_THREE); | 
			
		
	
		
			
				
					|  |  |  |  | 				} | 
			
		
	
		
			
				
					|  |  |  |  | 				else | 
			
		
	
		
			
				
					|  |  |  |  | 				{ | 
			
		
	
		
			
				
					|  |  |  |  | 					ck.setExecResultLast(Constant.CHECKOUT_STATUS_FOUR); | 
			
		
	
		
			
				
					|  |  |  |  | 				} | 
			
		
	
		
			
				
					|  |  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  |  | 			else { | 
			
		
	
		
			
				
					|  |  |  |  | 			//校验结果:成功或失     0:未校验,1:不需校验,2:正在校验,3:校验成功,4:校验失败,5:待抽取,6:正在抽取,7:抽取完成
 | 
			
		
	
		
			
				
					|  |  |  |  | 				ck.setExecResultLast(Constant.CHECKOUT_STATUS_ONE); | 
			
		
	
		
			
				
					|  |  |  |  | 			}	 | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 		// 1:已校验--
 | 
			
		
	
		
			
				
					|  |  |  |  | 		ck.setCheckoutFlag(Constant.CHECKOUTFLAG_ONE); | 
			
		
	
		
			
				
					|  |  |  |  | 		return ck; | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 	 | 
			
		
	
		
			
				
					|  |  |  |  | 	/** 校验ORACLE 单条记录 | 
			
		
	
		
			
				
					|  |  |  |  | 	 * @param ck | 
			
		
	
		
			
				
					|  |  |  |  | 	 * @return | 
			
		
	
		
			
				
					|  |  |  |  | 	 */ | 
			
		
	
		
			
				
					|  |  |  |  | 	private CheckoutEntity checkOracleOne(CheckoutEntity ck) { | 
			
		
	
		
			
				
					|  |  |  |  | 		//TODO 校验: Oracle数据-更改为正则校验
 | 
			
		
	
		
			
				
					|  |  |  |  | 		//TODO  Oracle校验结果记录进数据库,
 | 
			
		
	
		
			
				
					|  |  |  |  | 		String pay = ck.getPayResult(); | 
			
		
	
		
			
				
					|  |  |  |  | 		String exec = ck.getExecResult(); | 
			
		
	
		
			
				
					|  |  |  |  | 		if (Constant.CHECKOUT_STATUS_ZERO.equals(ck.getPayResultLast())) { | 
			
		
	
		
			
				
					|  |  |  |  | 			//校验结果:成功或失败   0:未校验,1:不需校验,2:正在校验,3:校验成功,4:校验失败,5:待抽取,6:正在抽取,7:抽取完成
 | 
			
		
	
		
			
				
					|  |  |  |  | 			if ("y".equals(pay) || "Y".equals(pay)) { | 
			
		
	
		
			
				
					|  |  |  |  | 				ck.setPayResultLast(Constant.CHECKOUT_STATUS_TWO); | 
			
		
	
		
			
				
					|  |  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  |  | 			else { | 
			
		
	
		
			
				
					|  |  |  |  | 				ck.setPayResultLast(Constant.CHECKOUT_STATUS_ONE); | 
			
		
	
		
			
				
					|  |  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 		if (Constant.CHECKOUT_STATUS_ZERO.equals(ck.getExecResultLast())){ | 
			
		
	
		
			
				
					|  |  |  |  | 			if ("y".equals(exec) || "Y".equals(exec)) { | 
			
		
	
		
			
				
					|  |  |  |  | 				ck.setExecResultLast(Constant.CHECKOUT_STATUS_TWO); | 
			
		
	
		
			
				
					|  |  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  |  | 			else { | 
			
		
	
		
			
				
					|  |  |  |  | 			//校验结果:成功或失     0:未校验,1:不需校验,2:正在校验,3:校验成功,4:校验失败,5:待抽取,6:正在抽取,7:抽取完成
 | 
			
		
	
		
			
				
					|  |  |  |  | 				ck.setExecResultLast(Constant.CHECKOUT_STATUS_ONE); | 
			
		
	
		
			
				
					|  |  |  |  | 			}	 | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 		// 2:正在校验--
 | 
			
		
	
		
			
				
					|  |  |  |  | 		ck.setCheckoutFlag(Constant.CHECKOUTFLAG_TWO); | 
			
		
	
		
			
				
					|  |  |  |  | 		return ck; | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	@Override | 
			
		
	
		
			
				
					|  |  |  |  | 	public List<CheckoutEntity> deleteAll(List<CheckoutEntity> list) | 
			
		
	
		
			
				
					|  |  |  |  | 			throws Exception { | 
			
		
	
	
		
			
				
					|  |  |  | @ -353,4 +519,84 @@ public class CheckoutServiceImpl implements ICheckoutService { | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 		return result; | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	@Override | 
			
		
	
		
			
				
					|  |  |  |  | 	public List<CheckoutEntity> extractSqlServer(List<CheckoutEntity> list) | 
			
		
	
		
			
				
					|  |  |  |  | 			throws Exception { | 
			
		
	
		
			
				
					|  |  |  |  | 		//待抽取标准表 的 SqlServer服务的 数据列表:
 | 
			
		
	
		
			
				
					|  |  |  |  | 		List<CheckoutEntity> sqlServer = new ArrayList<CheckoutEntity>(); | 
			
		
	
		
			
				
					|  |  |  |  | 		for (CheckoutEntity checkoutEntity : list) { | 
			
		
	
		
			
				
					|  |  |  |  | 			if ("SQL SERVER".equals(checkoutEntity.getDataBaseType()) && checkoutEntity.getDataId() > 0) { | 
			
		
	
		
			
				
					|  |  |  |  | 				sqlServer.add(checkoutEntity); | 
			
		
	
		
			
				
					|  |  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 		//TODO 修改sqlServer 列表对应的 数据---  payResultLast 、execResultLast-> 正在抽取
 | 
			
		
	
		
			
				
					|  |  |  |  | 		// 待抽取的集合  
 | 
			
		
	
		
			
				
					|  |  |  |  | 		List<CheckoutEntity> Extractlist = new ArrayList<CheckoutEntity>(); | 
			
		
	
		
			
				
					|  |  |  |  | 		// TODO 抽取 --- 线程
 | 
			
		
	
		
			
				
					|  |  |  |  | 		if (sqlServer.size() > 0) { | 
			
		
	
		
			
				
					|  |  |  |  | 			for (CheckoutEntity checkoutEntity : sqlServer) { | 
			
		
	
		
			
				
					|  |  |  |  | 				boolean isTract = false; | 
			
		
	
		
			
				
					|  |  |  |  | 				//校验结果:成功或失     0:未校验,1:不需校验,2:正在校验,3:校验成功,4:校验失败,5:待抽取,6:正在抽取,7:抽取完成
 | 
			
		
	
		
			
				
					|  |  |  |  | 				if(Constant.CHECKOUT_STATUS_THREE.equals(checkoutEntity.getPayResultLast())){ | 
			
		
	
		
			
				
					|  |  |  |  | 					isTract = true; | 
			
		
	
		
			
				
					|  |  |  |  | 					checkoutEntity.setPayResultLast(Constant.CHECKOUT_STATUS_FIVE); | 
			
		
	
		
			
				
					|  |  |  |  | 				} | 
			
		
	
		
			
				
					|  |  |  |  | 				if(Constant.CHECKOUT_STATUS_THREE.equals(checkoutEntity.getExecResultLast())){ | 
			
		
	
		
			
				
					|  |  |  |  | 					isTract = true; | 
			
		
	
		
			
				
					|  |  |  |  | 					checkoutEntity.setPayResultLast(Constant.CHECKOUT_STATUS_FIVE); | 
			
		
	
		
			
				
					|  |  |  |  | 				} | 
			
		
	
		
			
				
					|  |  |  |  | 				if (isTract) { | 
			
		
	
		
			
				
					|  |  |  |  | 					Extractlist.add(checkoutEntity); | 
			
		
	
		
			
				
					|  |  |  |  | 				} | 
			
		
	
		
			
				
					|  |  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  |  | 			// 汇总库的信息
 | 
			
		
	
		
			
				
					|  |  |  |  | 			GatherOracleInfo oracleInfo = null; | 
			
		
	
		
			
				
					|  |  |  |  | 			List<GatherOracleInfo> oracleConnects = gatherOracleDao.selectAllOracle(); | 
			
		
	
		
			
				
					|  |  |  |  | 			for (GatherOracleInfo info : oracleConnects) { | 
			
		
	
		
			
				
					|  |  |  |  | 				//抽取标准表的汇总库
 | 
			
		
	
		
			
				
					|  |  |  |  | 				if (Constant.ORACLE_EXTRACT_TYPE_ONE.equals(info.getType())) { | 
			
		
	
		
			
				
					|  |  |  |  | 					oracleInfo = info; | 
			
		
	
		
			
				
					|  |  |  |  | 					break; | 
			
		
	
		
			
				
					|  |  |  |  | 				} | 
			
		
	
		
			
				
					|  |  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  |  | 			if (null != oracleInfo) { | 
			
		
	
		
			
				
					|  |  |  |  | 				// 如果能连接
 | 
			
		
	
		
			
				
					|  |  |  |  | 				if(OracleConnector.canConnect("jdbc:oracle:thin:@" + oracleInfo.getIp() + ":" + oracleInfo.getPort() + ":" | 
			
		
	
		
			
				
					|  |  |  |  | 						+ oracleInfo.getDatabaseName(), oracleInfo.getUser(), oracleInfo.getPassword())){ | 
			
		
	
		
			
				
					|  |  |  |  | 					for (CheckoutEntity check : Extractlist) { | 
			
		
	
		
			
				
					|  |  |  |  | 						 DataInfoEntity data = new DataInfoEntity(); | 
			
		
	
		
			
				
					|  |  |  |  | 						 data.setId(check.getDataId()); | 
			
		
	
		
			
				
					|  |  |  |  | 						 data.setPayResultLast(check.getPayResultLast()); | 
			
		
	
		
			
				
					|  |  |  |  | 						 data.setExecResultLast(check.getExecResultLast()); | 
			
		
	
		
			
				
					|  |  |  |  | 						 data.setCheckoutFlag(check.getCheckoutFlag()); | 
			
		
	
		
			
				
					|  |  |  |  | 						 try { | 
			
		
	
		
			
				
					|  |  |  |  | 							dataInfoDao.update(data); | 
			
		
	
		
			
				
					|  |  |  |  | 						} catch (Exception e) { | 
			
		
	
		
			
				
					|  |  |  |  | 							// TODO Auto-generated catch block
 | 
			
		
	
		
			
				
					|  |  |  |  | 							e.printStackTrace(); | 
			
		
	
		
			
				
					|  |  |  |  | 						} | 
			
		
	
		
			
				
					|  |  |  |  | 					} | 
			
		
	
		
			
				
					|  |  |  |  | 					//抽取
 | 
			
		
	
		
			
				
					|  |  |  |  | 					new ThreadExtractStandardSqlServer(oracleInfo, Extractlist, dataInfoDao).start(); | 
			
		
	
		
			
				
					|  |  |  |  | 				} | 
			
		
	
		
			
				
					|  |  |  |  | 				else { | 
			
		
	
		
			
				
					|  |  |  |  | 					//连接不上标准表汇总库错误 
 | 
			
		
	
		
			
				
					|  |  |  |  | 					throw new CustomException(Custom4exception.CHECKOUT_EXTRACT_EXCEPT, null); | 
			
		
	
		
			
				
					|  |  |  |  | 				} | 
			
		
	
		
			
				
					|  |  |  |  | 			} | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 		List<CheckoutEntity> result = new ArrayList<CheckoutEntity>(); | 
			
		
	
		
			
				
					|  |  |  |  | 		//TODO findByCity
 | 
			
		
	
		
			
				
					|  |  |  |  | 		if (list.size() > 0) { | 
			
		
	
		
			
				
					|  |  |  |  | 			result  = findByCity(list.get(0).getCityName()); | 
			
		
	
		
			
				
					|  |  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  |  | 		return result; | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	@Override | 
			
		
	
		
			
				
					|  |  |  |  | 	public Map<String, PreDataInfo> readLog(CheckoutEntity ck) throws Exception { | 
			
		
	
		
			
				
					|  |  |  |  | 		// TODO Auto-generated method stub
 | 
			
		
	
		
			
				
					|  |  |  |  | 		return null; | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
	
		
			
				
					|  |  |  | 
 |