Browse Source

Merge branch 'dev' of http://www.ekexiu.com:3000/jiapeng/portal-web.git
into dev

jiapeng 7 years ago
parent
commit
45d2b4485b

+ 5 - 5
src/main/java/com/ekexiu/portal/question/QuestionDao.java

@ -1,9 +1,5 @@
1 1
package com.ekexiu.portal.question;
2 2

3
import java.sql.Connection;
4
import java.sql.SQLException;
5
import java.util.List;
6

7 3
import org.jfw.apt.annotation.DefaultValue;
8 4
import org.jfw.apt.annotation.Nullable;
9 5
import org.jfw.apt.orm.annotation.dao.Batch;
@ -29,6 +25,10 @@ import org.jfw.apt.orm.annotation.dao.param.SqlColumn;
29 25
import org.jfw.apt.orm.core.defaultImpl.LongHandler;
30 26
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
31 27

28
import java.sql.Connection;
29
import java.sql.SQLException;
30
import java.util.List;
31

32 32

33 33
@DAO
34 34
public interface QuestionDao {
@ -134,7 +134,7 @@ public interface QuestionDao {
134 134
	@LimitQuery
135 135
	@OrderBy("ORDER BY SCORE_DESC DESC")
136 136
	@Where("STATE='1'")
137
	List<SortedAnswwer> byQesScore(Connection con, String qid, @SqlColumn(handlerClass = StringHandler.class, value = { "(case when ballot=0 then '00000'  else  TO_CHAR(10000 *AGREE / BALLOT,'00009') end  || ID) < ?  " })  String score, int rows) throws SQLException;
137
	List<SortedAnswwer> byQesScore(Connection con, String qid, @SqlColumn(handlerClass = StringHandler.class, value = { "(case when ballot=0 then '00000'  else  TO_CHAR(10000 *AGREE / BALLOT,'00009') end || TO_CHAR(AGREE,'00000000000000000009') || ID) < ?  " })  String score, int rows) throws SQLException;
138 138

139 139
	@Insert
140 140
	int insert(Connection con,AnswerAgreeRec aar)throws SQLException;

+ 21 - 21
src/main/java/com/ekexiu/portal/question/Service.java

@ -1,21 +1,8 @@
1 1
package com.ekexiu.portal.question;
2 2

3
import java.io.ByteArrayInputStream;
4
import java.io.File;
5
import java.io.FileInputStream;
6
import java.io.FileOutputStream;
7
import java.io.IOException;
8
import java.io.InputStream;
9
import java.io.OutputStream;
10
import java.sql.Connection;
11
import java.sql.PreparedStatement;
12
import java.sql.SQLException;
13
import java.util.ArrayList;
14
import java.util.LinkedList;
15
import java.util.List;
16
import java.util.Map;
17
import java.util.concurrent.atomic.AtomicInteger;
18

3
import com.ekexiu.portal.notify.NotifyService;
4
import com.ekexiu.portal.notify.NotifyType;
5
import com.ekexiu.portal.util.SqlUtil;
19 6
import org.jfw.apt.annotation.Autowrie;
20 7
import org.jfw.apt.annotation.DefaultValue;
21 8
import org.jfw.apt.annotation.Nullable;
@ -38,9 +25,21 @@ import org.jfw.util.jdbc.PreparedStatementConfig;
38 25
import org.jfw.util.web.fileupload.Item;
39 26
import org.jfw.util.web.fileupload.UploadItemIterator;
40 27

41
import com.ekexiu.portal.notify.NotifyService;
42
import com.ekexiu.portal.notify.NotifyType;
43
import com.ekexiu.portal.util.SqlUtil;
28
import java.io.ByteArrayInputStream;
29
import java.io.File;
30
import java.io.FileInputStream;
31
import java.io.FileOutputStream;
32
import java.io.IOException;
33
import java.io.InputStream;
34
import java.io.OutputStream;
35
import java.sql.Connection;
36
import java.sql.PreparedStatement;
37
import java.sql.SQLException;
38
import java.util.ArrayList;
39
import java.util.LinkedList;
40
import java.util.List;
41
import java.util.Map;
42
import java.util.concurrent.atomic.AtomicInteger;
44 43

45 44
@Path("/question")
46 45
public class Service {
@ -573,10 +572,11 @@ public class Service {
573 572
	 */
574 573
	@Get
575 574
	@Path("/answer/qes/byScore")
576
	public List<SortedAnswwer> byQes(@JdbcConn Connection con, String qid, @DefaultValue("99999") int score, @DefaultValue("\"Z\"") String id,
575
	public List<SortedAnswwer> byQes(@JdbcConn Connection con, String qid, @DefaultValue("99999") int score, @DefaultValue("\"Z\"") String id,@DefaultValue("0") long agree,
577 576
			@DefaultValue("10000000") int rows) throws SQLException {
578 577
		String p = "000000" + score;
579
		p = p.substring(p.length() - 5) + id;
578
		String a = "00000000000000000000"+agree;
579
		p = p.substring(p.length() - 5) + a.substring(a.length()-20) + id;
580 580
		return questionDao.byQesScore(con, qid, p, rows);
581 581
	}
582 582


+ 1 - 1
src/main/java/com/ekexiu/portal/question/SortedAnswwer.java

@ -11,7 +11,7 @@ public class SortedAnswwer extends Answer {
11 11
	private transient String scoreDesc;
12 12
	
13 13
	
14
	@CalcColumn(nullable=false,handlerClass=StringHandler.class,column=" case when ballot=0 then '00000' else  TO_CHAR(10000 *AGREE / BALLOT,'00009') end  || ID SCORE_DESC")
14
	@CalcColumn(nullable=false,handlerClass=StringHandler.class,column=" case when ballot=0 then '00000' else  TO_CHAR(10000 *AGREE / BALLOT,'00009') end ||  TO_CHAR(AGREE,'00000000000000000009') || ID SCORE_DESC")
15 15
	public String getScoreDesc() {
16 16
		return scoreDesc;
17 17
	}