📄 rili_gjmjaction.java
字号:
// Created by Xslt generator for Eclipse.// XSL : not found (java.io.FileNotFoundException: (Bad file descriptor))// Default XSL used : easystruts.jar$org.easystruts.xslgen.JavaClass.xslpackage struts.action;import java.sql.ResultSet;import java.text.DecimalFormat;import java.util.Vector;import javabean.Checkdate;import javabean.PubDate;import javabean.YLHQ_gjmj;import javabean.dbconnect;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import org.apache.struts.action.Action;import org.apache.struts.action.ActionForm;import org.apache.struts.action.ActionForward;import org.apache.struts.action.ActionMapping;import struts.form.Rili_gjmjForm;/** * Rili_gjmjAction.java created by EasyStruts - XsltGen. * http://easystruts.sf.net * created on 10-31-2004 * * XDoclet definition: * @struts:action path="/rili_gjmj" name="rili_gjmjForm" input="/form/rili_gjmj.jsp" validate="true" * @struts:action-forward name="/YLHQ_gjmjD.jsp" path="/YLHQ_gjmjD.jsp" */public class Rili_gjmjAction extends Action { // --------------------------------------------------------- Instance Variables // --------------------------------------------------------- Methods /** * Method execute * @param ActionMapping mapping * @param ActionForm form * @param HttpServletRequest request * @param HttpServletResponse response * @return ActionForward * @throws Exception */ public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { Rili_gjmjForm rili_gjmjForm = (Rili_gjmjForm) form; String names=rili_gjmjForm.getnames().trim(); names=new String(names.getBytes("ISO-8859-1")); String sql; String times=rili_gjmjForm.getDates();//得到时间 String times2;//停止时间 int number=0,number1=0,xh=0,xh1=0; float index=0,zd=0,index1=0,zd1=0; String pubdate,pubdate1; ResultSet rs; dbconnect db=new dbconnect(); Vector vector1=new Vector(); Vector vector2=new Vector(); PubDate pub=new PubDate(); String times1=pub.getshortPubdate();//当前时间 Checkdate checkdate=new Checkdate(); DecimalFormat df=new DecimalFormat("0.0"); sql="select max(timedate) as timedate from data"; rs=db.executeQuery(sql); if(rs.next()) { times1=rs.getString("timedate");//最大天 } rs.close(); //times2="2003-02-10"; pubdate=times1; pubdate1=times1; if(times.compareTo(times1)>0) { checkdate.settimes(times1); times2=checkdate.gettimes(); //times2="2004-10-15"; //CotlookA sql="select * from data where timedate between '"+times2+"' and '"+times1+"' and code='1001' order by timedate desc "; rs=db.executeQuery(sql); while(rs.next()) { if(xh==0) { index=rs.getFloat("price"); pubdate=rs.getString("timedate"); } else { YLHQ_gjmj gjmj=new YLHQ_gjmj(); gjmj.setindex(df.format(index)); gjmj.setzd(Float.parseFloat(df.format(index-rs.getInt("price")))); gjmj.settimedate(pubdate); index=rs.getFloat("price"); pubdate=rs.getString("timedate"); vector1.add(gjmj); } xh++; } rs.close(); //CotlookB sql="select * from data where timedate between '"+times2+"' and '"+times1+"' and code='1002' order by timedate desc "; rs=db.executeQuery(sql); while(rs.next()) { if(xh1==0) { index1=rs.getFloat("price"); pubdate1=rs.getString("timedate"); } else { YLHQ_gjmj gjmj=new YLHQ_gjmj(); gjmj.setindex(df.format(index1)); gjmj.setzd(Float.parseFloat(df.format(index1-rs.getInt("price")))); gjmj.settimedate(pubdate1); index1=rs.getFloat("price"); pubdate1=rs.getString("timedate"); vector2.add(gjmj); } xh1++; } rs.close(); request.setAttribute("vector1",vector1); request.setAttribute("vector2",vector2); request.setAttribute("names",names); request.setAttribute("times_first",times2); request.setAttribute("times_end",times1); } else { checkdate.settimes(times); times2=checkdate.gettimes(); //times2="2004-10-15"; //sql="select * from ylhq1_zmzs where pubdate='"+times+"'"; //CotlookA sql="select * from data where timedate between '"+times2+"' and '"+times+"' and code='1001' order by timedate desc "; rs=db.executeQuery(sql); while(rs.next()) { if(xh==0) { index=rs.getFloat("price"); pubdate=rs.getString("timedate"); } else { YLHQ_gjmj gjmj=new YLHQ_gjmj(); gjmj.setindex(df.format(index)); gjmj.setzd(Float.parseFloat(df.format(index-rs.getInt("price")))); gjmj.settimedate(pubdate); index=rs.getFloat("price"); pubdate=rs.getString("timedate"); vector1.add(gjmj); } xh++; number++; } rs.close(); //CotlookB sql="select * from data where timedate between '"+times2+"' and '"+times+"' and code='1002' order by timedate desc "; rs=db.executeQuery(sql); while(rs.next()) { if(xh1==0) { index1=rs.getFloat("price"); pubdate1=rs.getString("timedate"); } else { YLHQ_gjmj gjmj=new YLHQ_gjmj(); gjmj.setindex(df.format(index1)); gjmj.setzd(Float.parseFloat(df.format(index1-rs.getInt("price")))); gjmj.settimedate(pubdate1); index1=rs.getFloat("price"); pubdate1=rs.getString("timedate"); vector2.add(gjmj); } xh1++; number1++; } rs.close(); if(number>0 && number1>0) { request.setAttribute("vector1",vector1); request.setAttribute("vector2",vector2); request.setAttribute("names",names); request.setAttribute("times_first",times2); request.setAttribute("times_end",times); } else { checkdate.settimes(times1); times2=checkdate.gettimes(); //times2="2004-10-15"; //A sql="select * from data where timedate between '"+times2+"' and '"+times1+"' and code='1001' order by timedate desc "; rs=db.executeQuery(sql); while(rs.next()) { if(xh==0) { index=rs.getFloat("price"); pubdate=rs.getString("timedate"); } else { YLHQ_gjmj gjmj=new YLHQ_gjmj(); gjmj.setindex(df.format(index1)); gjmj.setzd(Float.parseFloat(df.format(index-rs.getInt("price")))); gjmj.settimedate(pubdate); index=rs.getFloat("price"); pubdate=rs.getString("timedate"); vector1.add(gjmj); } xh++; } rs.close(); sql="select * from data where timedate between '"+times2+"' and '"+times1+"' and code='1002' order by timedate desc "; rs=db.executeQuery(sql); while(rs.next()) { if(xh1==0) { index1=rs.getFloat("price"); pubdate1=rs.getString("timedate"); } else { YLHQ_gjmj gjmj=new YLHQ_gjmj(); gjmj.setindex(df.format(index1)); gjmj.setzd(Float.parseFloat(df.format(index1-rs.getInt("price")))); gjmj.settimedate(pubdate1); index1=rs.getFloat("price"); pubdate1=rs.getString("timedate"); vector2.add(gjmj); } xh1++; } rs.close(); request.setAttribute("vector1",vector1); request.setAttribute("vector2",vector2); request.setAttribute("names",names); request.setAttribute("times_first",times2); request.setAttribute("times_end",times1); } } return mapping.findForward("Success"); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -