public void run() { //Calendar c = Calendar.getInstance();
Z, Y, u4 o9 p' Q //System.out.println("123456789");
( G* L" r$ u, a1 @% O! c7 K0 S try{4 \ G2 r c: K
if (!isRunning) {( m+ a) z. k* F+ b- G8 I5 Q( f
isRunning = true;" l$ u9 Q$ `0 g0 ?- i
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
1 J( x1 C: Q* P9 z7 M& x P8 g System.out.println("Task start-->Time:"+sdf.format(new Date()));
! d6 ^* B- o: }7 \% Y/ j0 \ g logger.info("Task start-->Time:"+sdf.format(new Date()));
% T* Z% ]7 `! V) S3 F. s String start = getStartOfMonth();1 u* N* k9 a* y4 [
String end = getEndOfMonth();3 T( v9 Z' U$ I* F1 `/ ]
logger.info("Task start-->Time:" + start + " end:" + end);, N) f6 O( A8 {+ C( [
Db db=Db.getSelf();
5 X2 L/ B. y6 u if(isOneDay()){
; o/ u0 ]/ b- e" F! q assessExpert(db);
# s0 J$ H& W- v7 c }
" [" [; v# h) Y: C+ R {3 h String sql="";5 L" L$ O. `: {$ K d# w: q
sql=" update t_qa_expert aa join (select a.id,count(*) sum1 from t_qa_expert a join t_qa_answer b on a.user_id=b.user_id where a.state=0 and b.verify='10' and answer_time between '2008-11-01 00:00:00' and '2009-01-31 11:59:59' and b.question_id in (select c.question_id from t_qa_question c,t_qa_question_category d where c.category=d.id and (d.parent_id=a.cate_id or d.id=a.cate_id)) group by a.user_id,a.cate_id ) ee on aa.id=ee.id set answer=ee.sum1";1 I% S2 e1 r) [ s2 g
sql=" update t_qa_expert aa join (select a.id,count(*) sum1 from t_qa_expert a join t_qa_answer b on a.user_id=b.user_id where a.state=0 and b.verify='10' and answer_time between '" + start +"' and '" + end +"' and b.question_id in (select c.question_id from t_qa_question c,t_qa_question_category d where c.category=d.id and (d.parent_id=a.cate_id or d.id=a.cate_id)) group by a.user_id,a.cate_id ) ee on aa.id=ee.id set answer=ee.sum1";5 T7 W- `4 ~; G) @- \* V
db.executeUpdate(sql);
# y* b) I+ {0 [& I sql=" update t_qa_expert aa join (select a.id,count(*) sum1 from t_qa_expert a join t_qa_answer b on a.user_id=b.user_id where a.state=1 and b.verify='10' and answer_time between '" + start +"' and '" + end +"' and b.question_id in (select c.question_id from t_qa_question c,t_qa_question_category d where c.category=d.id and (d.parent_id=a.cate_id or d.id=a.cate_id)) group by a.user_id,a.cate_id ) ee on aa.id=ee.id set answer=ee.sum1";9 P$ s% Z o# s
db.executeUpdate(sql);
- y5 x' }9 ?8 Q8 r: J sql=" update t_qa_expert aa join (select a.id,count(*) sum1 from t_qa_expert a join t_qa_answer b on a.user_id=b.user_id where a.state=0 and b.is_best='1' and b.verify='10' and answer_time between '2008-11-01 00:00:00' and '2009-01-31 11:59:59' and b.question_id in (select c.question_id from t_qa_question c,t_qa_question_category d where c.category=d.id and (d.parent_id=a.cate_id or d.id=a.cate_id)) group by a.user_id,a.cate_id ) ee on aa.id=ee.id set best_answer=ee.sum1";
( j3 z- y& `& i2 Y4 \ sql=" update t_qa_expert aa join (select a.id,count(*) sum1 from t_qa_expert a join t_qa_answer b on a.user_id=b.user_id where a.state=0 and b.is_best='1' and b.verify='10' and answer_time between '" + start +"' and '" + end +"' and b.question_id in (select c.question_id from t_qa_question c,t_qa_question_category d where c.category=d.id and (d.parent_id=a.cate_id or d.id=a.cate_id)) group by a.user_id,a.cate_id ) ee on aa.id=ee.id set best_answer=ee.sum1";: s. N/ }) U, [- l! g
db.executeUpdate(sql);7 L1 w% f5 X+ P
sql=" update t_qa_expert aa join (select a.id,count(*) sum1 from t_qa_expert a join t_qa_answer b on a.user_id=b.user_id where a.state=1 and b.is_best='1' and b.verify='10' and answer_time between '" + start +"' and '" + end +"' and b.question_id in (select c.question_id from t_qa_question c,t_qa_question_category d where c.category=d.id and (d.parent_id=a.cate_id or d.id=a.cate_id)) group by a.user_id,a.cate_id ) ee on aa.id=ee.id set best_answer=ee.sum1";# c& I9 B+ k. m' O% a: h
db.executeUpdate(sql);
! \4 F1 M: ^" s /*, H7 }8 X9 d+ [) O$ g- M+ _
* 五分中内回答数
- t4 X. \4 u b5 b6 o) s6 @% D */' @0 J5 i$ t& {0 B; D+ a% J) Z
sql=" update t_qa_expert aa join (select a.id,count(*) sum1 from t_qa_expert a join t_qa_answer b on a.user_id=b.user_id where a.state=0 and b.isfast='1' and b.verify='10' and answer_time between '" + start +"' and '" + end +"' and b.question_id in (select c.question_id from t_qa_question c,t_qa_question_category d where c.category=d.id and (d.parent_id=a.cate_id or d.id=a.cate_id)) group by a.user_id,a.cate_id ) ee on aa.id=ee.id set fast_answer=ee.sum1";9 k/ @+ x% i! c9 F8 t6 ?
db.executeUpdate(sql);
2 H) ?9 x8 u# @0 A0 |) ~- V sql=" update t_qa_expert aa join (select a.id,count(*) sum1 from t_qa_expert a join t_qa_answer b on a.user_id=b.user_id where a.state=1 and b.isfast='1' and b.verify='10' and answer_time between '" + start +"' and '" + end +"' and b.question_id in (select c.question_id from t_qa_question c,t_qa_question_category d where c.category=d.id and (d.parent_id=a.cate_id or d.id=a.cate_id)) group by a.user_id,a.cate_id ) ee on aa.id=ee.id set fast_answer=ee.sum1";
6 l! |% h. _5 W& S db.executeUpdate(sql);9 g% ^7 F3 N+ ^6 X# M
* l' y6 Y; u$ |+ m& e5 e4 N9 ] /* |