⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 investjoininsert.java

📁 java swing源码 欢迎下载 有问题请联系 我一定负责到底
💻 JAVA
字号:
/**
 * 投连价格跑批处理
 */
package com.NCL.axis.Batch;

import java.util.Timer;
import com.sinosoft.common.*;
import com.NCL.axis.*;
import com.NCL.*;
import org.dom4j.Element;

public class InvestJoinInsert{
	
	public static Timer timer = new Timer();
	public static boolean timerstate = false;				//执行状态
	public static final String excuteTime = "08:00:00";    //执行的时间
	
	/**投连价格数据提取
	 * 星期六、星期日、指定的日期不进行数据提取
	 * 提取数据时,先取得最新的计价日期lastValuationDate,提取从lastValuationDate+1至当前日期之间的数据
	 * @return 
	 */
	public static boolean Insert(){
		String thisDate = Data.getCurrentDate();
		//判断是否取数
		//星期六、星期日不取数
		//读取数据库,在数据库中存在的日期不取数
		String tmpDate = Data.getCurrentDateTime("E");
		if("星期六".equals(tmpDate)){
			System.out.println("今天是星期六,系统不进行投连价格发布。");
			return true;
		}else if("星期日".equals(tmpDate)){
			System.out.println("今天是星期日,系统不进行投连价格发布。");
			return true;
		}
//		PriceDate pd = new PriceDate();
//		pd.settStartDate(thisDate);
//		pd.setfEndDate(thisDate);
//		String ID = pd.find(pd, 1, 1);
//		if(Data.hasValue(ID)){
//			System.out.println("今天是指定不取数的日期,系统不进行投连价格发布。");
//			return true;
//		}
		
		InvestmentJoin ij = new InvestmentJoin();
		CustomSearch cs = new CustomSearch();
		String lastValuationDate = ij.findLastValuationDate();
		if(Data.hasValue(lastValuationDate))lastValuationDate = Data.dateAdd("d", lastValuationDate, 1);
		else lastValuationDate = thisDate;
		System.out.println("开始提取投连价格数据...");
		Element ele = cs.InvestmentJionTimer("", lastValuationDate, thisDate);
		String ValueDate = "";
		String RiskCode = "";
		String RiskName = "";
		String InsuAccNo = "";
		String InsuAccName = "";
		String UnitPriceBuy = "";
		String UnitPriceSell ="";
		while(ele!=null){
			ValueDate = cs.getElementText(ele, "ValueDate");
			RiskCode = cs.getElementText(ele, "RiskCode");
			RiskName = cs.getElementText(ele, "RiskName");
			InsuAccNo = cs.getElementText(ele, "InsuAccNo");
			InsuAccName = cs.getElementText(ele, "InsuAccName");
			UnitPriceBuy = cs.getElementText(ele, "UnitPriceBuy");
			UnitPriceSell = cs.getElementText(ele, "UnitPriceSell");
			ij.clear();
			//创建投连价格数据
			ij.set("RiskCode", RiskCode);		//设定RiskCode
			ij.set("RiskName", RiskName);
			ij.set("AccountCode", InsuAccNo);
			ij.set("AccountName", InsuAccName);
			ij.set("ValuationDate", ValueDate);
			ij.set("BuyInGrate", UnitPriceBuy);
			ij.set("SellInGprice", UnitPriceSell);
			ij.set("ValuationUnit", "D");
			ij.set("IsDisplay", "1");
			ij.set("RiskType", "投连");
			ij.set("BalancePeriod", "");
			ij.create();
			ele = cs.getNextElements();
		}
		return true;
	}
	
	/**
	 * 定时处理
	 * @return boolean
	 */
	public boolean PriceInfo(){
		if(timerstate){
			System.out.println("Error:InvestJoinInsert.PriceInfo() is started.");
			return false;
		}
		String currentTime = Data.getCurrentTime();
		long result = Data.returnSec(excuteTime)-Data.returnSec(currentTime);
		while(result<0)result += 24*3600;
		timer.schedule(new InvestJoinInsertTask(), 1000*result, 1000*24*3600);
		timerstate = true;
		System.out.println("InvestJoinInsert timer is start");
		return true;
	}
	
	class InvestJoinInsertTask extends java.util.TimerTask{
		/**
		 * 启动线程
		 */
		public void run(){
	    	InvestJoinInsert.Insert();
	    }
	}
	
	/**
	 * main方法
	 * @param args
	 */
	public static void main(String args[]){
		InvestJoinInsert.Insert();
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -