Skip to content

Commit

Permalink
股票分析系统,股票查询系统
Browse files Browse the repository at this point in the history
  • Loading branch information
wzt3309 committed Aug 7, 2016
1 parent 07cfad3 commit f705e49
Show file tree
Hide file tree
Showing 26 changed files with 898 additions and 163 deletions.
9 changes: 1 addition & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,7 @@
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/WebContent/WEB-INF/lib/itext.jar</systemPath>
</dependency>
<dependency>
<groupId>javabuilder</groupId>
<artifactId>javabuilder</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/WebContent/WEB-INF/lib/javabuilder.jar</systemPath>
</dependency>
</dependency>
<!--网页爬虫功能-->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
Expand Down
17 changes: 16 additions & 1 deletion src/main/WebContent/WEB-INF/config/spring/quartz/jeebbs-job.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<property name="targetMethod" value="execute" />
</bean>
</property>
<property name="cronExpression" value="0 40 16 ? * 2-6" />
<property name="cronExpression" value="0 40 16-19 ? * 2-6" />
<!-- <property name="cronExpression" value="0 31 6-23 * * ?" />-->
</bean>

Expand All @@ -55,6 +55,20 @@
<!--<property name="cronExpression" value="0 * 6-23 * * ?" />-->
</bean>

<!--GetDdxDateJob 获取股票ddx信息 周一到周五 每日19:45 ~21:45各执行一次-->
<bean id="GetDdxDateJobTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail">
<bean class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject">
<bean class=" com.jeecms.bbs.schedule.GetDdxDateJob"/>
</property>
<property name="targetMethod" value="execute" />
</bean>
</property>
<property name="cronExpression" value="0 45 19-21 ? * 2-6" />
<!--<property name="cronExpression" value="0 * 6-23 * * ?" />-->
</bean>

<!-- 收集财经新闻 每日每小时整分执行一次 开始-->
<bean id="CrawlNewsXiuqiuJobTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail">
Expand Down Expand Up @@ -181,6 +195,7 @@
<ref local="CrawlNewsEastJobTrigger" />
<ref local="StockUpDownRateJobTrigger" />
<ref local="FinanceLeadingIndexJobTrigger" />
<ref local="GetDdxDateJobTrigger" />
<ref bean="clearUserOnlineWeekTrigger" />
<ref bean="clearUserOnlineMonthTrigger" />
<ref bean="clearUserOnlineYearTrigger" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@
<bean id="bbsNewsAct" class="com.jeecms.bbs.action.front.BbsNewsAct"/>
<bean id="stockUpAndDownRateAct" class="com.jeecms.bbs.action.front.StockUpAndDownRateAct"/>
<bean id="stockCollectionAct" class="com.jeecms.bbs.action.front.StockCollectionAct"/>
<bean id="stockDataAnalyseAct" class="com.jeecms.bbs.action.front.StockDataAnalyseAct"/>
</beans>
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
}

function turnToPage(pageno){
window.location.href="${base}/stockmessage/example.jhtml?nowPage="+pageno;
window.location.href="${base}/stockmessage/example.jhtml?nowPage="+pageno+"&sql="+"${sql!''}";
// var i;

// var tr_to_deal=document.getElementsByName("show_or_not1");
Expand Down
117 changes: 33 additions & 84 deletions src/main/WebContent/WEB-INF/t/cms/www/blue/选股/数据分析.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,33 +73,34 @@

function turnToPage(pageno){

var i;
window.location.href="${base}/stockmessage/analyse.jhtml?TYPE="+${TYPE!"1"}+"&nowPage="+pageno;
// var i;

var tr_to_deal=document.getElementsByName("show_or_not1");
// var tr_to_deal=document.getElementsByName("show_or_not1");

for(i=0;i<tr_to_deal.length;i++){
// for(i=0;i<tr_to_deal.length;i++){

if(tr_to_deal[i].id>=(pageno-1)*20+1 && tr_to_deal[i].id<=(pageno-1)*20+20){
tr_to_deal[i].style.display="";
}
else{
tr_to_deal[i].style.display="none";
}
// if(tr_to_deal[i].id>=(pageno-1)*20+1 && tr_to_deal[i].id<=(pageno-1)*20+20){
// tr_to_deal[i].style.display="";
// }
// else{
// tr_to_deal[i].style.display="none";
// }

document.getElementById("page").innerHTML=pageno.toString();
}
// document.getElementById("page").innerHTML=pageno.toString();
// }

tr_to_deal=document.getElementsByName("show_or_not2");
// tr_to_deal=document.getElementsByName("show_or_not2");

for(i=0;i<tr_to_deal.length;i++){
// for(i=0;i<tr_to_deal.length;i++){

if(tr_to_deal[i].id>=(pageno-1)*20+1 && tr_to_deal[i].id<=(pageno-1)*20+20){
tr_to_deal[i].style.display="";
}
else{
tr_to_deal[i].style.display="none";
}
}
// if(tr_to_deal[i].id>=(pageno-1)*20+1 && tr_to_deal[i].id<=(pageno-1)*20+20){
// tr_to_deal[i].style.display="";
// }
// else{
// tr_to_deal[i].style.display="none";
// }
// }
}

function color(){
Expand Down Expand Up @@ -138,7 +139,7 @@
}


window.onload=function(){turnToPage(1);color();}
window.onload=function(){color();}

</script>

Expand All @@ -148,7 +149,7 @@
<body>

<!--header-->[#include "../include/页头.html"/]<!--/header-->
[@stock_data reccomendation=1 type=TYPE ]
[@stock_data reccomendation=1 type=TYPE nowPage=nowPage]
<div class="main-wrap">
<div class="bodyWidth general_box">
<span style="float:left;"><img src="${base}/res/example2/tip.gif" align="absmiddle">股票推荐: </span>
Expand All @@ -173,13 +174,14 @@
<a style="display:none" id="type1" href="${base}/stockmessage/analyse.jhtml?TYPE=1">上升趋势线</a>
</span>
<span id="loding"></span>
[#if stock_list??]
[#assign pagsize=tag_pagination.totalPage]
<!-- [#if stock_list??]
[#assign pagsize=((stock_list?size!)/20)?int+1]
[#elseif stock_simple_list??]
[#assign pagsize=((stock_simple_list?size!)/20)?int+1]
[#else]
[#assign pagsize=1]
[/#if]
[/#if]-->
<input id="pagesize" style="display:none" value="${pagsize!}"/>
<div id="page_style" style="float:right;">

Expand All @@ -190,7 +192,7 @@
</span>
<input type="button" id="goto" value="跳转" onclick="turn();"/>
<input type="button" id="before" value="上一页" onclick="before();" />
<a id="page" ></a>
<a id="page" >${nowPage!""}</a>
<input type="button" id="after" value="下一页" onclick="after();" />
</div>
</div>
Expand All @@ -200,7 +202,7 @@

<table><tbody><tr>
<td>
<table width="400" border="1" style="border:1px solid #CBD6E8;">
<table width="300" border="1" style="border:1px solid #CBD6E8;">
<tbody>


Expand Down Expand Up @@ -323,69 +325,15 @@
<td style="white-space: nowrap;" align="center" id="SortDDE35"><a href="javascript:ShowPageContent(36,1,1,0,0,0);">主动率10日</a></td>
<td style="white-space: nowrap;" align="center" id="SortDDE36"><a href="javascript:ShowPageContent(37,1,1,0,0,0);">流通盘(万股)</a></td>

</tr>

[#if stock_simple_list??]



[#assign trid=1 /]
[#list stock_simple_list as stock]

<tr onclick="changeBKColor(1)" name="show_or_not2" id="${trid}">
[#assign trid=trid+1 /]

<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">-- </td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>
<td style="white-space: nowrap;text-align:center;">--</td>


</tr>


[/#list]
</tr>





[#elseif stock_list??]
[#if stock_list??]
[#assign trid=1 /]
[#list stock_list as stock]

[#list stock_list as stock]
<tr onclick="changeBKColor(1)" name="show_or_not2" id="${trid}">
[#assign trid=trid+1 /]

Expand Down Expand Up @@ -428,6 +376,7 @@
<td style="white-space: nowrap" id="not" class="textRight">${stock.LTP!}</td>

</tr>



[/#list]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@
import static freemarker.template.ObjectWrapper.DEFAULT_WRAPPER;

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

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;

import com.jeecms.bbs.action.directive.abs.AbstractTopicPageDirective;
import com.jeecms.bbs.entity.Stockmessage;
import com.jeecms.bbs.entity.reccomendstock;
import com.jeecms.bbs.manager.StockmessageMng;
import com.jeecms.common.bbsddx.GetDdxDateImpl;
import com.jeecms.common.page.Pagination;
import com.jeecms.common.web.freemarker.DirectiveUtils;

Expand All @@ -38,34 +39,52 @@ public void execute(Environment env, Map params, TemplateModel[] loopVars,
String type=DirectiveUtils.getString("type", params);
if(reccomendation!=null){
System.out.println(reccomendation);
if(reccomendation.trim().equals("1")){
stocklist=bbsTopicMng.getReccomendation_detail(type);
if(stocklist.isEmpty()){
List<reccomendstock> list=bbsTopicMng.getReccomendation_simp(type);
if(list.isEmpty()){
list=bbsTopicMng.getReccomendation_simp2(type);
}
paramWrap.put("stock_simple_list", DEFAULT_WRAPPER.wrap(list));
if(reccomendation.trim().equals("1")){
Pagination pagination =mng.getReccomendation_simp(type,nowPage,pageSize);
List<reccomendstock> list=null;
if(pagination==null||pagination.getList().isEmpty()){
pagination=mng.getReccomendation_simp2(type,nowPage,pageSize);
if(pagination!=null)
list=(List<reccomendstock>) pagination.getList();
}else{
list=(List<reccomendstock>) pagination.getList();
}
else{
stocklist=new ArrayList<Stockmessage>();
for(reccomendstock re:list){
GetDdxDateImpl getDdxDate=new GetDdxDateImpl();
Stockmessage msg=getDdxDate.getStockmessage(re.getStockID());
if(msg==null)
msg=new Stockmessage();
stocklist.add(msg);
}
paramWrap.put(OUT_PAGINATION, DEFAULT_WRAPPER.wrap(pagination));
paramWrap.put("stock_simple_list", DEFAULT_WRAPPER.wrap(list));
paramWrap.put("stock_list", DEFAULT_WRAPPER.wrap(stocklist));
System.out.println("put list");
}System.out.println("reccomendation=1");
System.out.println("reccomendation=1");
}
else if(reccomendation.trim().equals("2")){
String sql=DirectiveUtils.getString("sql", params);
if(sql!=null){
//在历史数据中进行查找
sql=" select bean from Stockmessage bean where "+sql;
sql+=" and bean.RIQI=(select max(bean.RIQI) from Stockmessage bean) ";
Pagination pagination =mng.getmess(sql,nowPage,pageSize);
paramWrap.put(OUT_PAGINATION, DEFAULT_WRAPPER.wrap(pagination));
if(pagination!=null){
stocklist=(List<Stockmessage>) pagination.getList();
}
}
paramWrap.put("stock_list", DEFAULT_WRAPPER.wrap(stocklist));
}
else{
paramWrap.put("stock_list", null);
//从ddx网站获得实时最新数据
GetDdxDateImpl getDdxDate=new GetDdxDateImpl();
stocklist=getDdxDate.getStockmessages(nowPage);
Map<String,String>comMsg=getDdxDate.getComMsg();
Pagination pagination=new Pagination(nowPage,pageSize
,Integer.parseInt(comMsg.get("total")),stocklist);
paramWrap.put(OUT_PAGINATION, DEFAULT_WRAPPER.wrap(pagination));
paramWrap.put("stock_list", DEFAULT_WRAPPER.wrap(stocklist));
}

}
Expand Down
21 changes: 9 additions & 12 deletions src/main/java/com/jeecms/bbs/action/front/StockCollectionAct.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,18 @@ public String example(HttpServletRequest request,
sql=sql.replaceAll(";", " ");
model.put("sql",sql);
System.out.println("sql:"+sql);
}
else{
model.put("sql","1=1");
}
}
String reccomendation=RequestUtils.getQueryParam(request, "reccomendation");
System.out.println("rec:"+reccomendation);
if(reccomendation!=null){
model.put("Reccomendation",reccomendation);
if(reccomendation.equals("1")){
model.put("datatype", "股票推荐:");
model.put("datatypename", "最新看涨");
}else{
model.put("datatype", "股票信息:");
model.put("datatypename", "最新数据");
}
model.put("Reccomendation",reccomendation);
if(reccomendation.equals("1")){
model.put("datatype", "股票推荐:");
model.put("datatypename", "最新看涨");
}else{
model.put("datatype", "股票信息:");
model.put("datatypename", "最新数据");
}
}
else{
model.put("Reccomendation",2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public String searchStock(Integer pageNo, HttpServletRequest request,
//System.out.println(gpdm);
String forumIdStr = RequestUtils.getQueryParam(request, "forumId");
String type = RequestUtils.getQueryParam(request, "TYPE");
Integer nowPage = RequestUtils.getIntParam(request, "nowPage");
nowPage=(nowPage==0?1:nowPage);

System.out.println("type in act:"+type);
Integer forumId = 0;
if (forumIdStr != null && StringUtils.isNotBlank(forumIdStr)) {
Expand All @@ -34,6 +37,7 @@ public String searchStock(Integer pageNo, HttpServletRequest request,
model.put("TYPE", type);
model.put("forumId", forumId);
model.put("RECCOMENDATION", 1);
model.put("nowPage", nowPage);



Expand Down
Loading

0 comments on commit f705e49

Please sign in to comment.