Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/dev' into test

jiapeng 7 gadi atpakaļ
vecāks
revīzija
2b504141f0
43 mainītis faili ar 3166 papildinājumiem un 218 dzēšanām
  1. 65 0
      src/main/java/com/ekexiu/operation/push/getui/Message.java
  2. 34 0
      src/main/java/com/ekexiu/operation/push/getui/MsgCondition.java
  3. 73 0
      src/main/java/com/ekexiu/operation/push/getui/MsgStyle.java
  4. 53 0
      src/main/java/com/ekexiu/operation/push/getui/NotificationMessage.java
  5. 16 0
      src/main/java/com/ekexiu/operation/push/getui/PushMessage.java
  6. 57 0
      src/main/java/com/ekexiu/operation/push/getui/TransmissionMessage.java
  7. 28 9
      src/main/java/com/ekexiu/portal/dao/ArticleDao.java
  8. 16 0
      src/main/java/com/ekexiu/portal/dao/FeedbackDao.java
  9. 170 116
      src/main/java/com/ekexiu/portal/dao/OrgDao.java
  10. 18 0
      src/main/java/com/ekexiu/portal/dao/OrgRegInfoDao.java
  11. 36 0
      src/main/java/com/ekexiu/portal/dao/PaperAuthorDao.java
  12. 32 0
      src/main/java/com/ekexiu/portal/dao/PatentAuthorDao.java
  13. 75 0
      src/main/java/com/ekexiu/portal/dao/PpaperDao.java
  14. 73 0
      src/main/java/com/ekexiu/portal/dao/PpatentDao.java
  15. 51 18
      src/main/java/com/ekexiu/portal/dao/ProfessorDao.java
  16. 15 0
      src/main/java/com/ekexiu/portal/dao/ResourceDao.java
  17. 24 9
      src/main/java/com/ekexiu/portal/dao/WatchDao.java
  18. 12 0
      src/main/java/com/ekexiu/portal/job/TaskJob.java
  19. 9 0
      src/main/java/com/ekexiu/portal/po/Article.java
  20. 92 0
      src/main/java/com/ekexiu/portal/po/Feedback.java
  21. 114 0
      src/main/java/com/ekexiu/portal/po/OrgRegInfo.java
  22. 91 0
      src/main/java/com/ekexiu/portal/po/Organization.java
  23. 47 0
      src/main/java/com/ekexiu/portal/po/PaperAuthor.java
  24. 44 0
      src/main/java/com/ekexiu/portal/po/PatentAuthor.java
  25. 130 0
      src/main/java/com/ekexiu/portal/po/Ppaper.java
  26. 163 0
      src/main/java/com/ekexiu/portal/po/Ppatent.java
  27. 10 0
      src/main/java/com/ekexiu/portal/po/Professor.java
  28. 10 0
      src/main/java/com/ekexiu/portal/po/Resource.java
  29. 5 6
      src/main/java/com/ekexiu/portal/po/Watch.java
  30. 40 0
      src/main/java/com/ekexiu/portal/pojo/AssedPaper.java
  31. 37 0
      src/main/java/com/ekexiu/portal/pojo/AssedPatent.java
  32. 18 0
      src/main/java/com/ekexiu/portal/service/ArticleService.java
  33. 46 41
      src/main/java/com/ekexiu/portal/service/DataDictService.java
  34. 52 0
      src/main/java/com/ekexiu/portal/service/OrgService.java
  35. 146 0
      src/main/java/com/ekexiu/portal/service/PpaperService.java
  36. 143 0
      src/main/java/com/ekexiu/portal/service/PpatentServcie.java
  37. 5 0
      src/main/java/com/ekexiu/portal/service/ProfessorService.java
  38. 29 1
      src/main/java/com/ekexiu/portal/service/ResourceService.java
  39. 240 17
      src/main/java/com/ekexiu/portal/service/SysService.java
  40. 14 1
      src/main/java/com/ekexiu/portal/service/WatchService.java
  41. 120 0
      src/main/java/com/ekexiu/push/service/FeedbackService.java
  42. 533 0
      src/main/java/com/ekexiu/push/service/PushService.java
  43. 180 0
      src/main/resources/database.sql

+ 65 - 0
src/main/java/com/ekexiu/operation/push/getui/Message.java

@ -0,0 +1,65 @@
1
package com.ekexiu.operation.push.getui;
2

3
import com.google.gson.annotations.SerializedName;
4

5
public class Message {
6
	
7
	//注册应用时生成的appkey 
8
	@SerializedName("appkey")
9
	private String appKey;
10
	//是否离线推送 
11
	@SerializedName("is_offline")
12
	private boolean isOffline = true;
13
	//消息应用类型,可选项:notification、link、notypopload、transmission
14
	private String msgtype;
15
	//消息离线存储有效期,单位:ms
16
	@SerializedName("offline_expire_time")
17
	private int offlineExpireTime = 1000*60*60*24;
18
	//选择推送消息使用网络类型,0:不限制,1:wifi
19
	
20
	@SerializedName("push_network_type")
21
	private int pushNetworkType = 0;
22

23
	public String getAppKey() {
24
		return appKey;
25
	}
26

27
	public void setAppKey(String appKey) {
28
		this.appKey = appKey;
29
	}
30

31
	public boolean isOffline() {
32
		return isOffline;
33
	}
34

35
	public void setOffline(boolean isOffline) {
36
		this.isOffline = isOffline;
37
	}
38

39
	public String getMsgtype() {
40
		return msgtype;
41
	}
42

43
	public void setMsgtype(String msgtype) {
44
		this.msgtype = msgtype;
45
	}
46

47
	public int getOfflineExpireTime() {
48
		return offlineExpireTime;
49
	}
50

51
	public void setOfflineExpireTime(int offlineExpireTime) {
52
		this.offlineExpireTime = offlineExpireTime;
53
	}
54

55
	public int getPushNetworkType() {
56
		return pushNetworkType;
57
	}
58

59
	public void setPushNetworkType(int pushNetworkType) {
60
		this.pushNetworkType = pushNetworkType==0?0:1;
61
	}
62
	
63
	
64
	
65
}

+ 34 - 0
src/main/java/com/ekexiu/operation/push/getui/MsgCondition.java

@ -0,0 +1,34 @@
1
package com.ekexiu.operation.push.getui;
2

3
import com.google.gson.annotations.SerializedName;
4

5
public class MsgCondition {
6
	private String key;
7
	private String[] values;
8
	@SerializedName("opt_type")
9
	private int optType;
10
	public String getKey() {
11
		return key;
12
	}
13
	public void setKey(String key) {
14
		this.key = key;
15
	}
16
	public String[] getValues() {
17
		return values;
18
	}
19
	public void setValues(String[] values) {
20
		this.values = values;
21
	}
22
	public int getOptType() {
23
		return optType;
24
	}
25
	public void setOptType(int optType) {
26
		this.optType = optType;
27
	}
28
	public MsgCondition(String key,String[] values,int optType){
29
		this.key = key;
30
		this.values = values;
31
		this.optType = optType;
32
	}
33
	
34
}

+ 73 - 0
src/main/java/com/ekexiu/operation/push/getui/MsgStyle.java

@ -0,0 +1,73 @@
1
package com.ekexiu.operation.push.getui;
2

3
import com.google.gson.annotations.SerializedName;
4

5
public class MsgStyle {
6
	//type 	integer 	是 	固定为1
7
	private int type=1;
8
	//text 	String 	是 	通知内容
9
	private String text;
10
	//title 	String 	是 	通知标题
11
	private String title;
12
	//logo 	String 	是 	通知的图标名称,包含后缀名(需要在客户端开发时嵌入),如“push.png”
13
	private String logo;
14
	//logourl 	String 	否 	通知图标URL地址
15
	private String logourl;
16
	//is_ring 	boolean 	否 	收到通知是否响铃:true响铃,false不响铃。默认响铃
17
	@SerializedName("is_ring")
18
	private boolean ring=true;
19
	//is_vibrate 	boolean 	否 	收到通知是否振动:true振动,false不振动。默认振动
20
	@SerializedName("is_vibrate")
21
	private boolean vibrate = true;
22
	//is_clearable 	boolean 	否 	通知是否可清除: true可清除,false不可清除。默认可清除	
23
	@SerializedName("is_clearable")
24
	private boolean clearable;
25
	public int getType() {
26
		return type;
27
	}
28
	public void setType(int type) {
29
		this.type = type;
30
	}
31
	public String getText() {
32
		return text;
33
	}
34
	public void setText(String text) {
35
		this.text = text;
36
	}
37
	public String getTitle() {
38
		return title;
39
	}
40
	public void setTitle(String title) {
41
		this.title = title;
42
	}
43
	public String getLogo() {
44
		return logo;
45
	}
46
	public void setLogo(String logo) {
47
		this.logo = logo;
48
	}
49
	public String getLogourl() {
50
		return logourl;
51
	}
52
	public void setLogourl(String logourl) {
53
		this.logourl = logourl;
54
	}
55
	public boolean isRing() {
56
		return ring;
57
	}
58
	public void setRing(boolean ring) {
59
		this.ring = ring;
60
	}
61
	public boolean isVibrate() {
62
		return vibrate;
63
	}
64
	public void setVibrate(boolean vibrate) {
65
		this.vibrate = vibrate;
66
	}
67
	public boolean isClearable() {
68
		return clearable;
69
	}
70
	public void setClearable(boolean clearable) {
71
		this.clearable = clearable;
72
	}
73
}

+ 53 - 0
src/main/java/com/ekexiu/operation/push/getui/NotificationMessage.java

@ -0,0 +1,53 @@
1
package com.ekexiu.operation.push.getui;
2

3
import com.google.gson.annotations.SerializedName;
4

5
public class NotificationMessage {
6
	//transmission_type 	boolean 	否 	收到消息是否立即启动应用,true为立即启动,false则广播等待启动,默认是否
7
	@SerializedName("transmission_type")
8
	private boolean transmissionType=false;
9
	
10
	//transmission_content 	String 	否 	透传内容
11
	@SerializedName("transmission_content")
12
	private String transmissionContent;
13
	
14
	//duration_begin 	String 	否 	设定展示开始时间,格式为yyyy-MM-dd HH:mm:ss
15
	@SerializedName("duration_begin")
16
	private String durationBegin;
17
	
18
	//duration_end 	String 	否 	设定展示结束时间,格式为yyyy-MM-dd HH:mm:ss
19
	@SerializedName("duration_end")
20
	private String durationEnd;
21
	//style 	Style 	是 	通知栏消息布局样式,见底下Style说明
22
	private MsgStyle style;
23
	public boolean isTransmissionType() {
24
		return transmissionType;
25
	}
26
	public void setTransmissionType(boolean transmissionType) {
27
		this.transmissionType = transmissionType;
28
	}
29
	public String getTransmissionContent() {
30
		return transmissionContent;
31
	}
32
	public void setTransmissionContent(String transmissionContent) {
33
		this.transmissionContent = transmissionContent;
34
	}
35
	public String getDurationBegin() {
36
		return durationBegin;
37
	}
38
	public void setDurationBegin(String durationBegin) {
39
		this.durationBegin = durationBegin;
40
	}
41
	public String getDurationEnd() {
42
		return durationEnd;
43
	}
44
	public void setDurationEnd(String durationEnd) {
45
		this.durationEnd = durationEnd;
46
	}
47
	public MsgStyle getStyle() {
48
		return style;
49
	}
50
	public void setStyle(MsgStyle style) {
51
		this.style = style;
52
	}
53
}

+ 16 - 0
src/main/java/com/ekexiu/operation/push/getui/PushMessage.java

@ -0,0 +1,16 @@
1
package com.ekexiu.operation.push.getui;
2

3
public class PushMessage {
4
	private final Message message;
5
	
6
	private NotificationMessage notification;
7
	private TransmissionMessage transmission;
8
	
9
	private String requestid;
10
	private String alias;
11
	
12
	public PushMessage(){
13
		this.message = new Message();
14
	}
15
	
16
}

+ 57 - 0
src/main/java/com/ekexiu/operation/push/getui/TransmissionMessage.java

@ -0,0 +1,57 @@
1
package com.ekexiu.operation.push.getui;
2

3
import java.util.Map;
4

5
import com.google.gson.annotations.SerializedName;
6

7
public class TransmissionMessage {
8
	//transmission_type 	boolean 	否 	收到消息是否立即启动应用,true为立即启动,false则广播等待启动,默认是否
9
	@SerializedName("transmission_type")
10
	private boolean transmissionType=false;
11
	
12
	//transmission_content 	String 	否 	透传内容
13
	@SerializedName("transmission_content")
14
	private String transmissionContent;
15
	
16
	//duration_begin 	String 	否 	设定展示开始时间,格式为yyyy-MM-dd HH:mm:ss
17
	@SerializedName("duration_begin")
18
	private String durationBegin;
19
	
20
	//duration_end 	String 	否 	设定展示结束时间,格式为yyyy-MM-dd HH:mm:ss
21
	@SerializedName("duration_end")
22
	private String durationEnd;
23
	//push_info 	Map 	否 	APNs消息内容
24
	@SerializedName("push_info")
25
	private Map<String,Object> pushInfo;
26
	public boolean isTransmissionType() {
27
		return transmissionType;
28
	}
29
	public void setTransmissionType(boolean transmissionType) {
30
		this.transmissionType = transmissionType;
31
	}
32
	public String getTransmissionContent() {
33
		return transmissionContent;
34
	}
35
	public void setTransmissionContent(String transmissionContent) {
36
		this.transmissionContent = transmissionContent;
37
	}
38
	public String getDurationBegin() {
39
		return durationBegin;
40
	}
41
	public void setDurationBegin(String durationBegin) {
42
		this.durationBegin = durationBegin;
43
	}
44
	public String getDurationEnd() {
45
		return durationEnd;
46
	}
47
	public void setDurationEnd(String durationEnd) {
48
		this.durationEnd = durationEnd;
49
	}
50
	public Map<String, Object> getPushInfo() {
51
		return pushInfo;
52
	}
53
	public void setPushInfo(Map<String, Object> pushInfo) {
54
		this.pushInfo = pushInfo;
55
	}
56
	
57
}

+ 28 - 9
src/main/java/com/ekexiu/portal/dao/ArticleDao.java

@ -92,6 +92,11 @@ public abstract class ArticleDao {
92 92
	@Where("STATUS = '1'")
93 93
	public abstract List<Article> queryProPublish(Connection con, String professorId) throws SQLException;
94 94
	
95
	@PageSelect
96
	@OrderBy(" ORDER BY MODIFY_TIME DESC ")
97
	@Where("STATUS = '1'")
98
	public abstract PageQueryResult<Article> pageQueryProPublish(Connection con, String professorId,int pageSize,int pageNo) throws SQLException;
99
	
95 100
	@SelectList
96 101
	@OrderBy(" ORDER BY MODIFY_TIME DESC ")
97 102
	@Where("STATUS IN ('0','1','2')")
@ -106,6 +111,11 @@ public abstract class ArticleDao {
106 111
	@Where("STATUS = '1'")
107 112
	public abstract List<Article> queryOrgPublish(Connection con, String orgId) throws SQLException;
108 113
	
114
	@PageSelect
115
	@OrderBy(" ORDER BY MODIFY_TIME DESC ")
116
	@Where("STATUS = '1'")
117
	public abstract PageQueryResult<Article> pageQueryOrgPublish(Connection con, String orgId,int pageSize,int pageNo) throws SQLException;
118
	
109 119
	@LimitSelect
110 120
	@OrderBy(" ORDER BY MODIFY_TIME DESC ")
111 121
	public abstract List<Article> queryLimit(Connection con,String orgId,@LessThan String modifyTime,int rows)throws SQLException;
@ -118,7 +128,7 @@ public abstract class ArticleDao {
118 128
		int index = 1;
119 129
		boolean hasArticleId = null != articleId;
120 130
		StringBuilder sql = new StringBuilder();
121
		sql.append("SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,ARTICLE_CONTENT,SUBJECT,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME FROM ARTICLE");
131
		sql.append("SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,ARTICLE_CONTENT,SUBJECT,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME,SHARE_ID FROM ARTICLE");
122 132
		sql.append(" WHERE STATUS = '1'");
123 133
		if(hasArticleId){
124 134
			sql.append(" AND ARTICLE_ID != ?");
@ -181,6 +191,7 @@ public abstract class ArticleDao {
181 191
                    article.setStatus(status);
182 192
                    article.setCreateTime(rs.getString(13));
183 193
                    article.setModifyTime(rs.getString(14));
194
                    article.setShareId(rs.getLong(15));
184 195
					articles.add(article);
185 196
				}
186 197
				return articles;
@ -198,7 +209,7 @@ public abstract class ArticleDao {
198 209
		boolean hasOrgId = null != orgId;
199 210
		boolean hasArticleId = null != articleId;
200 211
		StringBuilder sql = new StringBuilder();
201
		sql.append("SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,ARTICLE_CONTENT,SUBJECT,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME FROM ARTICLE");
212
		sql.append("SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,ARTICLE_CONTENT,SUBJECT,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME,SHARE_ID FROM ARTICLE");
202 213
		sql.append(" WHERE STATUS = '1'");
203 214
		if(hasProId){
204 215
			sql.append(" AND PROFESSOR_ID = ?");
@ -273,6 +284,7 @@ public abstract class ArticleDao {
273 284
                    article.setStatus(status);
274 285
                    article.setCreateTime(rs.getString(13));
275 286
                    article.setModifyTime(rs.getString(14));
287
                    article.setShareId(rs.getLong(15));
276 288
					articles.add(article);
277 289
				}
278 290
				return articles;
@ -289,7 +301,7 @@ public abstract class ArticleDao {
289 301
		boolean hasKeys = null != keys;
290 302
		boolean hasArticleId = null != articleId;
291 303
		StringBuilder sql = new StringBuilder();
292
		sql.append("SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,ARTICLE_CONTENT,SUBJECT,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME FROM ARTICLE");
304
		sql.append("SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,ARTICLE_CONTENT,SUBJECT,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME,SHARE_ID FROM ARTICLE");
293 305
		sql.append(" WHERE STATUS = '1'");
294 306
		if(hasArticleId){
295 307
			sql.append(" AND ARTICLE_ID != ?");
@ -367,6 +379,7 @@ public abstract class ArticleDao {
367 379
                    article.setStatus(status);
368 380
                    article.setCreateTime(rs.getString(13));
369 381
                    article.setModifyTime(rs.getString(14));
382
                    article.setShareId(rs.getLong(15));
370 383
					articles.add(article);
371 384
				}
372 385
				return articles;
@ -430,7 +443,7 @@ public abstract class ArticleDao {
430 443
        if(firstPage){
431 444
            queryResult.setPageNo(1);
432 445
            sql = new StringBuilder();
433
            sql.append("SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,ARTICLE_CONTENT,SUBJECT,INDUSTRY,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME FROM ARTICLE");
446
            sql.append("SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,ARTICLE_CONTENT,SUBJECT,INDUSTRY,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME,SHARE_ID FROM ARTICLE");
434 447
            sql.append(whereSql);
435 448
            sql.append(" ORDER BY PUBLISH_TIME DESC");
436 449
            sql.append(" LIMIT ").append(pageSize);
@ -446,7 +459,7 @@ public abstract class ArticleDao {
446 459
            --pageNo;
447 460
            int offset = (pageNo * pageSize);
448 461
            sql = new StringBuilder();
449
            sql.append("SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,ARTICLE_CONTENT,SUBJECT,INDUSTRY,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME FROM ARTICLE");
462
            sql.append("SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,ARTICLE_CONTENT,SUBJECT,INDUSTRY,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME,SHARE_ID FROM ARTICLE");
450 463
            sql.append(whereSql);
451 464
            sql.append(" ORDER BY PUBLISH_TIME DESC");
452 465
            sql.append(" LIMIT ").append(pageSize).append(" OFFSET ").append(offset);
@ -519,6 +532,7 @@ public abstract class ArticleDao {
519 532
                    article.setStatus(status);
520 533
                    article.setCreateTime(rs.getString(14));
521 534
                    article.setModifyTime(rs.getString(15));
535
                    article.setShareId(rs.getLong(16));
522 536
                    articles.add(article);
523 537
                }
524 538
                return queryResult;
@ -581,7 +595,7 @@ public abstract class ArticleDao {
581 595
        if(firstPage){
582 596
        	queryResult.setPageNo(1);
583 597
        	sql = new StringBuilder();
584
        	sql.append("(SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,ARTICLE_CONTENT,SUBJECT,INDUSTRY,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME FROM ARTICLE WHERE STATUS IN('0','2')");
598
        	sql.append("(SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,ARTICLE_CONTENT,SUBJECT,INDUSTRY,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME,SHARE_ID FROM ARTICLE WHERE STATUS IN('0','2')");
585 599
        	if(hasProfessorId){
586 600
            	sql.append(" AND PROFESSOR_ID = ?");
587 601
            }
@ -591,7 +605,7 @@ public abstract class ArticleDao {
591 605
        	if(hasArticleTitle){
592 606
        		sql.append(" AND ARTICLE_TITLE LIKE ?");
593 607
        	}
594
        	sql.append(" ORDER BY MODIFY_TIME DESC) UNION ALL (SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,ARTICLE_CONTENT,SUBJECT,INDUSTRY,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME FROM ARTICLE WHERE STATUS = '1'");
608
        	sql.append(" ORDER BY MODIFY_TIME DESC) UNION ALL (SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,ARTICLE_CONTENT,SUBJECT,INDUSTRY,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME,SHARE_ID FROM ARTICLE WHERE STATUS = '1'");
595 609
        	if(hasProfessorId){
596 610
            	sql.append(" AND PROFESSOR_ID = ?");
597 611
            }
@ -615,7 +629,7 @@ public abstract class ArticleDao {
615 629
            --pageNo;
616 630
            int offset = (pageNo * pageSize);
617 631
            sql = new StringBuilder();
618
            sql.append("(SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,ARTICLE_CONTENT,SUBJECT,INDUSTRY,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME FROM ARTICLE WHERE STATUS IN('0','2')");
632
            sql.append("(SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,ARTICLE_CONTENT,SUBJECT,INDUSTRY,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME,SHARE_ID FROM ARTICLE WHERE STATUS IN('0','2')");
619 633
        	if(hasProfessorId){
620 634
            	sql.append(" AND PROFESSOR_ID = ?");
621 635
            }
@ -625,7 +639,7 @@ public abstract class ArticleDao {
625 639
        	if(hasArticleTitle){
626 640
        		sql.append(" AND ARTICLE_TITLE LIKE ?");
627 641
        	}
628
        	sql.append(" ORDER BY MODIFY_TIME DESC) UNION ALL (SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,ARTICLE_CONTENT,SUBJECT,INDUSTRY,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME FROM ARTICLE WHERE STATUS = '1'");
642
        	sql.append(" ORDER BY MODIFY_TIME DESC) UNION ALL (SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,ARTICLE_CONTENT,SUBJECT,INDUSTRY,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME,SHARE_ID FROM ARTICLE WHERE STATUS = '1'");
629 643
        	if(hasProfessorId){
630 644
            	sql.append(" AND PROFESSOR_ID = ?");
631 645
            }
@ -718,6 +732,7 @@ public abstract class ArticleDao {
718 732
                    article.setStatus(status);
719 733
                    article.setCreateTime(rs.getString(14));
720 734
                    article.setModifyTime(rs.getString(15));
735
                    article.setShareId(rs.getLong(16));
721 736
                    articles.add(article);
722 737
                }
723 738
                return queryResult;
@ -900,5 +915,9 @@ public abstract class ArticleDao {
900 915
            try{ps.close();}catch(Exception e4){}
901 916
        }
902 917
    }
918
	
919
	@SelectOne
920
	@Nullable
921
	public abstract Article query(Connection con ,long shareId)throws SQLException;
903 922

904 923
}

+ 16 - 0
src/main/java/com/ekexiu/portal/dao/FeedbackDao.java

@ -0,0 +1,16 @@
1
package com.ekexiu.portal.dao;
2

3
import java.sql.Connection;
4
import java.sql.SQLException;
5

6
import org.jfw.apt.orm.annotation.dao.DAO;
7
import org.jfw.apt.orm.annotation.dao.method.operator.InsertAndGenKey;
8

9
import com.ekexiu.portal.po.Feedback;
10

11
@DAO
12
public interface FeedbackDao {
13

14
	@InsertAndGenKey(value = "id")
15
	long insert(Connection con, Feedback fb) throws SQLException;
16
}

+ 170 - 116
src/main/java/com/ekexiu/portal/dao/OrgDao.java

@ -1,8 +1,6 @@
1 1
package com.ekexiu.portal.dao;
2 2
3 3
import java.sql.Connection;
4
import java.sql.PreparedStatement;
5
import java.sql.ResultSet;
6 4
import java.sql.SQLException;
7 5
import java.util.List;
8 6
@ -10,19 +8,27 @@ import org.jfw.apt.annotation.Nullable;
10 8
import org.jfw.apt.orm.annotation.dao.Column;
11 9
import org.jfw.apt.orm.annotation.dao.DAO;
12 10
import org.jfw.apt.orm.annotation.dao.method.From;
11
import org.jfw.apt.orm.annotation.dao.method.Or;
13 12
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
14 13
import org.jfw.apt.orm.annotation.dao.method.Select;
14
import org.jfw.apt.orm.annotation.dao.method.SetSentence;
15
import org.jfw.apt.orm.annotation.dao.method.Where;
15 16
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
16 17
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
17 18
import org.jfw.apt.orm.annotation.dao.method.operator.LimitQuery;
19
import org.jfw.apt.orm.annotation.dao.method.operator.PageQuery;
18 20
import org.jfw.apt.orm.annotation.dao.method.operator.PageSelect;
21
import org.jfw.apt.orm.annotation.dao.method.operator.QueryList;
22
import org.jfw.apt.orm.annotation.dao.method.operator.QueryOne;
19 23
import org.jfw.apt.orm.annotation.dao.method.operator.QueryVal;
20 24
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
21 25
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
22 26
import org.jfw.apt.orm.annotation.dao.method.operator.Update;
23 27
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
28
import org.jfw.apt.orm.annotation.dao.param.In;
24 29
import org.jfw.apt.orm.annotation.dao.param.Like;
25 30
import org.jfw.apt.orm.annotation.dao.param.Set;
31
import org.jfw.apt.orm.annotation.dao.param.SqlColumn;
26 32
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
27 33
import org.jfw.util.PageQueryResult;
28 34
@ -32,145 +38,193 @@ import com.ekexiu.portal.pojo.EditOrganization;
32 38
33 39
@DAO
34 40
public abstract class OrgDao {
35
	
41
36 42
	@Insert
37
	public abstract int insert(Connection con, Organization org)throws SQLException;
38
	
43
	public abstract int insert(Connection con, Organization org) throws SQLException;
44
39 45
	@UpdateWith
40 46
	@From(Organization.class)
41
	public abstract int updateIsJoin(Connection con,String id,@Set String isJoin)throws SQLException;
42
	
47
	public abstract int updateIsJoin(Connection con, String id, @Set String isJoin) throws SQLException;
48
43 49
	@UpdateWith
44 50
	@From(Organization.class)
45
	public abstract int updateAuthStatus(Connection con,String id,@Set String authStatus)throws SQLException;
46
	
51
	public abstract int updateAuthStatus(Connection con, String id, @Set String authStatus) throws SQLException;
52
47 53
	@Update
48
	public abstract int update(Connection con,Organization org)throws SQLException;
49
	
54
	public abstract int update(Connection con, Organization org) throws SQLException;
50 55
51 56
	@Nullable
52 57
	@SelectOne
53
	public abstract Organization query(Connection con,String id) throws SQLException;
54
	
55
	public EditOrganization queryEditOrg(Connection con,String id) throws SQLException{
56
        int index = 1;
57
        String sql = "SELECT FOR_SHORT,ORG_URL,FOUND_TIME,PROVINCE,CITY,SUBJECT,INDUSTRY,ORG_SIZE,QUALIFICATION,IS_JOIN,AUTH_STATUS,ORG_ATTR,ID,NAME,ORG_TYPE,CREATE_TIME,MODIFY_TIME,DESCP FROM ORGANIZATION WHERE ID = ?";
58
        PreparedStatement ps = con.prepareStatement(sql);
59
        try{
60
            ps.setString(index++,id);
61
            ResultSet rs = ps.executeQuery();
62
            try{
63
                if(rs.next()){
64
                    EditOrganization editOrg = new EditOrganization();
65
                    String forShort = rs.getString(1);
66
                    if(rs.wasNull()){
67
                    	forShort = null;
68
                    }
69
                    editOrg.setForShort(forShort);
70
                    String orgUrl = rs.getString(2);
71
                    if(rs.wasNull()){
72
                    	orgUrl = null;
73
                    }
74
                    editOrg.setOrgUrl(orgUrl);
75
                    String foundTime = rs.getString(3);
76
                    if(rs.wasNull()){
77
                    	foundTime = null;
78
                    }
79
                    editOrg.setFoundTime(foundTime);
80
                    String province = rs.getString(4);
81
                    if(rs.wasNull()){
82
                    	province = null;
83
                    }
84
                    editOrg.setProvince(province);
85
                    String city = rs.getString(5);
86
                    if(rs.wasNull()){
87
                    	city = null;
88
                    }
89
                    editOrg.setCity(city);
90
                    String subject = rs.getString(6);
91
                    if(rs.wasNull()){
92
                    	subject = null;
93
                    }
94
                    editOrg.setSubject(subject);
95
                    String industry = rs.getString(7);
96
                    if(rs.wasNull()){
97
                    	industry = null;
98
                    }
99
                    editOrg.setIndustry(industry);
100
                    String orgSize = rs.getString(8);
101
                    if(rs.wasNull()){
102
                    	orgSize = null;
103
                    }
104
                    editOrg.setOrgSize(orgSize);
105
                    String qualification = rs.getString(9);
106
                    if(rs.wasNull()){
107
                    	qualification = null;
108
                    }
109
                    editOrg.setQualification(qualification);
110
                    editOrg.setIsJoin(rs.getString(10));
111
                    editOrg.setAuthStatus(rs.getString(11));
112
                    String orgAttr = rs.getString(12);
113
                    if(rs.wasNull()){
114
                    	orgAttr = null;
115
                    }
116
                    editOrg.setOrgAttr(orgAttr);
117
                    editOrg.setId(rs.getString(13));
118
                    editOrg.setName(rs.getString(14));
119
                    String orgType = rs.getString(15);
120
                    if(rs.wasNull()){
121
                    	orgType = null;
122
                    }
123
                    editOrg.setOrgType(orgType);
124
                    editOrg.setCreateTime(rs.getString(16));
125
                    editOrg.setModifyTime(rs.getString(17));
126
                    String descp = rs.getString(18);
127
                    if(rs.wasNull()){
128
                    	descp = null;
129
                    }
130
                    editOrg.setDescp(descp);
131
                    return editOrg;
132
                }else{
133
                    return null;
134
                }
135
            }finally{
136
                try{rs.close();}catch(Exception e1){}
137
            }
138
        }finally{
139
            try{ps.close();}catch(Exception e2){}
140
        }
141
    }
142
	
58
	public abstract Organization query(Connection con, String id) throws SQLException;
59
60
	@Nullable
61
	@QueryOne
62
	@From(Organization.class)
63
	@Select(Organization.class)
64
	public abstract EditOrganization queryEditOrg(Connection con, String id) throws SQLException;
65
66
	// public EditOrganization queryEditOrg(Connection con,String id) throws
67
	// SQLException{
68
	// int index = 1;
69
	// String sql = "SELECT
70
	// FOR_SHORT,ORG_URL,FOUND_TIME,PROVINCE,CITY,SUBJECT,INDUSTRY,ORG_SIZE,QUALIFICATION,IS_JOIN,AUTH_STATUS,ORG_ATTR,ID,NAME,ORG_TYPE,CREATE_TIME,MODIFY_TIME,DESCP
71
	// FROM ORGANIZATION WHERE ID = ?";
72
	// PreparedStatement ps = con.prepareStatement(sql);
73
	// try{
74
	// ps.setString(index++,id);
75
	// ResultSet rs = ps.executeQuery();
76
	// try{
77
	// if(rs.next()){
78
	// EditOrganization editOrg = new EditOrganization();
79
	// String forShort = rs.getString(1);
80
	// if(rs.wasNull()){
81
	// forShort = null;
82
	// }
83
	// editOrg.setForShort(forShort);
84
	// String orgUrl = rs.getString(2);
85
	// if(rs.wasNull()){
86
	// orgUrl = null;
87
	// }
88
	// editOrg.setOrgUrl(orgUrl);
89
	// String foundTime = rs.getString(3);
90
	// if(rs.wasNull()){
91
	// foundTime = null;
92
	// }
93
	// editOrg.setFoundTime(foundTime);
94
	// String province = rs.getString(4);
95
	// if(rs.wasNull()){
96
	// province = null;
97
	// }
98
	// editOrg.setProvince(province);
99
	// String city = rs.getString(5);
100
	// if(rs.wasNull()){
101
	// city = null;
102
	// }
103
	// editOrg.setCity(city);
104
	// String subject = rs.getString(6);
105
	// if(rs.wasNull()){
106
	// subject = null;
107
	// }
108
	// editOrg.setSubject(subject);
109
	// String industry = rs.getString(7);
110
	// if(rs.wasNull()){
111
	// industry = null;
112
	// }
113
	// editOrg.setIndustry(industry);
114
	// String orgSize = rs.getString(8);
115
	// if(rs.wasNull()){
116
	// orgSize = null;
117
	// }
118
	// editOrg.setOrgSize(orgSize);
119
	// String qualification = rs.getString(9);
120
	// if(rs.wasNull()){
121
	// qualification = null;
122
	// }
123
	// editOrg.setQualification(qualification);
124
	// editOrg.setIsJoin(rs.getString(10));
125
	// editOrg.setAuthStatus(rs.getString(11));
126
	// String orgAttr = rs.getString(12);
127
	// if(rs.wasNull()){
128
	// orgAttr = null;
129
	// }
130
	// editOrg.setOrgAttr(orgAttr);
131
	// editOrg.setId(rs.getString(13));
132
	// editOrg.setName(rs.getString(14));
133
	// String orgType = rs.getString(15);
134
	// if(rs.wasNull()){
135
	// orgType = null;
136
	// }
137
	// editOrg.setOrgType(orgType);
138
	// editOrg.setCreateTime(rs.getString(16));
139
	// editOrg.setModifyTime(rs.getString(17));
140
	// String descp = rs.getString(18);
141
	// if(rs.wasNull()){
142
	// descp = null;
143
	// }
144
	// editOrg.setDescp(descp);
145
	// return editOrg;
146
	// }else{
147
	// return null;
148
	// }
149
	// }finally{
150
	// try{rs.close();}catch(Exception e1){}
151
	// }
152
	// }finally{
153
	// try{ps.close();}catch(Exception e2){}
154
	// }
155
	// }
156
	//
143 157
	@SelectList
144
	public abstract List<Organization> query(Connection con)throws SQLException;
158
	public abstract List<Organization> query(Connection con) throws SQLException;
159
145 160
	@LimitQuery
146
	public abstract List<Organization> limitQuery(Connection con, @Like String name,int rows)throws SQLException;
147
	
161
	public abstract List<Organization> limitQuery(Connection con, @Like String name, int rows) throws SQLException;
162
148 163
	@LimitQuery
149 164
	@From(Organization.class)
150 165
	@OrderBy("ORDER BY NAME")
151 166
	@Select(Organization.class)
152
	public abstract List<EditOrganization> queryLimit(Connection con,@Like String name,int rows)throws SQLException;
153
	
167
	public abstract List<EditOrganization> queryLimit(Connection con, @Like String name, int rows) throws SQLException;
168
154 169
	@Nullable
155 170
	@QueryVal
156
	@Column(handlerClass=StringHandler.class,value="id")
171
	@Column(handlerClass = StringHandler.class, value = "id")
157 172
	@From(Organization.class)
158
	public abstract String queryByName(Connection con,String name)throws SQLException;
159
	
173
	public abstract String queryByName(Connection con, String name) throws SQLException;
174
160 175
	@Nullable
161 176
	@QueryVal
162
	@Column(handlerClass=StringHandler.class,value="auth_status")
177
	@Column(handlerClass = StringHandler.class, value = "auth_status")
163 178
	@From(Organization.class)
164
	public abstract String queryAuthStatus(Connection con,String id)throws SQLException;
165
	
179
	public abstract String queryAuthStatus(Connection con, String id) throws SQLException;
180
166 181
	@PageSelect
167
	public abstract PageQueryResult<Organization> query(Connection con,@Nullable  @Like String name,@Nullable String orgType,int pageSize,int pageNo) throws SQLException;
182
	public abstract PageQueryResult<Organization> query(Connection con, @Nullable @Like String name, @Nullable String orgType, int pageSize, int pageNo)
183
			throws SQLException;
168 184
169 185
	@From(Organization.class)
170 186
	@LimitQuery
171
	public abstract List<BaseOrganization> query(Connection con,@Nullable @Like String name,int rows) throws SQLException;
172
	
187
	public abstract List<BaseOrganization> query(Connection con, @Nullable @Like String name, int rows) throws SQLException;
188
173 189
	@From(Organization.class)
174 190
	@DeleteWith
175
	public abstract int delete(Connection con,String id)throws SQLException;
191
	public abstract int delete(Connection con, String id) throws SQLException;
192
193
	@From(Organization.class)
194
	@UpdateWith
195
	public abstract int updateSortNum(Connection con, String id, @Set long sortNum) throws SQLException;
196
197
	@From(Organization.class)
198
	@UpdateWith
199
	@SetSentence("PAGE_VIEWS = PAGE_VIEWS + 1")
200
	public abstract int incPageViews(Connection con, String id) throws SQLException;
201
202
	@SelectOne
203
	@Nullable
204
	public abstract Organization query(Connection con, long shareId) throws SQLException;
205
206
	@PageQuery
207
	@From(Organization.class)
208
	@OrderBy("ORDER BY SORT_NUM DESC,MODIFY_TIME DESC")
209
	@Select(Organization.class)
210
	@Or
211
	public abstract PageQueryResult<EditOrganization> query(Connection con,
212
			@SqlColumn(handlerClass = StringHandler.class, value = { "(NAME LIKE ? AND IS_JOIN ='1')", "(FOR_SHORT LIKE ? AND IS_JOIN ='1')",
213
					"(DESCP LIKE ?  AND IS_JOIN ='1')", "(SUBJECT LIKE ? AND IS_JOIN ='1') ", "(industry LIKE ?  AND IS_JOIN ='1')",
214
					"(ID IN (SELECT ORG_ID FROM RESOURCE WHERE RESOURCE_TYPE='2' AND RESOURCE_NAME LIKE ?) AND IS_JOIN ='1')",
215
					"(ID IN (SELECT ORG_ID FROM ARTICLE WHERE ARTICLE_TYPE='2' AND ARTICLE_TITLE LIKE ?) AND IS_JOIN ='1')" }) String kw,
216
			int pageSize, int pageNo) throws SQLException;
217
218
	@PageQuery
219
	@From(Organization.class)
220
	@OrderBy("ORDER BY SORT_NUM DESC,MODIFY_TIME DESC")
221
	@Select(Organization.class)
222
	@Where("IS_JOIN ='1'")
223
	public abstract PageQueryResult<EditOrganization> query(Connection con, int pageSize, int pageNo) throws SQLException;
224
	
225
	@QueryList
226
	@From(Organization.class)
227
	@Select(Organization.class)
228
	public abstract List<EditOrganization> query(Connection con,@In String[] id) throws SQLException;
229
176 230
}

+ 18 - 0
src/main/java/com/ekexiu/portal/dao/OrgRegInfoDao.java

@ -0,0 +1,18 @@
1
package com.ekexiu.portal.dao;
2

3
import java.sql.Connection;
4
import java.sql.SQLException;
5

6
import org.jfw.apt.annotation.Nullable;
7
import org.jfw.apt.orm.annotation.dao.DAO;
8
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
9

10
import com.ekexiu.portal.po.OrgRegInfo;
11

12
@DAO
13
public interface OrgRegInfoDao {
14

15
	@SelectOne
16
	@Nullable
17
	OrgRegInfo query(Connection con ,String name)throws SQLException;
18
}

+ 36 - 0
src/main/java/com/ekexiu/portal/dao/PaperAuthorDao.java

@ -0,0 +1,36 @@
1
package com.ekexiu.portal.dao;
2

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

7
import org.jfw.apt.orm.annotation.dao.DAO;
8
import org.jfw.apt.orm.annotation.dao.method.From;
9
import org.jfw.apt.orm.annotation.dao.method.SetSentence;
10
import org.jfw.apt.orm.annotation.dao.method.Where;
11
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
12
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
13
import org.jfw.apt.orm.annotation.dao.param.Set;
14

15
import com.ekexiu.portal.po.PaperAuthor;
16

17
@DAO
18
public interface PaperAuthorDao {
19
	
20
	@SelectList
21
	List<PaperAuthor> query(Connection con,String paperId) throws SQLException;
22
	
23
	@UpdateWith
24
	@From(PaperAuthor.class)
25
	@SetSentence("ASS_TIME=TO_CHAR(NOW(),'YYYYMMDDHH24MISS')")
26
	@Where("PROFESSOR_ID='################################'")
27
	int update(Connection con,String paperId,@Set String professorId,String name)throws SQLException;
28
	
29
	@UpdateWith
30
	@From(PaperAuthor.class)
31
	@SetSentence("PROFESSOR_ID='################################'")
32
	int update(Connection con,String paperId,String professorId)throws SQLException;
33
	
34
	
35
	
36
}

+ 32 - 0
src/main/java/com/ekexiu/portal/dao/PatentAuthorDao.java

@ -0,0 +1,32 @@
1
package com.ekexiu.portal.dao;
2

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

7
import org.jfw.apt.orm.annotation.dao.DAO;
8
import org.jfw.apt.orm.annotation.dao.method.From;
9
import org.jfw.apt.orm.annotation.dao.method.SetSentence;
10
import org.jfw.apt.orm.annotation.dao.method.Where;
11
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
12
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
13
import org.jfw.apt.orm.annotation.dao.param.Set;
14

15
import com.ekexiu.portal.po.PatentAuthor;
16
@DAO
17
public interface PatentAuthorDao {
18
	
19
	@SelectList
20
	List<PatentAuthor> query(Connection con,String patentId) throws SQLException;
21
	
22
	@UpdateWith
23
	@From(PatentAuthor.class)
24
	@SetSentence("ASS_TIME=TO_CHAR(NOW(),'YYYYMMDDHH24MISS')")
25
	@Where("PROFESSOR_ID='################################'")
26
	int update(Connection con,String patentId,@Set String professorId,String name)throws SQLException;
27
	
28
	@UpdateWith
29
	@From(PatentAuthor.class)
30
	@SetSentence("PROFESSOR_ID='################################'")
31
	int update(Connection con,String patentId,String professorId)throws SQLException;
32
}

+ 75 - 0
src/main/java/com/ekexiu/portal/dao/PpaperDao.java

@ -0,0 +1,75 @@
1
package com.ekexiu.portal.dao;
2

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

7
import org.jfw.apt.annotation.Nullable;
8
import org.jfw.apt.orm.annotation.dao.DAO;
9
import org.jfw.apt.orm.annotation.dao.method.From;
10
import org.jfw.apt.orm.annotation.dao.method.Or;
11
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
12
import org.jfw.apt.orm.annotation.dao.method.SetSentence;
13
import org.jfw.apt.orm.annotation.dao.method.operator.PageQuery;
14
import org.jfw.apt.orm.annotation.dao.method.operator.PageSelect;
15
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
16
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
17
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
18
import org.jfw.apt.orm.annotation.dao.param.Alias;
19
import org.jfw.apt.orm.annotation.dao.param.In;
20
import org.jfw.apt.orm.annotation.dao.param.Like;
21
import org.jfw.apt.orm.annotation.dao.param.Set;
22
import org.jfw.apt.orm.annotation.dao.param.SqlColumn;
23
import org.jfw.apt.orm.core.defaultImpl.FixLenStringHandler;
24
import org.jfw.util.PageQueryResult;
25

26
import com.ekexiu.portal.po.Ppaper;
27
import com.ekexiu.portal.pojo.AssedPaper;
28

29
@DAO
30
public interface PpaperDao {
31

32
	@SelectOne
33
	@Nullable
34
	Ppaper query(Connection con, String id) throws SQLException;
35

36
	@SelectList
37
	List<Ppaper> query(Connection con, @In String[] id) throws SQLException;
38

39
	@UpdateWith
40
	@From(Ppaper.class)
41
	int update(Connection con, String id, @Set @Nullable String keywords) throws SQLException;
42

43
	@PageQuery
44
	@OrderBy(" ORDER BY ASS_TIME DESC,ID ASC")
45
	PageQueryResult<AssedPaper> pageQueryWithProfessor(Connection con,
46
			@SqlColumn(handlerClass = FixLenStringHandler.class, value = { "A.PROFESSOR_ID=?" })  String professorId,
47
			@SqlColumn(handlerClass = FixLenStringHandler.class, value = { "P.NAME LIKE ?" }) String name, int pageSize, int pageNo) throws SQLException;
48

49
	@PageQuery
50
	@OrderBy(" ORDER BY ASS_TIME DESC,ID ASC")
51
	PageQueryResult<AssedPaper> pageQueryWithAuthor(Connection con,
52
			@SqlColumn(handlerClass = FixLenStringHandler.class, value = { "A.NAME=?" }) String author,
53
			@SqlColumn(handlerClass = FixLenStringHandler.class, value = { "((A.PROFESSOR_ID=?)  OR  (A.PROFESSOR_ID='################################'))" }) String id,
54
			@SqlColumn(handlerClass = FixLenStringHandler.class, value = { "P.NAME LIKE ?" }) String name, int pageSize, int pageNo) throws SQLException;
55
	
56
	@From(Ppaper.class)
57
	@UpdateWith
58
	@SetSentence("PAGE_VIEWS = PAGE_VIEWS + 1")
59
	 int incPageViews(Connection con,String id)throws SQLException;
60
	
61
	@PageSelect
62
	@OrderBy(" ORDER BY SORT_NUM DESC,CREATE_TIME DESC,ID DESC")
63
	PageQueryResult<Ppaper> query(Connection con,int pageSize,int pageNo) throws SQLException;
64
	
65
	@PageSelect
66
	@OrderBy(" ORDER BY SORT_NUM DESC,CREATE_TIME DESC,ID DESC")
67
	@Or
68
	PageQueryResult<Ppaper> query(Connection con,@Alias({"name","authors","keywords"}) @Like String cnt,int pageSize,int pageNo) throws SQLException;
69
	
70
	
71
	@SelectOne
72
	@Nullable
73
	Ppaper query(Connection con,long shareId)throws SQLException;
74

75
}

+ 73 - 0
src/main/java/com/ekexiu/portal/dao/PpatentDao.java

@ -0,0 +1,73 @@
1
package com.ekexiu.portal.dao;
2

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

7
import org.jfw.apt.annotation.Nullable;
8
import org.jfw.apt.orm.annotation.dao.DAO;
9
import org.jfw.apt.orm.annotation.dao.method.From;
10
import org.jfw.apt.orm.annotation.dao.method.Or;
11
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
12
import org.jfw.apt.orm.annotation.dao.method.SetSentence;
13
import org.jfw.apt.orm.annotation.dao.method.operator.PageQuery;
14
import org.jfw.apt.orm.annotation.dao.method.operator.PageSelect;
15
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
16
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
17
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
18
import org.jfw.apt.orm.annotation.dao.param.Alias;
19
import org.jfw.apt.orm.annotation.dao.param.In;
20
import org.jfw.apt.orm.annotation.dao.param.Like;
21
import org.jfw.apt.orm.annotation.dao.param.Set;
22
import org.jfw.apt.orm.annotation.dao.param.SqlColumn;
23
import org.jfw.apt.orm.core.defaultImpl.FixLenStringHandler;
24
import org.jfw.util.PageQueryResult;
25

26
import com.ekexiu.portal.po.Ppatent;
27
import com.ekexiu.portal.pojo.AssedPatent;
28

29
@DAO
30
public interface PpatentDao {
31
	@SelectOne
32
	@Nullable
33
	Ppatent query(Connection con, String id) throws SQLException;
34

35
	@SelectList
36
	List<Ppatent> query(Connection con, @In String[] id) throws SQLException;
37

38
	@UpdateWith
39
	@From(Ppatent.class)
40
	int update(Connection con, String id, @Set String keywords) throws SQLException;
41

42
	@PageQuery
43
	@OrderBy(" ORDER BY ASS_TIME DESC,ID ASC")
44
	PageQueryResult<AssedPatent> pageQueryWithProfessor(Connection con,
45
			@SqlColumn(handlerClass = FixLenStringHandler.class, value = { "A.PROFESSOR_ID=?" }) String professId,
46
			@SqlColumn(handlerClass = FixLenStringHandler.class, value = { "P.NAME LIKE ?" }) String name, int pageSize, int pageNo) throws SQLException;
47

48
	@PageQuery
49
	@OrderBy(" ORDER BY ASS_TIME DESC,ID ASC")
50
	PageQueryResult<AssedPatent> pageQueryWithAuthor(Connection con,
51
			@SqlColumn(handlerClass = FixLenStringHandler.class, value = { "A.NAME=?" }) String author,
52
			@SqlColumn(handlerClass = FixLenStringHandler.class, value = { "((A.PROFESSOR_ID=?)  OR  (A.PROFESSOR_ID='################################'))" }) String id,
53
			@SqlColumn(handlerClass = FixLenStringHandler.class, value = { "P.NAME LIKE ?" }) String name, int pageSize, int pageNo) throws SQLException;
54
	
55
	@From(Ppatent.class)
56
	@UpdateWith
57
	@SetSentence("PAGE_VIEWS = PAGE_VIEWS + 1")
58
	public abstract int incPageViews(Connection con,String id)throws SQLException;
59
	
60
	
61
	@PageSelect
62
	@OrderBy(" ORDER BY SORT_NUM DESC,CREATE_TIME DESC,ID DESC")
63
	PageQueryResult<Ppatent> query(Connection con,int pageSize,int pageNo) throws SQLException;
64
	
65
	@PageSelect
66
	@OrderBy(" ORDER BY SORT_NUM DESC,CREATE_TIME DESC,ID DESC")
67
	@Or
68
	PageQueryResult<Ppatent> query(Connection con,@Alias({"code","authors","name","keywords"}) @Like String cnt,int pageSize,int pageNo) throws SQLException;
69

70
	@SelectOne
71
	@Nullable
72
	Ppatent query(Connection con,long shareId)throws SQLException;
73
}

+ 51 - 18
src/main/java/com/ekexiu/portal/dao/ProfessorDao.java

@ -69,6 +69,10 @@ public abstract class ProfessorDao {
69 69
		}
70 70
	}
71 71
	
72
	@SelectOne
73
	@Nullable
74
	public abstract Professor query(Connection con,long shareId)throws SQLException;
75
	
72 76
	@UpdateWith
73 77
	@From(Professor.class)
74 78
	public abstract int updatePhone(Connection con, String id, @Set String phone) throws SQLException;
@ -172,7 +176,7 @@ public abstract class ProfessorDao {
172 176
	
173 177
	public List<EditProfessor> queryInvite(Connection con, String id) throws SQLException{
174 178
		int index = 1;
175
        String sql = "SELECT OFFICE,ADDRESS,ORG_ID,O.NAME,TITLE,AUTHENTICATION,P.AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,ORG_AUTH "
179
        String sql = "SELECT OFFICE,ADDRESS,ORG_ID,O.NAME,TITLE,AUTHENTICATION,P.AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,ORG_AUTH,P.SHARE_ID "
176 180
        		+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION O ON P.ORG_ID=O.ID "
177 181
        		+ " INNER JOIN LUSER L ON P.ID=L.ID WHERE L.INVITER_ID = ? ORDER BY P.CREATE_TIME DESC,P.ID";
178 182
        PreparedStatement ps = con.prepareStatement(sql);
@ -216,6 +220,7 @@ public abstract class ProfessorDao {
216 220
                    professor.setId(rs.getString(9));
217 221
                    professor.setName(rs.getString(10));
218 222
                    professor.setOrgAuth(rs.getString(11));
223
                    professor.setShareId(rs.getLong(12));
219 224
                    professors.add(professor);
220 225
                }
221 226
                return professors;
@ -275,7 +280,7 @@ public abstract class ProfessorDao {
275 280
	public EditProfessor queryBaseInfo(Connection con, String id) throws SQLException {
276 281
		int index = 1;
277 282
        String sql = "SELECT P.OFFICE,P.DEPARTMENT,P.TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,"
278
        		+ " P.ID,P.NAME,P.ADDRESS,P.ORG_AUTH,ORGANIZATION.NAME,P.ORG_ID,P.SCORE_PERCENT "
283
        		+ " P.ID,P.NAME,P.ADDRESS,P.ORG_AUTH,ORGANIZATION.NAME,P.ORG_ID,P.SCORE_PERCENT,P.SHARE_ID,P.PHONE,P.EMAIL,P.PROVINCE"
279 284
        		+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID = ORGANIZATION.ID WHERE P.ID = ?";
280 285
        PreparedStatement ps = con.prepareStatement(sql);
281 286
        try{
@ -329,6 +334,23 @@ public abstract class ProfessorDao {
329 334
                    	scorePercent = null;
330 335
                    }
331 336
                    professor.setScorePercent(scorePercent);
337
                    professor.setShareId(rs.getLong(14));
338
                    String phone = rs.getString(15);
339
                    if(rs.wasNull()){
340
                    	phone = null;
341
                    }
342
                    professor.setPhone(phone);
343
                    String email = rs.getString(16);
344
                    if(rs.wasNull()){
345
                    	email = null;
346
                    }
347
                    professor.setEmail(email);
348
                    String province = rs.getString(17);
349
                    if(rs.wasNull()){
350
                    	province = null;
351
                    }
352
                    professor.setProvince(province);
353
                    
332 354
                    return professor;
333 355
                }else{
334 356
                    return null;
@ -343,7 +365,7 @@ public abstract class ProfessorDao {
343 365
	
344 366
	public List<EditProfessor> queryByName(Connection con,String name,int total) throws SQLException{
345 367
        int index = 1;
346
        String sql = "SELECT P.OFFICE,P.DEPARTMENT,P.TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,P.ADDRESS,P.ORG_AUTH,ORGANIZATION.NAME,P.ORG_ID,P.SCORE_PERCENT "
368
        String sql = "SELECT P.OFFICE,P.DEPARTMENT,P.TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,P.ADDRESS,P.ORG_AUTH,ORGANIZATION.NAME,P.ORG_ID,P.SCORE_PERCENT,P.SHARE_ID "
347 369
        		+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID = ORGANIZATION.ID WHERE P.NAME LIKE ? ORDER BY P.SCORE_PERCENT DESC LIMIT " + total;
348 370
        PreparedStatement ps = con.prepareStatement(sql);
349 371
        try{
@ -398,6 +420,7 @@ public abstract class ProfessorDao {
398 420
                    	scorePercent = null;
399 421
                    }
400 422
                    professor.setScorePercent(scorePercent);
423
                    professor.setShareId(rs.getLong(14));
401 424
                    editProfessors.add(professor);
402 425
                }
403 426
                return editProfessors;
@ -419,7 +442,7 @@ public abstract class ProfessorDao {
419 442
	public EditProfessor queryEditBaseInfo(Connection con, String id) throws SQLException {
420 443
		int index = 1;
421 444
        String sql = "SELECT P.OFFICE,P.DEPARTMENT,P.TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,"
422
        		+ " P.ID,P.NAME,P.ADDRESS,P.STAR_LEVEL,P.CONSULT_COUNT,P.ORG_AUTH,ORGANIZATION.NAME "
445
        		+ " P.ID,P.NAME,P.ADDRESS,P.STAR_LEVEL,P.CONSULT_COUNT,P.ORG_AUTH,ORGANIZATION.NAME,P.SHARE_ID "
423 446
        		+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID = ORGANIZATION.ID WHERE P.ID = ?";
424 447
        PreparedStatement ps = con.prepareStatement(sql);
425 448
        try{
@ -465,6 +488,7 @@ public abstract class ProfessorDao {
465 488
                    	orgName = null;
466 489
                    }
467 490
                    professor.setOrgName(orgName);
491
                    professor.setShareId(rs.getLong(14));
468 492
                    return professor;
469 493
                }else{
470 494
                    return null;
@ -484,7 +508,7 @@ public abstract class ProfessorDao {
484 508
	public Professor query(Connection con, String id) throws SQLException{
485 509
        int index = 1;
486 510
        String sql = "SELECT P.OFFICE,P.SUBJECT,P.INDUSTRY,P.ADDRESS,P.DEPARTMENT,ORG_ID,P.TITLE,AUTHENTICATION,AUTH_TYPE,"
487
        		+ "P.AUTH_STATUS,P.ID,P.NAME,P.DESCP,P.CREATE_TIME,P.MODIFY_TIME,P.PHONE,P.EMAIL,P.ORG_AUTH,ORGANIZATION.NAME "
511
        		+ "P.AUTH_STATUS,P.ID,P.NAME,P.DESCP,P.CREATE_TIME,P.MODIFY_TIME,P.PHONE,P.EMAIL,P.ORG_AUTH,ORGANIZATION.NAME,P.SHARE_ID "
488 512
        		+ "FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID = ORGANIZATION.ID WHERE P.ID = ?";
489 513
        PreparedStatement ps = con.prepareStatement(sql);
490 514
        try{
@ -562,6 +586,7 @@ public abstract class ProfessorDao {
562 586
                    }
563 587
                    organization.setName(orgName);
564 588
                    professor.setOrganization(organization);
589
                    professor.setShareId(rs.getLong(20));
565 590
                    return professor;
566 591
                }else{
567 592
                    return null;
@ -576,7 +601,7 @@ public abstract class ProfessorDao {
576 601

577 602
	public List<Professor> query(Connection con) throws SQLException{
578 603
        String sql = "SELECT OFFICE,P.SUBJECT,P.INDUSTRY,P.PROVINCE,P.ADDRESS,DEPARTMENT,ORG_ID,organization.NAME AS ONAME,"
579
        		+ " TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME AS PNAME,P.DESCP,P.CREATE_TIME,P.MODIFY_TIME,P.ORG_AUTH "
604
        		+ " TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME AS PNAME,P.DESCP,P.CREATE_TIME,P.MODIFY_TIME,P.ORG_AUTH,P.SHARE_ID "
580 605
        		+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID=organization.ID ORDER BY ONAME,P.ID";
581 606
        PreparedStatement ps = con.prepareStatement(sql);
582 607
        try{
@ -641,6 +666,7 @@ public abstract class ProfessorDao {
641 666
                    professor.setCreateTime(rs.getString(16));
642 667
                    professor.setModifyTime(rs.getString(17));
643 668
                    professor.setOrgAuth(rs.getString(18));
669
                    professor.setShareId(rs.getLong(19));
644 670
                    professors.add(professor);
645 671
                }
646 672
                return professors;
@ -692,7 +718,7 @@ public abstract class ProfessorDao {
692 718
        boolean firstPage = (1 == pageNo);
693 719
        if(firstPage){
694 720
            queryResult.setPageNo(1);
695
            sql = "SELECT OFFICE,DEPARTMENT,TITLE,AUTHENTICATION,AUTH_TYPE,AUTH_STATUS,ID,NAME,ADDRESS,ORG_AUTH FROM PROFESSOR";
721
            sql = "SELECT OFFICE,DEPARTMENT,TITLE,AUTHENTICATION,AUTH_TYPE,AUTH_STATUS,ID,NAME,ADDRESS,ORG_AUTH,SHARE_ID FROM PROFESSOR";
696 722
            sql = sql + whereSql;
697 723
            sql = sql + " ORDER BY AUTH_TYPE DESC,ID";
698 724
            sql = sql + " LIMIT " + pageSize;
@ -756,6 +782,7 @@ public abstract class ProfessorDao {
756 782
                	}
757 783
                    professor.setAddress(address);
758 784
                    professor.setOrgAuth(rs.getString(10));
785
                    professor.setShareId(rs.getLong(11));
759 786
                    professors.add(professor);
760 787
                }
761 788
                return queryResult;
@ -771,7 +798,7 @@ public abstract class ProfessorDao {
771 798
        int index = 1;
772 799
        boolean hasOrgAuth = null != orgAuth;
773 800
        StringBuilder sql = new StringBuilder();
774
        sql.append("SELECT OFFICE,DEPARTMENT,TITLE,AUTHENTICATION,AUTH_TYPE,AUTH_STATUS,ID,NAME,ADDRESS,ORG_AUTH FROM PROFESSOR");
801
        sql.append("SELECT OFFICE,DEPARTMENT,TITLE,AUTHENTICATION,AUTH_TYPE,AUTH_STATUS,ID,NAME,ADDRESS,ORG_AUTH,SHARE_ID FROM PROFESSOR");
775 802
        sql.append(" WHERE ORG_ID = ?");
776 803
        if(hasOrgAuth){
777 804
            sql.append(" AND ORG_AUTH = ?");
@ -818,6 +845,7 @@ public abstract class ProfessorDao {
818 845
                	}
819 846
                    professor.setAddress(address);
820 847
                    professor.setOrgAuth(rs.getString(10));
848
                    professor.setShareId(rs.getLong(11));
821 849
                    professors.add(professor);
822 850
                }
823 851
                return professors;
@ -965,7 +993,7 @@ public abstract class ProfessorDao {
965 993
		if (1 == pageNo) {
966 994
			queryResult.setPageNo(1);
967 995
			sql = new StringBuilder();
968
			sql.append("SELECT OFFICE,P.ADDRESS,TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,ORG_ID,P.ORG_AUTH,ORGANIZATION.NAME"
996
			sql.append("SELECT OFFICE,P.ADDRESS,TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,ORG_ID,P.ORG_AUTH,ORGANIZATION.NAME,P.SHARE_ID"
969 997
	        		+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID=ORGANIZATION.ID ");
970 998
			if (whereSql.length() > 0) {
971 999
				sql.append(whereSql);
@ -984,7 +1012,7 @@ public abstract class ProfessorDao {
984 1012
			--pageNo;
985 1013
			int offset = (pageNo * pageSize);
986 1014
			sql = new StringBuilder();
987
			sql.append("SELECT OFFICE,P.ADDRESS,TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,ORG_ID,P.ORG_AUTH,ORGANIZATION.NAME"
1015
			sql.append("SELECT OFFICE,P.ADDRESS,TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,ORG_ID,P.ORG_AUTH,ORGANIZATION.NAME,P.SHARE_ID"
988 1016
	        		+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID=ORGANIZATION.ID ");
989 1017
			if (whereSql.length() > 0) {
990 1018
				sql.append(whereSql);
@ -1031,6 +1059,7 @@ public abstract class ProfessorDao {
1031 1059
                    	orgName = null;
1032 1060
                    }
1033 1061
                    professor.setOrgName(orgName);
1062
                    professor.setShareId(rs.getLong(12));
1034 1063
                    professors.add(professor);
1035 1064
				}
1036 1065
				return queryResult;
@ -1160,7 +1189,7 @@ public abstract class ProfessorDao {
1160 1189
		if (1 == pageNo) {
1161 1190
			queryResult.setPageNo(1);
1162 1191
			sql = new StringBuilder();
1163
			sql.append("SELECT OFFICE,P.ADDRESS,TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,ORG_ID,P.ORG_AUTH,ORGANIZATION.NAME"
1192
			sql.append("SELECT OFFICE,P.ADDRESS,TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,ORG_ID,P.ORG_AUTH,ORGANIZATION.NAME,P.SHARE_ID"
1164 1193
	        		+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID=ORGANIZATION.ID ");
1165 1194
			if (whereSql.length() > 0) {
1166 1195
				sql.append(whereSql);
@ -1179,7 +1208,7 @@ public abstract class ProfessorDao {
1179 1208
			--pageNo;
1180 1209
			int offset = (pageNo * pageSize);
1181 1210
			sql = new StringBuilder();
1182
			sql.append("SELECT OFFICE,P.ADDRESS,TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,ORG_ID,P.ORG_AUTH,ORGANIZATION.NAME"
1211
			sql.append("SELECT OFFICE,P.ADDRESS,TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,ORG_ID,P.ORG_AUTH,ORGANIZATION.NAME,P.SHARE_ID"
1183 1212
	        		+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID=ORGANIZATION.ID ");
1184 1213
			if (whereSql.length() > 0) {
1185 1214
				sql.append(whereSql);
@ -1254,6 +1283,7 @@ public abstract class ProfessorDao {
1254 1283
                    	orgName = null;
1255 1284
                    }
1256 1285
                    professor.setOrgName(orgName);
1286
                    professor.setShareId(rs.getLong(12));
1257 1287
                    professors.add(professor);
1258 1288
				}
1259 1289
				return queryResult;
@ -1375,7 +1405,7 @@ public abstract class ProfessorDao {
1375 1405
			queryResult.setPageNo(1);
1376 1406
			sql = new StringBuilder();
1377 1407
			sql.append("SELECT OFFICE,P.SUBJECT,P.INDUSTRY,P.ADDRESS,DEPARTMENT,ORGANIZATION.NAME,TITLE,"
1378
					+ " AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,STAR_LEVEL,CONSULT_COUNT,P.ORG_AUTH "
1408
					+ " AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,STAR_LEVEL,CONSULT_COUNT,P.ORG_AUTH,P.SHARE_ID "
1379 1409
					+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON ORG_ID=ORGANIZATION.ID ");
1380 1410
			if (whereSql.length() > 0) {
1381 1411
				sql.append(whereSql);
@ -1395,7 +1425,7 @@ public abstract class ProfessorDao {
1395 1425
			int offset = (pageNo * pageSize);
1396 1426
			sql = new StringBuilder();
1397 1427
			sql.append("SELECT OFFICE,P.SUBJECT,P.INDUSTRY,P.ADDRESS,DEPARTMENT,ORGANIZATION.NAME,TITLE,"
1398
					+ " AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,STAR_LEVEL,CONSULT_COUNT,P.ORG_AUTH "
1428
					+ " AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,STAR_LEVEL,CONSULT_COUNT,P.ORG_AUTH,P.SHARE_ID "
1399 1429
					+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON ORG_ID=ORGANIZATION.ID ");
1400 1430
			if (whereSql.length() > 0) {
1401 1431
				sql.append(whereSql);
@ -1482,6 +1512,7 @@ public abstract class ProfessorDao {
1482 1512
					professor.setStarLevel(rs.getBigDecimal(13));
1483 1513
					professor.setConsultCount(rs.getInt(14));
1484 1514
					professor.setOrgAuth(rs.getString(15));
1515
					professor.setShareId(rs.getLong(16));
1485 1516
					professors.add(professor);
1486 1517
				}
1487 1518
				return queryResult;
@ -1579,7 +1610,7 @@ public abstract class ProfessorDao {
1579 1610
			queryResult.setPageNo(1);
1580 1611
			sql = new StringBuilder();
1581 1612
			sql.append("SELECT OFFICE,P.SUBJECT,P.INDUSTRY,P.ADDRESS,DEPARTMENT,ORG_ID,organization.NAME,"
1582
					+ " TITLE,AUTHENTICATION,P.ID,P.NAME,P.DESCP,P.CREATE_TIME,P.MODIFY_TIME,P.ORG_AUTH "
1613
					+ " TITLE,AUTHENTICATION,P.ID,P.NAME,P.DESCP,P.CREATE_TIME,P.MODIFY_TIME,P.ORG_AUTH,P.SHARE_ID "
1583 1614
					+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID=organization.ID ");
1584 1615
			if (whereSql.length() > 0) {
1585 1616
				sql.append(whereSql);
@ -1599,7 +1630,7 @@ public abstract class ProfessorDao {
1599 1630
			int offset = (pageNo * pageSize);
1600 1631
			sql = new StringBuilder();
1601 1632
			sql.append("SELECT OFFICE,P.SUBJECT,P.INDUSTRY,P.ADDRESS,DEPARTMENT,ORG_ID,organization.NAME,"
1602
					+ " TITLE,AUTHENTICATION,P.ID,P.NAME,P.DESCP,P.CREATE_TIME,P.MODIFY_TIME,P.ORG_AUTH "
1633
					+ " TITLE,AUTHENTICATION,P.ID,P.NAME,P.DESCP,P.CREATE_TIME,P.MODIFY_TIME,P.ORG_AUTH,P.SHARE_ID "
1603 1634
					+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID=organization.ID ");
1604 1635
			if (whereSql.length() > 0) {
1605 1636
				sql.append(whereSql);
@ -1689,6 +1720,7 @@ public abstract class ProfessorDao {
1689 1720
					professor.setCreateTime(rs.getString(13));
1690 1721
					professor.setModifyTime(rs.getString(14));
1691 1722
					professor.setOrgAuth(rs.getString(15));
1723
					professor.setShareId(rs.getLong(16));
1692 1724
					professors.add(professor);
1693 1725
				}
1694 1726
				return queryResult;
@ -1793,7 +1825,7 @@ public abstract class ProfessorDao {
1793 1825
			queryResult.setPageNo(1);
1794 1826
			sql = new StringBuilder();
1795 1827
			sql.append("SELECT OFFICE,P.SUBJECT,P.INDUSTRY,P.ADDRESS,DEPARTMENT,O.NAME,TITLE,AUTHENTICATION,"
1796
					+ " P.AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,P.EMAIL,P.PHONE,L.ACTIVE_TIME,P.ORG_AUTH "
1828
					+ " P.AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,P.EMAIL,P.PHONE,L.ACTIVE_TIME,P.ORG_AUTH,P.SHARE_ID "
1797 1829
					+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION O ON P.ORG_ID=O.ID LEFT JOIN LUSER L ON P.ID=L.ID");
1798 1830
			if (whereSql.length() > 0) {
1799 1831
				sql.append(whereSql);
@ -1813,7 +1845,7 @@ public abstract class ProfessorDao {
1813 1845
			int offset = (pageNo * pageSize);
1814 1846
			sql = new StringBuilder();
1815 1847
			sql.append("SELECT OFFICE,P.SUBJECT,P.INDUSTRY,P.ADDRESS,DEPARTMENT,O.NAME,TITLE,AUTHENTICATION,"
1816
					+ " P.AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,P.EMAIL,P.PHONE,L.ACTIVE_TIME,P.ORG_AUTH "
1848
					+ " P.AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,P.EMAIL,P.PHONE,L.ACTIVE_TIME,P.ORG_AUTH,P.SHARE_ID "
1817 1849
					+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION O ON P.ORG_ID=O.ID LEFT JOIN LUSER L ON P.ID=L.ID");
1818 1850
			if (whereSql.length() > 0) {
1819 1851
				sql.append(whereSql);
@ -1897,6 +1929,7 @@ public abstract class ProfessorDao {
1897 1929
					userInfo.setActiveTime(rs.getString(15));
1898 1930
					userInfo.setActiveState(!(rs.getString(15)==null));
1899 1931
					userInfo.setOrgAuth(rs.getString(16));
1932
					userInfo.setShareId(rs.getLong(17));
1900 1933
					userInfos.add(userInfo);
1901 1934
				}
1902 1935
				return queryResult;

+ 15 - 0
src/main/java/com/ekexiu/portal/dao/ResourceDao.java

@ -19,6 +19,7 @@ import org.jfw.apt.orm.annotation.dao.method.Where;
19 19
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
20 20
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
21 21
import org.jfw.apt.orm.annotation.dao.method.operator.LimitSelect;
22
import org.jfw.apt.orm.annotation.dao.method.operator.PageSelect;
22 23
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
23 24
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
24 25
import org.jfw.apt.orm.annotation.dao.method.operator.Update;
@ -1079,6 +1080,12 @@ public abstract class ResourceDao {
1079 1080
	@Where("STATUS = '1'")
1080 1081
	public abstract List<Resource> queryProPublish(Connection con,String professorId) throws SQLException;
1081 1082
	
1083
	
1084
	@PageSelect
1085
	@OrderBy("ORDER BY PUBLISH_TIME DESC")
1086
	@Where("STATUS = '1'")
1087
	public abstract PageQueryResult<Resource> pageQueryProPublish(Connection con,String professorId,int pageSize,int pageNo) throws SQLException;
1088
	
1082 1089
	@SelectList
1083 1090
	@OrderBy("ORDER BY PUBLISH_TIME DESC")
1084 1091
	@Where("STATUS IN ('0','1')")
@ -1089,6 +1096,11 @@ public abstract class ResourceDao {
1089 1096
	@Where("STATUS = '1'")
1090 1097
	public abstract List<Resource> queryOrgPublish(Connection con,String orgId) throws SQLException;
1091 1098
	
1099
	@PageSelect
1100
	@OrderBy("ORDER BY PUBLISH_TIME DESC")
1101
	@Where("STATUS = '1'")
1102
	public abstract PageQueryResult<Resource> pageQueryOrgPublish(Connection con,String orgId,int pageSize,int pageNo) throws SQLException;
1103
	
1092 1104
	/**
1093 1105
	 * 按专家ID查询发布的所有资源
1094 1106
	 * @param con
@ -1763,4 +1775,7 @@ public abstract class ResourceDao {
1763 1775
        }
1764 1776
    }
1765 1777
	
1778
	@SelectOne
1779
	@Nullable
1780
	public abstract Resource query(Connection con,long shareId)throws SQLException;
1766 1781
}

+ 24 - 9
src/main/java/com/ekexiu/portal/dao/WatchDao.java

@ -4,15 +4,19 @@ import java.sql.Connection;
4 4
import java.sql.SQLException;
5 5
import java.util.List;
6 6

7
import org.jfw.apt.annotation.DefaultValue;
7 8
import org.jfw.apt.annotation.Nullable;
9
import org.jfw.apt.orm.annotation.dao.Column;
8 10
import org.jfw.apt.orm.annotation.dao.DAO;
9 11
import org.jfw.apt.orm.annotation.dao.method.From;
10 12
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
11 13
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
12 14
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
13 15
import org.jfw.apt.orm.annotation.dao.method.operator.PageSelect;
16
import org.jfw.apt.orm.annotation.dao.method.operator.QueryVal;
14 17
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
15 18
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
19
import org.jfw.apt.orm.core.defaultImpl.IntHandler;
16 20
import org.jfw.util.PageQueryResult;
17 21

18 22
import com.ekexiu.portal.po.Watch;
@ -21,30 +25,41 @@ import com.ekexiu.portal.po.Watch;
21 25
public abstract class WatchDao {
22 26
	@Insert
23 27
	public abstract int insert(Connection con, Watch watch) throws SQLException;
24
	
28

25 29
	@DeleteWith
26 30
	@From(Watch.class)
27 31
	public abstract int delete(Connection con, String professorId, String watchObject) throws SQLException;
28
	
32

29 33
	@DeleteWith
30 34
	@From(Watch.class)
31 35
	public abstract int deletePro(Connection con, String professorId) throws SQLException;
32
	
36

33 37
	@DeleteWith
34 38
	@From(Watch.class)
35 39
	public abstract int deleteWatch(Connection con, String watchObject) throws SQLException;
36
	
40

37 41
	@Nullable
38 42
	@SelectOne
39 43
	public abstract Watch queryOne(Connection con, String professorId, String watchObject) throws SQLException;
40
	
44

41 45
	@PageSelect
42 46
	@OrderBy(" ORDER BY CREATE_TIME DESC ")
43
	public abstract PageQueryResult<Watch> queryPro(Connection con, String professorId, 
44
			Integer watchType, int pageSize, int pageNo) throws SQLException;
45
	
47
	public abstract PageQueryResult<Watch> queryPro(Connection con, String professorId, short watchType, int pageSize, int pageNo) throws SQLException;
48

46 49
	@SelectList
47 50
	@OrderBy(" ORDER BY CREATE_TIME DESC ")
48 51
	public abstract List<Watch> queryWatch(Connection con, String watchObject) throws SQLException;
49
	
52

53
	@QueryVal
54
	@From(Watch.class)
55
	@Column(value = "COUNT(1)", handlerClass = IntHandler.class)
56
	@DefaultValue("0")
57
	public abstract int countWatchObject(Connection con, String professorId, short watchType) throws SQLException;
58

59
	@QueryVal
60
	@From(Watch.class)
61
	@Column(value = "COUNT(1)", handlerClass = IntHandler.class)
62
	@DefaultValue("0")
63
	public abstract int countProfessor(Connection con, String watchObject, short watchType) throws SQLException;
64

50 65
}

+ 12 - 0
src/main/java/com/ekexiu/portal/job/TaskJob.java

@ -13,6 +13,7 @@ import org.jfw.util.bean.BeanFactory;
13 13
import org.jfw.util.context.JfwAppContext;
14 14

15 15
import com.ekexiu.portal.service.WeixinService;
16
import com.ekexiu.push.service.PushService;
16 17

17 18
@Bean
18 19
public class TaskJob implements AfterBeanFactory {
@ -28,6 +29,7 @@ public class TaskJob implements AfterBeanFactory {
28 29
		DictTaskJobEntry dtje = (DictTaskJobEntry) bf.getBean("com_ekexiu_portal_job_DictTaskJobEntry");
29 30
		HotKeyJobEntry hkje = (HotKeyJobEntry) bf.getBean("com_ekexiu_portal_job_HotKeyJobEntry");
30 31
		final WeixinService weixin =(WeixinService)bf.getBean("com_ekexiu_portal_service_WeixinService");
32
		final PushService pushService =(PushService)bf.getBean("com_ekexiu_push_service_PushService");
31 33
		
32 34
		long delayTime = tje.getDelayTime();
33 35
		long task = getTimeMillis(tje.getTaskTime());
@ -50,12 +52,22 @@ public class TaskJob implements AfterBeanFactory {
50 52
		long hkjeTaskTime = hkjeTask - System.currentTimeMillis();
51 53
		hkjeTaskTime = hkjeTaskTime > 0 ? hkjeTaskTime : hkjeTaskTime + hkje.getDelayTime();
52 54
		service.scheduleAtFixedRate(hkje, hkjeTaskTime, hkje.getDelayTime(), TimeUnit.MILLISECONDS);
55
		if(hkjeTaskTime>300*1000){
56
			service.submit(hkje);
57
		}
58
		
53 59
		service.scheduleAtFixedRate(new Runnable() {
54 60
			@Override
55 61
			public void run() {
56 62
				weixin.refresh();
57 63
			}
58 64
		}, 0, weixin.getDelayTime(), TimeUnit.SECONDS);
65
		service.scheduleAtFixedRate(new Runnable() {
66
			@Override
67
			public void run() {
68
				pushService.refresh();				
69
			}
70
		}, 0, 2,TimeUnit.SECONDS);
59 71
	}
60 72
	private static long getTimeMillis(String time) {  
61 73
	    try {  

+ 9 - 0
src/main/java/com/ekexiu/portal/po/Article.java

@ -30,6 +30,7 @@ public class Article implements CreateTimeSupported, ModifyTimeSupported {
30 30
	private int articleAgree;
31 31
	private int pageViews;
32 32
	private String status;
33
	private long shareId;
33 34
	private EditProfessor professor;
34 35
	private Organization organization;
35 36
	private EditOrganization editOrganization;
@ -155,5 +156,13 @@ public class Article implements CreateTimeSupported, ModifyTimeSupported {
155 156
	public void setStatus(String status) {
156 157
		this.status = status;
157 158
	}
159
	@Column(DE.bigSerial)
160
	public long getShareId() {
161
		return shareId;
162
	}
163
	public void setShareId(long shareId) {
164
		this.shareId = shareId;
165
	}
166
	
158 167

159 168
}

+ 92 - 0
src/main/java/com/ekexiu/portal/po/Feedback.java

@ -0,0 +1,92 @@
1
package com.ekexiu.portal.po;
2

3
import org.jfw.apt.orm.annotation.entry.Column;
4
import org.jfw.apt.orm.annotation.entry.PrimaryKey;
5
import org.jfw.apt.orm.annotation.entry.Table;
6
import org.jfw.apt.orm.core.enums.DE;
7

8
import com.ekexiu.portal.basepo.CreateTimeSupported;
9

10
@PrimaryKey("id")
11
@Table
12
public class Feedback implements CreateTimeSupported{
13
	private long id;
14
	private String title;
15
	private int category;// int4 NOT NULL,
16
	private int schema;// int4 NOT NULL,
17
	private String param;// text NOT NULL,
18
	private String content;// text NOT NULL,
19
	private String createTime;// char(14) NOT NULL,
20
	private String  state;// char(1) NOT NULL,
21
	private String userId;
22
	
23
	@Override
24
	public String getCreateTime() {
25
		return this.createTime;
26
	}
27
	@Override
28
	public void setCreateTime(String createTime) {
29
		this.createTime = createTime;
30
	}
31
	
32
	@Column(DE.bigSerial)
33
	public long getId() {
34
		return id;
35
	}
36
	public void setId(long id) {
37
		this.id = id;
38
	}
39
	@Column(DE.Text_de)
40
	public String getTitle() {
41
		return title;
42
	}
43
	public void setTitle(String title) {
44
		this.title = title;
45
	}
46
	@Column(DE.int_de)
47
	public int getCategory() {
48
		return category;
49
	}
50
	public void setCategory(int category) {
51
		this.category = category;
52
	}
53
	@Column(DE.int_de)
54
	public int getSchema() {
55
		return schema;
56
	}
57
	public void setSchema(int schema) {
58
		this.schema = schema;
59
	}
60
	@Column(DE.text_de)
61
	public String getParam() {
62
		return param;
63
	}
64
	public void setParam(String param) {
65
		this.param = param;
66
	}
67
	@Column(DE.text_de)
68
	public String getContent() {
69
		return content;
70
	}
71
	
72
	public void setContent(String content) {
73
		this.content = content;
74
	}
75
	@Column(DE.singleChar)
76
	public String getState() {
77
		return state;
78
	}
79
	public void setState(String state) {
80
		this.state = state;
81
	}
82
	@Column(DE.Text_de)
83
	public String getUserId() {
84
		return userId;
85
	}
86
	public void setUserId(String userId) {
87
		this.userId = userId;
88
	}
89
	
90
	
91
	
92
}

+ 114 - 0
src/main/java/com/ekexiu/portal/po/OrgRegInfo.java

@ -0,0 +1,114 @@
1
package com.ekexiu.portal.po;
2

3
import org.jfw.apt.orm.annotation.entry.Column;
4
import org.jfw.apt.orm.annotation.entry.PrimaryKey;
5
import org.jfw.apt.orm.annotation.entry.Table;
6
import org.jfw.apt.orm.core.enums.DE;
7

8
@PrimaryKey("code")
9
@Table
10
public class OrgRegInfo {
11
	
12
	private String name;
13
//	 工商注册号:330108000016033
14
	private String num;
15
//	组织机构代码:673959654 
16
	private String code;
17
//	统一信用代码:91330106673959654P 
18
	private String  creditCode;
19
//	企业类型:私营有限责任公司(自然人控股或私营性质企业控股) 
20
	private String type;
21
//	行业:软件和信息技术服务业 
22
	private  String industry;
23
//	营业期限:2008-04-08至2038-04-07 
24
	private String operatingPeriod;
25
//	核准日期:2017-05-05 
26
	private String dayOfApproval;
27
//	登记机关:杭州市西湖区市场监督管理局 
28
	private String manager;
29
//	注册地址:浙江省杭州市西湖区转塘科技经济区块16号8幢 
30
	private String addr;
31
//	经营范围: 第一类增值电信业务中的因特网数据中心业务;第二类增值电信业务中的因特网接入服务业务;第二类增值电信业务中的信息服务业务(不含固定网电话信息服务),利用自有网站发布国内网络广告(涉及前置审批项目的,在有效期内方可经营)。服务:计算机软硬件、电子产品、数码产品的技术开发、技术服务,设计、制作、代理国内广告,成年人的非文化教育培训、成年人的非证书劳动职业技能培训(涉及前置审批的项目除外);批发、零售:计算机软硬件,电子产品(除专控),数码产品;会务服务,承办展览,展览展示设计。
32
	private String scopeOfBusiness;
33
	
34
	@Column(DE.text_de)
35
	public String getName() {
36
		return name;
37
	}
38
	public void setName(String name) {
39
		this.name = name;
40
	}
41
	@Column(DE.text_de)
42
	public String getNum() {
43
		return num;
44
	}
45
	public void setNum(String num) {
46
		this.num = num;
47
	}
48
	@Column(DE.text_de)
49
	public String getCode() {
50
		return code;
51
	}
52
	public void setCode(String code) {
53
		this.code = code;
54
	}
55
	@Column(DE.Text_de)
56
	public String getCreditCode() {
57
		return creditCode;
58
	}
59
	public void setCreditCode(String creditCode) {
60
		this.creditCode = creditCode;
61
	}
62
	@Column(DE.text_de)
63
	public String getType() {
64
		return type;
65
	}
66
	public void setType(String type) {
67
		this.type = type;
68
	}
69
	@Column(DE.text_de)
70
	public String getIndustry() {
71
		return industry;
72
	}
73
	public void setIndustry(String industry) {
74
		this.industry = industry;
75
	}
76
	@Column(DE.text_de)
77
	public String getOperatingPeriod() {
78
		return operatingPeriod;
79
	}
80
	public void setOperatingPeriod(String operatingPeriod) {
81
		this.operatingPeriod = operatingPeriod;
82
	}
83
	@Column(DE.text_de)
84
	public String getDayOfApproval() {
85
		return dayOfApproval;
86
	}
87
	public void setDayOfApproval(String dayOfApproval) {
88
		this.dayOfApproval = dayOfApproval;
89
	}
90
	@Column(DE.text_de)
91
	public String getManager() {
92
		return manager;
93
	}
94
	
95
	public void setManager(String manager) {
96
		this.manager = manager;
97
	}
98
	@Column(DE.text_de)
99
	public String getAddr() {
100
		return addr;
101
	}
102
	public void setAddr(String addr) {
103
		this.addr = addr;
104
	}
105
	@Column(DE.text_de)
106
	public String getScopeOfBusiness() {
107
		return scopeOfBusiness;
108
	}
109
	public void setScopeOfBusiness(String scopeOfBusiness) {
110
		this.scopeOfBusiness = scopeOfBusiness;
111
	}
112
	
113
	
114
}

+ 91 - 0
src/main/java/com/ekexiu/portal/po/Organization.java

@ -6,6 +6,7 @@ import org.jfw.apt.orm.annotation.entry.Table;
6 6
import org.jfw.apt.orm.annotation.entry.Unique;
7 7
import org.jfw.apt.orm.annotation.entry.Uniques;
8 8
import org.jfw.apt.orm.core.defaultImpl.FixLenStringHandler;
9
import org.jfw.apt.orm.core.defaultImpl.LongHandler;
9 10
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
10 11
import org.jfw.apt.orm.core.enums.DE;
11 12
@ -54,6 +55,37 @@ public class Organization extends BaseOrganization implements CreateTimeSupporte
54 55
	private String descp;
55 56
	private String createTime;
56 57
	private String modifyTime;
58
	
59
	/**
60
	 * 详细地址
61
	 */
62
	private String addr;
63
	/**
64
	 * 联系邮箱
65
	 */
66
	private String email;
67
	/**
68
	 * 联系电话
69
	 */
70
	private String contactNum;
71
	/**
72
	 * 客户领域
73
	 */
74
	private String fieldOfCustomer;
75
	/**
76
	 * 供应商领域
77
	 */
78
	private String fieldOfSupplier;
79
	/**
80
	 * 排序字段
81
	 */
82
	private long sortNum;
83
	/**
84
	 * 浏览量
85
	 */
86
	private long pageViews;
87
	private long shareId;
88
	
57 89
58 90
	@Column(value=DE.String_de,dbType="VARCHAR(20)")
59 91
	public String getForShort() {
@ -150,4 +182,63 @@ public class Organization extends BaseOrganization implements CreateTimeSupporte
150 182
	public void setModifyTime(String modifyTime) {
151 183
		this.modifyTime = modifyTime;
152 184
	}
185
	@Column(DE.Text_de)
186
	public String getAddr() {
187
		return addr;
188
	}
189
	public void setAddr(String addr) {
190
		this.addr = addr;
191
	}
192
	@Column(DE.Text_de)
193
	public String getEmail() {
194
		return email;
195
	}
196
	public void setEmail(String email) {
197
		this.email = email;
198
	}
199
	@Column(DE.Text_de)
200
	public String getContactNum() {
201
		return contactNum;
202
	}
203
	public void setContactNum(String contactNum) {
204
		this.contactNum = contactNum;
205
	}
206
	@Column(DE.Text_de)
207
	public String getFieldOfCustomer() {
208
		return fieldOfCustomer;
209
	}
210
	public void setFieldOfCustomer(String fieldOfCustomer) {
211
		this.fieldOfCustomer = fieldOfCustomer;
212
	}
213
	@Column(DE.Text_de)
214
	public String getFieldOfSupplier() {
215
		return fieldOfSupplier;
216
	}
217
	public void setFieldOfSupplier(String fieldOfSupplier) {
218
		this.fieldOfSupplier = fieldOfSupplier;
219
	}
220
	@Column(handlerClass=LongHandler.class,dbType="BIGINT",fixSqlValueWithInsert="0",insertable=true,renewable=false,nullable=false,queryable=true)
221
	public long getSortNum() {
222
		return sortNum;
223
	}
224
	public void setSortNum(long sortNum) {
225
		this.sortNum = sortNum;
226
	}
227
	@Column(handlerClass=LongHandler.class,dbType="BIGINT",fixSqlValueWithInsert="0",insertable=true,renewable=false,nullable=false,queryable=true)
228
	public long getPageViews() {
229
		return pageViews;
230
	}
231
	public void setPageViews(long pageViews) {
232
		this.pageViews = pageViews;
233
	}
234
	@Column(DE.bigSerial)
235
	public long getShareId() {
236
		return shareId;
237
	}
238
	public void setShareId(long shareId) {
239
		this.shareId = shareId;
240
	}
241
	
242
	
243
	
153 244
}

+ 47 - 0
src/main/java/com/ekexiu/portal/po/PaperAuthor.java

@ -0,0 +1,47 @@
1
package com.ekexiu.portal.po;
2

3
import org.jfw.apt.orm.annotation.entry.Column;
4
import org.jfw.apt.orm.annotation.entry.PrimaryKey;
5
import org.jfw.apt.orm.annotation.entry.Table;
6
import org.jfw.apt.orm.core.enums.DE;
7

8
@PrimaryKey({"paperId","name"})
9
@Table
10
public class PaperAuthor {
11
	private String paperId;
12
	private String name;
13
	private String professorId;
14
	private String assTime;
15
	
16
	@Column(DE.id_32)
17
	public String getPaperId() {
18
		return paperId;
19
	}
20
	public void setPaperId(String paperId) {
21
		this.paperId = paperId;
22
	}
23
	@Column(DE.text_de)
24
	public String getName() {
25
		return name;
26
	}
27
	public void setName(String name) {
28
		this.name = name;
29
	}
30
	@Column(DE.id_32)
31
	public String getProfessorId() {
32
		return professorId;
33
	}
34
	public void setProfessorId(String professorId) {
35
		this.professorId = professorId;
36
	}
37
	@Column(DE.dateTime_de)
38
	public String getAssTime() {
39
		return assTime;
40
	}
41
	public void setAssTime(String assTime) {
42
		this.assTime = assTime;
43
	}
44
	
45
	
46

47
}

+ 44 - 0
src/main/java/com/ekexiu/portal/po/PatentAuthor.java

@ -0,0 +1,44 @@
1
package com.ekexiu.portal.po;
2

3
import org.jfw.apt.orm.annotation.entry.Column;
4
import org.jfw.apt.orm.annotation.entry.PrimaryKey;
5
import org.jfw.apt.orm.annotation.entry.Table;
6
import org.jfw.apt.orm.core.enums.DE;
7

8
@PrimaryKey({"patentId","name"})
9
@Table
10
public class PatentAuthor {
11
	private String patentId;
12
	private String name;
13
	private String professorId;
14
	private String assTime;
15
	
16
	@Column(DE.id_32)
17
	public String getPatentId() {
18
		return patentId;
19
	}
20
	public void setPatentId(String patentId) {
21
		this.patentId = patentId;
22
	}
23
	@Column(DE.text_de)
24
	public String getName() {
25
		return name;
26
	}
27
	public void setName(String name) {
28
		this.name = name;
29
	}
30
	@Column(DE.id_32)
31
	public String getProfessorId() {
32
		return professorId;
33
	}
34
	public void setProfessorId(String professorId) {
35
		this.professorId = professorId;
36
	}
37
	@Column(DE.dateTime_de)
38
	public String getAssTime() {
39
		return assTime;
40
	}
41
	public void setAssTime(String assTime) {
42
		this.assTime = assTime;
43
	}
44
}

+ 130 - 0
src/main/java/com/ekexiu/portal/po/Ppaper.java

@ -0,0 +1,130 @@
1
package com.ekexiu.portal.po;
2

3
import org.jfw.apt.orm.annotation.entry.Column;
4
import org.jfw.apt.orm.annotation.entry.PrimaryKey;
5
import org.jfw.apt.orm.annotation.entry.Table;
6
import org.jfw.apt.orm.core.enums.DE;
7

8
import com.ekexiu.portal.basepo.CreateTimeSupported;
9

10
@PrimaryKey("id")
11
@Table
12
public class Ppaper implements CreateTimeSupported {
13
	private String id; // char(32)  NOT NULL,
14
	private String name; // text COLLATE "zh_CN.utf8" NOT NULL,
15
	private long pageViews;// int8 DEFAULT 0 NOT NULL,
16
	private String cn4periodical;// text,
17
	private String en4periodical;// text,
18
	private String periodicaltype;// text,
19
	private String pubDay;// text,
20
	private String summary;// text COLLATE "zh_CN.utf8" NOT NULL,
21
	private String keywords;// text COLLATE "zh_CN.utf8",
22
	private String ref_param;// text);
23
	private String createTime;
24
	private String authors;
25
	private long sortNum;
26
	private long shareId;
27
	
28
	
29
	public String getCreateTime() {
30
		return createTime;
31
	}
32
	public void setCreateTime(String createTime) {
33
		this.createTime = createTime;
34
	}
35
	@Column(DE.text_de)
36
	public String getAuthors() {
37
		return authors;
38
	}
39
	public void setAuthors(String authors) {
40
		this.authors = authors;
41
	}
42
	@Column(DE.long_de)
43
	public long getSortNum() {
44
		return sortNum;
45
	}
46
	public void setSortNum(long sortNum) {
47
		this.sortNum = sortNum;
48
	}
49
	@Column(DE.id_32)
50
	public String getId() {
51
		return id;
52
	}
53
	public void setId(String id) {
54
		this.id = id;
55
	}
56
	@Column(DE.text_de)
57
	public String getName() {
58
		return name;
59
	}
60

61
	public void setName(String name) {
62
		this.name = name;
63
	}
64
	@Column(value=DE.long_de)
65
	public long getPageViews() {
66
		return pageViews;
67
	}
68
	public void setPageViews(long pageViews) {
69
		this.pageViews = pageViews;
70
	}
71
	@Column(DE.Text_de)
72
	public String getCn4periodical() {
73
		return cn4periodical;
74
	}
75
	public void setCn4periodical(String cn4periodical) {
76
		this.cn4periodical = cn4periodical;
77
	}
78
	@Column(DE.Text_de)
79
	public String getEn4periodical() {
80
		return en4periodical;
81
	}
82
	public void setEn4periodical(String en4periodical) {
83
		this.en4periodical = en4periodical;
84
	}
85
	@Column(DE.Text_de)
86
	public String getPeriodicaltype() {
87
		return periodicaltype;
88
	}
89
	public void setPeriodicaltype(String periodicaltype) {
90
		this.periodicaltype = periodicaltype;
91
	}
92
	@Column(DE.text_de)
93
	public String getPubDay() {
94
		return pubDay;
95
	}
96
	public void setPubDay(String pubDay) {
97
		this.pubDay = pubDay;
98
	}
99
	@Column(DE.text_de)
100
	public String getSummary() {
101
		return summary;
102
	}
103
	public void setSummary(String summary) {
104
		this.summary = summary;
105
	}
106
	@Column(DE.Text_de)
107
	public String getKeywords() {
108
		return keywords;
109
	}
110
	public void setKeywords(String keywords) {
111
		this.keywords = keywords;
112
	}
113
	@Column(DE.Text_de)
114
	public String getRef_param() {
115
		return ref_param;
116
	}
117
	public void setRef_param(String ref_param) {
118
		this.ref_param = ref_param;
119
	}
120
	@Column(DE.bigSerial)
121
	public long getShareId() {
122
		return shareId;
123
	}
124
	public void setShareId(long shareId) {
125
		this.shareId = shareId;
126
	}
127
	
128
	
129
	
130
}

+ 163 - 0
src/main/java/com/ekexiu/portal/po/Ppatent.java

@ -0,0 +1,163 @@
1
package com.ekexiu.portal.po;
2

3
import org.jfw.apt.orm.annotation.entry.Column;
4
import org.jfw.apt.orm.annotation.entry.PrimaryKey;
5
import org.jfw.apt.orm.annotation.entry.Table;
6
import org.jfw.apt.orm.core.enums.DE;
7

8
import com.ekexiu.portal.basepo.CreateTimeSupported;
9

10
@PrimaryKey("id")
11
@Table
12
public class Ppatent implements CreateTimeSupported {
13
	private String id;// char(32) NOT NULL,
14
	private String name;// text COLLATE "zh_CN.utf8" NOT NULL,
15
	private long pageViews;// int8 DEFAULT 0 NOT NULL,
16
	private String code;// text NOT NULL,
17
	private String reqCode;// text NOT NULL,
18
	private String reqPerson;// text COLLATE "zh_CN.utf8",
19
	private String reqDay;// char(8) NOT NULL,
20
	private String pubDay;// char(8) NOT NULL,
21
	private String summary;// text COLLATE "zh_CN.utf8" NOT NULL,
22
	private String ref_param;// text ,
23
	private String keywords;// text COLLATE "zh_CN.utf8"
24
	private String createTime;
25
	private String authors;
26
	private long sortNum;
27
	private long shareId;
28

29
	public String getCreateTime() {
30
		return createTime;
31
	}
32

33
	public void setCreateTime(String createTime) {
34
		this.createTime = createTime;
35
	}
36

37
	@Column(DE.text_de)
38
	public String getAuthors() {
39
		return authors;
40
	}
41

42
	public void setAuthors(String authors) {
43
		this.authors = authors;
44
	}
45

46
	@Column(DE.long_de)
47
	public long getSortNum() {
48
		return sortNum;
49
	}
50

51
	public void setSortNum(long sortNum) {
52
		this.sortNum = sortNum;
53
	}
54

55
	@Column(DE.id_32)
56
	public String getId() {
57
		return id;
58
	}
59

60
	public void setId(String id) {
61
		this.id = id;
62
	}
63

64
	@Column(DE.text_de)
65
	public String getName() {
66
		return name;
67
	}
68

69
	public void setName(String name) {
70
		this.name = name;
71
	}
72

73
	@Column(DE.long_de)
74
	public long getPageViews() {
75
		return pageViews;
76
	}
77

78
	public void setPageViews(long pageViews) {
79
		this.pageViews = pageViews;
80
	}
81

82
	@Column(DE.Text_de)
83
	public String getCode() {
84
		return code;
85
	}
86

87
	public void setCode(String code) {
88
		this.code = code;
89
	}
90

91
	@Column(DE.Text_de)
92
	public String getReqCode() {
93
		return reqCode;
94
	}
95

96
	public void setReqCode(String reqCode) {
97
		this.reqCode = reqCode;
98
	}
99

100
	@Column(DE.Text_de)
101
	public String getReqPerson() {
102
		return reqPerson;
103
	}
104

105
	public void setReqPerson(String reqPerson) {
106
		this.reqPerson = reqPerson;
107
	}
108

109
	@Column(DE.Text_de)
110
	public String getReqDay() {
111
		return reqDay;
112
	}
113

114
	public void setReqDay(String reqDay) {
115
		this.reqDay = reqDay;
116
	}
117

118
	@Column(DE.Text_de)
119
	public String getPubDay() {
120
		return pubDay;
121
	}
122

123
	public void setPubDay(String pubDay) {
124
		this.pubDay = pubDay;
125
	}
126

127
	@Column(DE.text_de)
128
	public String getSummary() {
129
		return summary;
130
	}
131

132
	public void setSummary(String summary) {
133
		this.summary = summary;
134
	}
135

136
	@Column(DE.Text_de)
137
	public String getRef_param() {
138
		return ref_param;
139
	}
140

141
	public void setRef_param(String ref_param) {
142
		this.ref_param = ref_param;
143
	}
144

145
	@Column(DE.Text_de)
146
	public String getKeywords() {
147
		return keywords;
148
	}
149

150
	public void setKeywords(String keywords) {
151
		this.keywords = keywords;
152
	}
153
	@Column(DE.bigSerial)
154
	public long getShareId() {
155
		return shareId;
156
	}
157

158
	public void setShareId(long shareId) {
159
		this.shareId = shareId;
160
	}
161

162
	
163
}

+ 10 - 0
src/main/java/com/ekexiu/portal/po/Professor.java

@ -54,6 +54,7 @@ public class Professor implements CreateTimeSupported, ModifyTimeSupported{
54 54
	private Integer scoreValue;
55 55
	private Integer growthValue;
56 56
	private String scorePercent;
57
	private long shareId;
57 58
	
58 59
	private Organization organization;
59 60
	private List<Resource> resources;
@ -332,5 +333,14 @@ public class Professor implements CreateTimeSupported, ModifyTimeSupported{
332 333
	public void setScorePercent(String scorePercent) {
333 334
		this.scorePercent = scorePercent;
334 335
	}
336
	@Column(DE.bigSerial)
337
	public long getShareId() {
338
		return shareId;
339
	}
340
341
	public void setShareId(long shareId) {
342
		this.shareId = shareId;
343
	}
335 344
345
	
336 346
}

+ 10 - 0
src/main/java/com/ekexiu/portal/po/Resource.java

@ -77,6 +77,8 @@ public class Resource implements CreateTimeSupported, ModifyTimeSupported{
77 77
	private String resourceType;
78 78
	private String orgId;
79 79
	
80
	private long shareId;
81
	
80 82
	public List<Image> getImages() {
81 83
		return images;
82 84
	}
@ -269,5 +271,13 @@ public class Resource implements CreateTimeSupported, ModifyTimeSupported{
269 271
	public void setOrgId(String orgId) {
270 272
		this.orgId = orgId;
271 273
	}
274
	@Column(DE.bigSerial)
275
	public long getShareId() {
276
		return shareId;
277
	}
278
	public void setShareId(long shareId) {
279
		this.shareId = shareId;
280
	}
281
	
272 282
	
273 283
}

+ 5 - 6
src/main/java/com/ekexiu/portal/po/Watch.java

@ -5,7 +5,6 @@ import org.jfw.apt.orm.annotation.entry.PrimaryKey;
5 5
import org.jfw.apt.orm.annotation.entry.Table;
6 6
import org.jfw.apt.orm.annotation.entry.Unique;
7 7
import org.jfw.apt.orm.annotation.entry.Uniques;
8
import org.jfw.apt.orm.core.defaultImpl.WIntHandler;
9 8
import org.jfw.apt.orm.core.enums.DE;
10 9

11 10
import com.ekexiu.portal.basepo.CreateTimeSupported;
@ -18,7 +17,7 @@ public class Watch implements CreateTimeSupported {
18 17
	private String professorId;
19 18
	private String watchObject;
20 19
	private String createTime;
21
	private Integer watchType;
20
	private short watchType;
22 21
	private EditProfessor professor;
23 22
	private Resource resource;
24 23
	private Article article;
@ -50,7 +49,7 @@ public class Watch implements CreateTimeSupported {
50 49
		this.professorId = professorId;
51 50
	}
52 51
	
53
	@Column(DE.id_32)
52
	@Column(DE.string_de)
54 53
	public String getWatchObject() {
55 54
		return watchObject;
56 55
	}
@ -65,11 +64,11 @@ public class Watch implements CreateTimeSupported {
65 64
		this.createTime = createTime;
66 65
	}
67 66
	
68
	@Column(handlerClass=WIntHandler.class,dbType="INT",insertable=true,nullable=false,renewable=true,queryable=true)
69
	public Integer getWatchType() {
67
	@Column(DE.short_de)
68
	public short getWatchType() {
70 69
		return watchType;
71 70
	}
72
	public void setWatchType(Integer watchType) {
71
	public void setWatchType(short watchType) {
73 72
		this.watchType = watchType;
74 73
	}
75 74
	

+ 40 - 0
src/main/java/com/ekexiu/portal/pojo/AssedPaper.java

@ -0,0 +1,40 @@
1
package com.ekexiu.portal.pojo;
2

3
import org.jfw.apt.orm.annotation.entry.CalcColumn;
4
import org.jfw.apt.orm.annotation.entry.ExtendView;
5
import org.jfw.apt.orm.core.defaultImpl.FixLenStringHandler;
6
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
7

8
import com.ekexiu.portal.po.Ppaper;
9

10
@ExtendView(fromSentence = "PPAPER P INNER JOIN PAPER_AUTHOR A ON P.ID=A.PAPER_ID", tableAlias = "P")
11
public class AssedPaper extends Ppaper {
12
	
13
	private String professorId;
14
	private String authorName;
15
	private String assTime;
16
	
17
	@CalcColumn(column = "A.PROFESSOR_ID PROFESSOR_ID",handlerClass=FixLenStringHandler.class,nullable=false)
18
	public String getProfessorId() {
19
		return professorId;
20
	}
21
	public void setProfessorId(String professorId) {
22
		this.professorId = professorId;
23
	}
24
	@CalcColumn(column = "A.NAME AUTHOR_NAME",handlerClass=StringHandler.class,nullable=false)
25
	public String getAuthorName() {
26
		return authorName;
27
	}
28
	public void setAuthorName(String authorName) {
29
		this.authorName = authorName;
30
	}
31
	@CalcColumn(column="A.ASS_TIME ASS_TIME",handlerClass=StringHandler.class,nullable=false)
32
	public String getAssTime() {
33
		return assTime;
34
	}
35
	public void setAssTime(String assTime) {
36
		this.assTime = assTime;
37
	}
38
	
39
	
40
}

+ 37 - 0
src/main/java/com/ekexiu/portal/pojo/AssedPatent.java

@ -0,0 +1,37 @@
1
package com.ekexiu.portal.pojo;
2

3
import org.jfw.apt.orm.annotation.entry.CalcColumn;
4
import org.jfw.apt.orm.annotation.entry.ExtendView;
5
import org.jfw.apt.orm.core.defaultImpl.FixLenStringHandler;
6
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
7

8
import com.ekexiu.portal.po.Ppatent;
9

10
@ExtendView(fromSentence = "PPATENT P INNER JOIN PATENT_AUTHOR A ON P.ID=A.PATENT_ID", tableAlias = "P")
11
public class AssedPatent extends Ppatent {
12
	private String professorId;
13
	private String authorName;
14
	private String assTime;
15
	
16
	@CalcColumn(column = "A.PROFESSOR_ID PROFESSOR_ID",handlerClass=FixLenStringHandler.class,nullable=false)
17
	public String getProfessorId() {
18
		return professorId;
19
	}
20
	public void setProfessorId(String professorId) {
21
		this.professorId = professorId;
22
	}
23
	@CalcColumn(column = "A.NAME AUTHOR_NAME",handlerClass=StringHandler.class,nullable=false)
24
	public String getAuthorName() {
25
		return authorName;
26
	}
27
	public void setAuthorName(String authorName) {
28
		this.authorName = authorName;
29
	}
30
	@CalcColumn(column="A.ASS_TIME ASS_TIME",handlerClass=StringHandler.class,nullable=false)
31
	public String getAssTime() {
32
		return assTime;
33
	}
34
	public void setAssTime(String assTime) {
35
		this.assTime = assTime;
36
	}
37
}

+ 18 - 0
src/main/java/com/ekexiu/portal/service/ArticleService.java

@ -592,6 +592,12 @@ public class ArticleService {
592 592
		return this.articleDao.queryProPublish(con, professorId);
593 593
	}
594 594
	
595
	@Get
596
	@Path("/pqProPublish")
597
	public PageQueryResult<Article> pageQueryProPublish(@JdbcConn Connection con, String professorId,@DefaultValue("10") int pageSize,@DefaultValue("1") int pageNo) throws SQLException{
598
		return this.articleDao.pageQueryProPublish(con, professorId,pageSize,pageNo);
599
	}
600
	
595 601
	@Get
596 602
	@Path("/qaForDesk")
597 603
	public List<Article> queryForDesk(@JdbcConn Connection con, String professorId) throws SQLException{
@ -610,6 +616,12 @@ public class ArticleService {
610 616
		return this.articleDao.queryOrgPublish(con, orgId);
611 617
	}
612 618
	
619
	@Get
620
	@Path("/pqOrgPublish")
621
	public PageQueryResult<Article> pageQueryOrgPublish(@JdbcConn Connection con,String orgId,@DefaultValue("10") int pageSize,@DefaultValue("1") int pageNo)throws SQLException{
622
		return this.articleDao.pageQueryOrgPublish(con, orgId,pageSize,pageNo);
623
	}
624
	
613 625
	@Get
614 626
	@Path("/qlOrg")
615 627
	public List<Article> queryLimitOrg(@JdbcConn Connection con,String orgId,@DefaultValue("com.ekexiu.portal.service.ArticleService.MAX_MODIFYTIME") String modifyTime,@DefaultValue("20") int rows)throws SQLException{
@ -744,5 +756,11 @@ public class ArticleService {
744 756
		this.articleAgreeDao.delete(con, articleId);
745 757
		this.watchDao.deleteWatch(con, articleId);
746 758
	}
759
	
760
	@Path("/byShareId")
761
	@Get
762
	public Article query(@JdbcConn Connection con,long id) throws SQLException{
763
		return this.articleDao.query(con, id);
764
	}
747 765

748 766
}

+ 46 - 41
src/main/java/com/ekexiu/portal/service/DataDictService.java

@ -4,6 +4,7 @@ import java.sql.Connection;
4 4
import java.sql.SQLException;
5 5
import java.util.ArrayList;
6 6
import java.util.List;
7
import java.util.ListIterator;
7 8
8 9
import org.jfw.apt.annotation.Autowrie;
9 10
import org.jfw.apt.annotation.DefaultValue;
@ -23,17 +24,16 @@ import com.ekexiu.portal.pojo.DataDictCode;
23 24
24 25
@Path("/dataDict")
25 26
public class DataDictService {
26
	
27
27 28
	private volatile List<DataDictCode> hotSubjects = new ArrayList<DataDictCode>();
28 29
	private volatile List<DataDictCode> hotIndustries = new ArrayList<DataDictCode>();
29 30
	private volatile List<DataDictCode> hotKey = new ArrayList<DataDictCode>();
30
	
31
31 32
	@Autowrie
32 33
	private DataDictDao dataDictDao;
33
	
34
34 35
	private int defautLimitQuerySize = 5;
35
	
36
	
36
37 37
	public DataDictDao getDataDictDao() {
38 38
		return dataDictDao;
39 39
	}
@ -47,8 +47,8 @@ public class DataDictService {
47 47
	}
48 48
49 49
	public void setDefautLimitQuerySize(int defautLimitQuerySize) {
50
		if(defautLimitQuerySize>0)
51
		   this.defautLimitQuerySize = defautLimitQuerySize;
50
		if (defautLimitQuerySize > 0)
51
			this.defautLimitQuerySize = defautLimitQuerySize;
52 52
	}
53 53
54 54
	public List<DataDictCode> getHotSubjects() {
@ -77,9 +77,9 @@ public class DataDictService {
77 77
78 78
	@Post
79 79
	@Path
80
	public void insert(@JdbcConn(true) Connection con,String dictCode,String code,@Nullable String parentCode,String caption,String descp ) throws SQLException
81
	{
82
		DataDict  dd = new DataDict();
80
	public void insert(@JdbcConn(true) Connection con, String dictCode, String code, @Nullable String parentCode, String caption, String descp)
81
			throws SQLException {
82
		DataDict dd = new DataDict();
83 83
		dd.setDescp(descp);
84 84
		dd.setCaption(caption);
85 85
		dd.setCode(code);
@ -87,82 +87,87 @@ public class DataDictService {
87 87
		dd.setParentCode(parentCode);
88 88
		dataDictDao.insert(con, dd);
89 89
	}
90
	
90
91 91
	@Put
92 92
	@Path
93
	public void update(@JdbcConn(true) Connection con,@RequestBody DataDict dict) throws SQLException{
93
	public void update(@JdbcConn(true) Connection con, @RequestBody DataDict dict) throws SQLException {
94 94
		this.dataDictDao.update(con, dict);
95 95
	}
96
	
96
97 97
	@Get
98 98
	@Path("/{dictCode}")
99
	List<DataDict> query(@JdbcConn(false) Connection con,@PathVar String dictCode) throws SQLException{
100
		 return this.dataDictDao.query(con, dictCode);
99
	List<DataDict> query(@JdbcConn(false) Connection con, @PathVar String dictCode) throws SQLException {
100
		return this.dataDictDao.query(con, dictCode);
101 101
	}
102
	
102
103 103
	@Get
104 104
	@Path("/qa/{dictCode}")
105
	public List<DataDictCode> queryDict( @PathVar String dictCode) throws SQLException{
106
		 return this.queryDictCode(dictCode.equals("SUBJECT"));
105
	public List<DataDictCode> queryDict(@PathVar String dictCode) throws SQLException {
106
		return this.queryDictCode(dictCode.equals("SUBJECT"));
107 107
	}
108
	
108
109 109
	@Get
110 110
	@Path("/qaDictCode")
111
	public List<DataDictCode> queryDictCode(String dictCode) throws SQLException{
112
		 return this.queryDictCode(dictCode.equals("SUBJECT"));
111
	public List<DataDictCode> queryDictCode(String dictCode) throws SQLException {
112
		return this.queryDictCode(dictCode.equals("SUBJECT"));
113 113
	}
114
	
114
115 115
	@Get
116 116
	@Path("/qaHotKey")
117
	public List<DataDictCode> queryHotKey(String key){
117
	public List<DataDictCode> queryHotKey(String key) {
118 118
		List<DataDictCode> hotKeys = this.getHotKey();
119 119
		List<DataDictCode> keys = new ArrayList<DataDictCode>();
120 120
		for (DataDictCode hotKey : hotKeys) {
121
			if(hotKey.getCaption().indexOf(key) != -1){
121
			if (hotKey.getCaption().indexOf(key) != -1) {
122 122
				keys.add(hotKey);
123 123
			}
124 124
		}
125 125
		return keys;
126 126
	}
127
	
127
128 128
	@Get
129 129
	@Path("/qlHotKey")
130
	public List<DataDictCode> hotKey(@DefaultValue("10") int rows){
130
	public List<DataDictCode> hotKey(@DefaultValue("10") int rows) {
131 131
		List<DataDictCode> hotKeys = this.getHotKey();
132 132
		List<DataDictCode> keys = new ArrayList<DataDictCode>();
133
		for (int i = 0; i < rows; i++) {
134
			keys.add(hotKeys.get(i));
133
		ListIterator<DataDictCode> it = hotKeys.listIterator();
134
135
		while (it.hasNext() && (rows > 0)) {
136
			--rows;
137
			keys.add(it.next());
135 138
		}
136 139
		return keys;
137 140
	}
138
	
139
	private List<DataDictCode> queryDictCode(boolean isSubject){
141
142
	private List<DataDictCode> queryDictCode(boolean isSubject) {
140 143
		List<DataDictCode> ret = null;
141
		if(isSubject){
144
		if (isSubject) {
142 145
			ret = this.getHotSubjects();
143
		}else{
146
		} else {
144 147
			ret = this.getHotIndustries();
145 148
		}
146 149
		return ret;
147 150
	}
148
	
151
149 152
	@Get
150 153
	@Path("/qaCity")
151
	public List<DataDictCode> queryCity(@JdbcConn(false) Connection con,String dictCode,@Nullable String province) throws SQLException{
154
	public List<DataDictCode> queryCity(@JdbcConn(false) Connection con, String dictCode, @Nullable String province) throws SQLException {
152 155
		return this.dataDictDao.queryCity(con, dictCode, province);
153 156
	}
154
	
157
155 158
	@Get
156 159
	@Path("/{dictCode}/{code}")
157
	public DataDict query(@JdbcConn(false) Connection con,@PathVar String dictCode,@PathVar String code)throws SQLException{
158
		return this.dataDictDao.query(con, dictCode, code);	
160
	public DataDict query(@JdbcConn(false) Connection con, @PathVar String dictCode, @PathVar String code) throws SQLException {
161
		return this.dataDictDao.query(con, dictCode, code);
159 162
	}
160
	
163
161 164
	@Get
162 165
	@Path("/lq")
163
	List<LogicDict> limitQuery(@JdbcConn(false) Connection con,String dictCode,@Nullable String caption,@DefaultValue("5") int rows) throws SQLException{
164
		if(rows<=0) rows = this.defautLimitQuerySize;
165
		if(caption!=null) caption="%"+caption+"%";
166
	List<LogicDict> limitQuery(@JdbcConn(false) Connection con, String dictCode, @Nullable String caption, @DefaultValue("5") int rows) throws SQLException {
167
		if (rows <= 0)
168
			rows = this.defautLimitQuerySize;
169
		if (caption != null)
170
			caption = "%" + caption + "%";
166 171
		return this.dataDictDao.limitQuery(con, dictCode, caption, rows);
167 172
	}
168 173

+ 52 - 0
src/main/java/com/ekexiu/portal/service/OrgService.java

@ -13,9 +13,12 @@ import org.jfw.apt.web.annotation.operate.Get;
13 13
import org.jfw.apt.web.annotation.operate.Post;
14 14
import org.jfw.apt.web.annotation.param.JdbcConn;
15 15
import org.jfw.apt.web.annotation.param.PathVar;
16
import org.jfw.util.PageQueryResult;
16 17
import org.jfw.util.StringUtil;
17 18
18 19
import com.ekexiu.portal.dao.OrgDao;
20
import com.ekexiu.portal.dao.OrgRegInfoDao;
21
import com.ekexiu.portal.po.OrgRegInfo;
19 22
import com.ekexiu.portal.po.Organization;
20 23
import com.ekexiu.portal.pojo.EditOrganization;
21 24
@ -33,6 +36,19 @@ public class OrgService {
33 36
	@Autowrie
34 37
	private OrgDao orgDao;
35 38
	
39
	@Autowrie
40
	private OrgRegInfoDao orgRegInfoDao;
41
	
42
	
43
	
44
	public OrgRegInfoDao getOrgRegInfoDao() {
45
		return orgRegInfoDao;
46
	}
47
48
	public void setOrgRegInfoDao(OrgRegInfoDao orgRegInfoDao) {
49
		this.orgRegInfoDao = orgRegInfoDao;
50
	}
51
36 52
	public ImageService getImageService() {
37 53
		return imageService;
38 54
	}
@ -151,4 +167,40 @@ public class OrgService {
151 167
		return id;
152 168
	}
153 169
	
170
	@Path("/incPageViews")
171
	@Post
172
	public void incPageViews(@JdbcConn(true) Connection con ,String id)throws SQLException{
173
		this.orgDao.incPageViews(con, id);
174
	}
175
	
176
	@Get
177
	@Path("/regInfo")
178
	public OrgRegInfo queryRegInfo(@JdbcConn Connection con,String name) throws SQLException{
179
		return this.orgRegInfoDao.query(con, name);
180
	}
181
	@Get
182
	@Path("/byShareId")
183
	public Organization query(@JdbcConn Connection con,long id)throws SQLException{
184
		return this.orgDao.query(con, id);
185
	}
186
	
187
	@Get
188
	@Path("/find/pq")
189
	public PageQueryResult<EditOrganization> pageQuery(@JdbcConn Connection con,@Nullable String kw,@DefaultValue("20") int pageSize,@DefaultValue("1") int pageNo)throws SQLException
190
	{
191
		PageQueryResult<EditOrganization> pqr = kw==null?this.orgDao.query(con, pageSize, pageNo):this.orgDao.query(con,"%"+kw+"%", pageSize, pageNo);
192
		for (EditOrganization organization : pqr.getData()) {
193
			organization.setHasOrgLogo(this.imageService.hasOrgLogo(organization.getId()));
194
		}
195
		return pqr;
196
	}
197
	@Get
198
	@Path("/qm")
199
	public List<EditOrganization> query(@JdbcConn Connection con,String[] id)throws SQLException{
200
		List<EditOrganization> ret = this.orgDao.query(con, id);
201
		for (EditOrganization organization :ret) {
202
			organization.setHasOrgLogo(this.imageService.hasOrgLogo(organization.getId()));
203
		}
204
		return ret;
205
	}
154 206
}

+ 146 - 0
src/main/java/com/ekexiu/portal/service/PpaperService.java

@ -0,0 +1,146 @@
1
package com.ekexiu.portal.service;
2

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

7
import org.jfw.apt.annotation.Autowrie;
8
import org.jfw.apt.annotation.DefaultValue;
9
import org.jfw.apt.annotation.Nullable;
10
import org.jfw.apt.web.annotation.Path;
11
import org.jfw.apt.web.annotation.operate.Get;
12
import org.jfw.apt.web.annotation.operate.Post;
13
import org.jfw.apt.web.annotation.param.JdbcConn;
14
import org.jfw.util.PageQueryResult;
15

16
import com.ekexiu.portal.dao.PaperAuthorDao;
17
import com.ekexiu.portal.dao.PpaperDao;
18
import com.ekexiu.portal.po.PaperAuthor;
19
import com.ekexiu.portal.po.Ppaper;
20
import com.ekexiu.portal.pojo.AssedPaper;
21

22
@Path("/ppaper")
23
public class PpaperService {
24

25
	@Autowrie
26
	private PpaperDao ppaperDao;
27
	@Autowrie
28
	private PaperAuthorDao paperAuthorDao;
29

30
	public PpaperDao getPpaperDao() {
31
		return ppaperDao;
32
	}
33

34
	public void setPpaperDao(PpaperDao ppaperDao) {
35
		this.ppaperDao = ppaperDao;
36
	}
37

38
	public PaperAuthorDao getPaperAuthorDao() {
39
		return paperAuthorDao;
40
	}
41

42
	public void setPaperAuthorDao(PaperAuthorDao paperAuthorDao) {
43
		this.paperAuthorDao = paperAuthorDao;
44
	}
45

46
	@Get
47
	@Path("/qo")
48
	public Ppaper query(@JdbcConn Connection con, String id) throws SQLException {
49
		return this.ppaperDao.query(con, id);
50
	}
51

52
	@Get
53
	@Path("/qm")
54
	public List<Ppaper> query(@JdbcConn Connection con, String[] id) throws SQLException {
55
		return this.ppaperDao.query(con, id);
56
	}
57

58
	@Get
59
	@Path("/byProfessor")
60
	public PageQueryResult<AssedPaper> queryByProfessor(@JdbcConn Connection con, String id, @Nullable String name, @DefaultValue("10") int pageSize,
61
			@DefaultValue("1") int pageNo) throws SQLException {
62
		if (name == null) {
63
			name = "%";
64
		} else {
65
			name = "%" + name + "%";
66
		}
67
		return this.ppaperDao.pageQueryWithProfessor(con, id, name, pageSize, pageNo);
68
	}
69

70
	@Get
71
	@Path("/byAuthor")
72
	public PageQueryResult<AssedPaper> queryByAuthor(@JdbcConn Connection con, String author, String id, @Nullable String name,
73
			@DefaultValue("10") int pageSize, @DefaultValue("1") int pageNo) throws SQLException {
74
		if (name == null) {
75
			name = "%";
76
		} else {
77
			name = "%" + name + "%";
78
		}
79
		return this.ppaperDao.pageQueryWithAuthor(con, author, id, name, pageSize, pageNo);
80
	}
81

82
	@Get
83
	@Path("/authors")
84
	public List<PaperAuthor> queryAuthors(@JdbcConn Connection con, String id) throws SQLException {
85
		return this.paperAuthorDao.query(con, id);
86
	}
87

88
	@Get
89
	@Path("/pq")
90
	public PageQueryResult<Ppaper> pageQuery(@JdbcConn Connection con, @Nullable String qw, @DefaultValue("20") int pageSize, @DefaultValue("1") int pageNo)
91
			throws SQLException {
92
		return null == qw ? this.ppaperDao.query(con, pageSize, pageNo) : this.ppaperDao.query(con, "%" + qw + "%", pageSize, pageNo);
93
	}
94

95
	/**
96
	 * 
97
	 * @param con
98
	 * @param uid
99
	 *            专家ID(用户ID)
100
	 * @param id
101
	 *            论文ID
102
	 * @param author
103
	 *            作者名称
104
	 * @return
105
	 * @throws SQLException
106
	 */
107
	@Post
108
	@Path("/ass")
109
	public int ass(@JdbcConn(true) Connection con, String uid, String id, String author) throws SQLException {
110
		return this.paperAuthorDao.update(con, id, uid, author);
111
	}
112

113
	/**
114
	 * 
115
	 * @param con
116
	 * @param uid
117
	 *            专家ID(用户ID)
118
	 * @param id
119
	 *            论文ID
120
	 * @return
121
	 * @throws SQLException
122
	 */
123
	@Post
124
	@Path("/cAss")
125
	public int cAss(@JdbcConn(true) Connection con, String uid, String id) throws SQLException {
126
		return this.paperAuthorDao.update(con, id, uid);
127
	}
128

129
	@Post
130
	@Path("/incPageViews")
131
	public void incPageViews(@JdbcConn(true) Connection con, String id) throws SQLException {
132
		this.ppaperDao.incPageViews(con, id);
133
	}
134

135
	@Post
136
	@Path("/kw")
137
	public void update(@JdbcConn(true) Connection con, String id, @Nullable String keywords) throws SQLException {
138
		this.ppaperDao.update(con, id, keywords);
139
	}
140

141
	@Get
142
	@Path("/byShareId")
143
	public Ppaper query(@JdbcConn Connection con,long id) throws SQLException{
144
		return this.ppaperDao.query(con,id);
145
	}
146
}

+ 143 - 0
src/main/java/com/ekexiu/portal/service/PpatentServcie.java

@ -0,0 +1,143 @@
1
package com.ekexiu.portal.service;
2

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

7
import org.jfw.apt.annotation.Autowrie;
8
import org.jfw.apt.annotation.DefaultValue;
9
import org.jfw.apt.annotation.Nullable;
10
import org.jfw.apt.web.annotation.Path;
11
import org.jfw.apt.web.annotation.operate.Get;
12
import org.jfw.apt.web.annotation.operate.Post;
13
import org.jfw.apt.web.annotation.param.JdbcConn;
14
import org.jfw.util.PageQueryResult;
15

16
import com.ekexiu.portal.dao.PatentAuthorDao;
17
import com.ekexiu.portal.dao.PpatentDao;
18
import com.ekexiu.portal.po.PatentAuthor;
19
import com.ekexiu.portal.po.Ppatent;
20
import com.ekexiu.portal.pojo.AssedPatent;
21

22
@Path("/ppatent")
23
public class PpatentServcie {
24

25
	@Autowrie
26
	private PpatentDao ppatentDao;
27
	@Autowrie
28
	private PatentAuthorDao patentAuthorDao;
29
	
30
	
31
	
32
	public PpatentDao getPpatentDao() {
33
		return ppatentDao;
34
	}
35

36

37

38
	public void setPpatentDao(PpatentDao ppatentDao) {
39
		this.ppatentDao = ppatentDao;
40
	}
41

42

43

44
	public PatentAuthorDao getpatentAuthorDao() {
45
		return patentAuthorDao;
46
	}
47

48

49

50
	public void setPatentAuthorDao(PatentAuthorDao paperAuthorDao) {
51
		this.patentAuthorDao = paperAuthorDao;
52
	}
53

54

55

56
	@Get
57
	@Path("/qo")
58
	public Ppatent query(@JdbcConn Connection con,String id)throws SQLException{
59
		return this.ppatentDao.query(con, id);
60
	}
61
	@Get
62
	@Path("/qm")
63
	public List<Ppatent> query(@JdbcConn Connection con,String[] id)throws SQLException{
64
		return this.ppatentDao.query(con, id);
65
	}
66
	
67
	@Get
68
	@Path("/byProfessor")
69
	public PageQueryResult<AssedPatent> queryByProfessor(@JdbcConn Connection con,String id,@Nullable String name,@DefaultValue("10") int pageSize,@DefaultValue("1") int pageNo)throws SQLException{
70
		if(name == null ){
71
			name ="%";
72
		}else{
73
			name ="%"+name+"%";
74
		}
75
		return this.ppatentDao.pageQueryWithProfessor(con, id, name, pageSize, pageNo);
76
	}
77
	@Get
78
	@Path("/byAuthor")
79
	public PageQueryResult<AssedPatent> queryByAuthor(@JdbcConn Connection con,String author,String id,@Nullable String name,@DefaultValue("10") int pageSize,@DefaultValue("1") int pageNo)throws SQLException{
80
		if(name == null ){
81
			name ="%";
82
		}else{
83
			name ="%"+name+"%";
84
		}
85
		return this.ppatentDao.pageQueryWithAuthor(con, author,id, name, pageSize, pageNo);
86
	}
87
	
88
	@Get
89
	@Path("/authors")
90
	public List<PatentAuthor> queryAuthors(@JdbcConn Connection con,String id)throws SQLException{
91
		return this.patentAuthorDao.query(con,id);
92
	}
93
	@Get
94
	@Path("/pq")
95
	public PageQueryResult<Ppatent> pageQuery(@JdbcConn Connection con, @Nullable String qw, @DefaultValue("20") int pageSize, @DefaultValue("1") int pageNo)
96
			throws SQLException {
97
		return null == qw ? this.ppatentDao.query(con, pageSize, pageNo) : this.ppatentDao.query(con, "%" + qw + "%", pageSize, pageNo);
98
	}
99
	/**
100
	 * 
101
	 * @param con
102
	 * @param uid 专家ID(用户ID) 
103
	 * @param id  论文ID
104
	 * @param author 作者名称
105
	 * @return
106
	 * @throws SQLException
107
	 */
108
	@Post
109
	@Path("/ass")
110
	public int ass(@JdbcConn(true) Connection con,String uid,String id,String author)throws SQLException{
111
		return this.patentAuthorDao.update(con, id, uid, author);
112
	}
113
	/**
114
	 * 
115
	 * @param con
116
	 * @param uid 专家ID(用户ID) 
117
	 * @param id  论文ID
118
	 * @return
119
	 * @throws SQLException
120
	 */
121
	@Post
122
	@Path("/cAss")
123
	public int cAss(@JdbcConn(true) Connection con,String uid,String id)throws SQLException{
124
		return this.patentAuthorDao.update(con, id, uid);
125
	}	
126
	
127
	@Post
128
	@Path("/incPageViews")
129
	public void incPageViews(@JdbcConn(true) Connection con,String id)throws SQLException{
130
		this.ppatentDao.incPageViews(con, id);
131
	}
132
	
133
	@Post
134
	@Path("/kw")
135
	public void update(@JdbcConn(true) Connection con,String id,@Nullable String keywords)throws SQLException{
136
		this.ppatentDao.update(con, id, keywords);
137
	}
138
	@Get
139
	@Path("/byShareId")
140
	public Ppatent query(@JdbcConn Connection con,long id)throws SQLException{
141
		return this.ppatentDao.query(con,id);
142
	}
143
}

+ 5 - 0
src/main/java/com/ekexiu/portal/service/ProfessorService.java

@ -666,6 +666,11 @@ public class ProfessorService {
666 666
		return info;
667 667
		
668 668
	}
669
	@Get
670
	@Path("/byShareId")
671
	public Professor query(@JdbcConn Connection con,long id)throws SQLException{
672
		return this.professorDao.query(con,id);
673
	}
669 674
	
670 675
	public static void main(String[] args)throws Exception{
671 676
//		Connection con = DriverManager.getConnection("jdbc:postgresql://121.42.53.174:5432/ekexiu", "postgres",  "postgres");

+ 29 - 1
src/main/java/com/ekexiu/portal/service/ResourceService.java

@ -776,6 +776,18 @@ public class ResourceService {
776 776
		}
777 777
		return resources;
778 778
	}
779
	@Get
780
	@Path("/pqProPublish")
781
	public PageQueryResult<Resource> pageQueryProPublish(@JdbcConn Connection con, String professorId,@DefaultValue("10") int pageSize,@DefaultValue("1") int pageNo) throws SQLException {
782
		PageQueryResult<Resource> resources = this.resourceDao.pageQueryProPublish(con, professorId,pageSize,pageNo);
783
		List<Resource> list = resources.getData();
784
		if(list!=null && list.size()>0) {
785
			for (Resource resource : list) {
786
				resource.setImages(this.imageDao.queryRes(con, resource.getResourceId()));
787
			}
788
		}
789
		return resources;
790
	}
779 791
	
780 792
	@Get
781 793
	@Path("/qaForDesk")
@ -800,6 +812,18 @@ public class ResourceService {
800 812
		}
801 813
		return resources;
802 814
	}
815
	@Get
816
	@Path("/pqOrgPublish")
817
	public PageQueryResult<Resource> pageQueryOrgPublish(@JdbcConn Connection con, String orgId,@DefaultValue("10") int pageSize,@DefaultValue("1") int pageNo) throws SQLException {
818
		PageQueryResult<Resource> resources = this.resourceDao.pageQueryOrgPublish(con, orgId,pageSize,pageNo);
819
		List<Resource> list = resources.getData();
820
		if(list!=null && list.size()>0) {
821
			for (Resource resource : list) {
822
				resource.setImages(this.imageDao.queryRes(con, resource.getResourceId()));
823
			}
824
		}
825
		return resources;
826
	}
803 827
	
804 828
	@Post
805 829
	@Path("/nameAndSupport")
@ -923,5 +947,9 @@ public class ResourceService {
923 947
		}
924 948
		return queryResult;
925 949
	}
926
	
950
	@Get
951
	@Path("/byShareId")
952
	public Resource query(@JdbcConn Connection con,long id)throws SQLException{
953
		return this.resourceDao.query(con,id);
954
	}
927 955
}

+ 240 - 17
src/main/java/com/ekexiu/portal/service/SysService.java

@ -14,6 +14,7 @@ import javax.mail.MessagingException;
14 14
15 15
import org.apache.log4j.Logger;
16 16
import org.jfw.apt.annotation.Autowrie;
17
import org.jfw.apt.annotation.DefaultValue;
17 18
import org.jfw.apt.annotation.Nullable;
18 19
import org.jfw.apt.web.annotation.Path;
19 20
import org.jfw.apt.web.annotation.method.SetCookie;
@ -29,6 +30,8 @@ import org.jfw.util.state.StateCode;
29 30
30 31
import com.ekexiu.portal.dao.OrgDao;
31 32
import com.ekexiu.portal.dao.OrgUserDao;
33
import com.ekexiu.portal.dao.PaperAuthorDao;
34
import com.ekexiu.portal.dao.PatentAuthorDao;
32 35
import com.ekexiu.portal.dao.ProfessorDao;
33 36
import com.ekexiu.portal.dao.UserDao;
34 37
import com.ekexiu.portal.dao.UserOpenIdDao;
@ -74,6 +77,11 @@ public class SysService {
74 77
	@Autowrie
75 78
	private UserOpenIdDao userOpenIdDao;
76 79
80
	@Autowrie
81
	private PatentAuthorDao patentAuthorDao;
82
	@Autowrie
83
	private PaperAuthorDao paperAuthorDao;
84
77 85
	private String bindMailSubject;
78 86
79 87
	private String bindMailReplaceKey;
@ -102,6 +110,10 @@ public class SysService {
102 110
	private String bindMobilePhoneReplaceKey;
103 111
	private String bindMobilePhoneContentTemplate;
104 112
	private long timeLimitWithBindMobilePhone = 3 * 60 * 1000;
113
	
114
	private String basePhoneReplaceKey="yzm";
115
	private String basePhoneContentTemplate="【科袖】请输入验证码yzm,完成手机验证。请于3分钟内正确输入验证码。如非本人操作,请忽略本短信。";
116
	private long timeLimitWithBasePhone= 3*60*1000;
105 117
106 118
	private String phoneRetrievePasswordReplaceKey;
107 119
	private String phoneRetrievePasswordContentTemplate;
@ -143,6 +155,48 @@ public class SysService {
143 155
	private String retrieveOrgFailTempalte;
144 156
	private String retrieveOrgFailSubject;
145 157
158
	
159
	
160
	public String getBasePhoneReplaceKey() {
161
		return basePhoneReplaceKey;
162
	}
163
164
	public void setBasePhoneReplaceKey(String basePhoneReplaceKey) {
165
		this.basePhoneReplaceKey = basePhoneReplaceKey;
166
	}
167
168
	public String getBasePhoneContentTemplate() {
169
		return basePhoneContentTemplate;
170
	}
171
172
	public void setBasePhoneContentTemplate(String basePhoneContentTemplate) {
173
		this.basePhoneContentTemplate = basePhoneContentTemplate;
174
	}
175
176
	public long getTimeLimitWithBasePhone() {
177
		return timeLimitWithBasePhone;
178
	}
179
180
	public void setTimeLimitWithBasePhone(long timeLimitWithBasePhone) {
181
		this.timeLimitWithBasePhone = timeLimitWithBasePhone;
182
	}
183
184
	public PatentAuthorDao getPatentAuthorDao() {
185
		return patentAuthorDao;
186
	}
187
188
	public void setPatentAuthorDao(PatentAuthorDao patentAuthorDao) {
189
		this.patentAuthorDao = patentAuthorDao;
190
	}
191
192
	public PaperAuthorDao getPaperAuthorDao() {
193
		return paperAuthorDao;
194
	}
195
196
	public void setPaperAuthorDao(PaperAuthorDao paperAuthorDao) {
197
		this.paperAuthorDao = paperAuthorDao;
198
	}
199
146 200
	public String getRegMailReplaceKey() {
147 201
		return regMailReplaceKey;
148 202
	}
@ -753,7 +807,8 @@ public class SysService {
753 807
	 */
754 808
	@Post
755 809
	@Path("/regmobile")
756
	public String regMobile(@JdbcConn(true) Connection con, String state, String mobilePhone, String validateCode, String password, @Nullable String inviterId) throws SQLException, JfwBaseException {
810
	public String regMobile(@JdbcConn(true) Connection con, String state, String mobilePhone, String validateCode, String password, @Nullable String inviterId)
811
			throws SQLException, JfwBaseException {
757 812
		@SuppressWarnings("unchecked")
758 813
		StateCode<String, String> sc = (StateCode<String, String>) JfwAppContext.getCachedObject(state);
759 814
		if (sc == null || sc.getExpiredTime() < System.currentTimeMillis())
@ -833,7 +888,7 @@ public class SysService {
833 888
	@Post
834 889
	@Path("/mobileReg")
835 890
	public String mobileReg(@JdbcConn(true) Connection con, String state, String mobilePhone, String validateCode, String password, @Nullable String inviterId,
836
			String name,	@Nullable String oauthType, @Nullable String openid, @Nullable String authCode) throws SQLException, JfwBaseException, IOException {
891
			String name, @Nullable String oauthType, @Nullable String openid, @Nullable String authCode) throws SQLException, JfwBaseException, IOException {
837 892
		@SuppressWarnings("unchecked")
838 893
		StateCode<String, String> sc = (StateCode<String, String>) JfwAppContext.getCachedObject(state);
839 894
		if (sc == null || sc.getExpiredTime() < System.currentTimeMillis())
@ -868,6 +923,141 @@ public class SysService {
868 923
		}
869 924
	}
870 925
926
	@Post
927
	@Path("/regAndAssPatent")
928
	public int assPatent(@JdbcConn(true) Connection con, String state, String phone, String vc, @Nullable String inviterId, String name, String patent)
929
			throws SQLException, JfwBaseException, IOException {
930
		@SuppressWarnings("unchecked")
931
		StateCode<String, String> sc = (StateCode<String, String>) JfwAppContext.getCachedObject(state);
932
		if (sc == null || sc.getExpiredTime() < System.currentTimeMillis())
933
			throw new JfwBaseException(-1, "验证超时");
934
		if (!sc.getKey().equals(phone)) {
935
			throw new JfwBaseException(-2, "手机号与验证手机不匹配");
936
		}
937
		if (!sc.getValue().equals(vc)) {
938
			throw new JfwBaseException(-3, "验证码错误");
939
		}
940
		User user = null;
941
		boolean exists = false;
942
		String uid = StringUtil.buildUUID();
943
		try {
944
			try {
945
				user = new User();
946
				user.setId(uid);
947
				String passwd = StringUtil.md5("123456");
948
				user.setMobilePhone(phone);
949
				user.setPasswd(passwd);
950
				user.setUserType("0");
951
				user.setInviterId(inviterId);
952
				user.setActiveTime(DATE.format(new Date()));
953
				this.userDao.insert(con, user);
954
			} catch (SQLException e) {
955
				if ("23505".equals(e.getSQLState())) {
956
					con.rollback();
957
					user = userDao.queryByEmailOrMobilePhone(con, phone);
958
					if (user == null)
959
						throw new RuntimeException("not fonud  with query user by phone");
960
					exists = true;
961
					uid = user.getId();
962
				} else {
963
					throw e;
964
				}
965
			}
966
			if (exists) {
967
				Professor professor = this.professorDao.query(con, uid);
968
				if (professor == null) {
969
					professor = new Professor();
970
					professor.setId(uid);
971
					professor.setName(name);
972
					professor.setPhone(phone);
973
					this.professorService.insert(con, professor, null);
974
				} else {
975
					name = professor.getName();
976
				}
977
			} else {
978
				Professor professor = new Professor();
979
				professor.setId(uid);
980
				professor.setName(name);
981
				professor.setPhone(phone);
982
				this.professorService.insert(con, professor, null);
983
				if (inviterId != null) {
984
					this.growthLogService.invite(con, inviterId, uid);
985
				}
986
			}
987
			return (this.patentAuthorDao.update(con, patent, uid, name)  > 0?1:0) + (exists?0:10);
988
		} finally {
989
			JfwAppContext.removeCachedObject(state);
990
		}
991
	}
992
993
	@Post
994
	@Path("/regAndAssPaper")
995
	public int assPaper(@JdbcConn(true) Connection con, String state, String phone, String vc, @Nullable String inviterId, String name, String paper)
996
			throws SQLException, JfwBaseException, IOException {
997
		@SuppressWarnings("unchecked")
998
		StateCode<String, String> sc = (StateCode<String, String>) JfwAppContext.getCachedObject(state);
999
		if (sc == null || sc.getExpiredTime() < System.currentTimeMillis())
1000
			throw new JfwBaseException(-1, "验证超时");
1001
		if (!sc.getKey().equals(phone)) {
1002
			throw new JfwBaseException(-2, "手机号与验证手机不匹配");
1003
		}
1004
		if (!sc.getValue().equals(vc)) {
1005
			throw new JfwBaseException(-3, "验证码错误");
1006
		}
1007
		User user = null;
1008
		boolean exists = false;
1009
		String uid = StringUtil.buildUUID();
1010
		try {
1011
			try {
1012
				user = new User();
1013
				user.setId(uid);
1014
				String passwd = StringUtil.md5("123456");
1015
				user.setMobilePhone(phone);
1016
				user.setPasswd(passwd);
1017
				user.setUserType("0");
1018
				user.setInviterId(inviterId);
1019
				user.setActiveTime(DATE.format(new Date()));
1020
				this.userDao.insert(con, user);
1021
			} catch (SQLException e) {
1022
				if ("23505".equals(e.getSQLState())) {
1023
					con.rollback();
1024
					user = userDao.queryByEmailOrMobilePhone(con, phone);
1025
					if (user == null)
1026
						throw new RuntimeException("not fonud  with query user by phone");
1027
					exists = true;
1028
					uid = user.getId();
1029
				} else {
1030
					throw e;
1031
				}
1032
			}
1033
			if (exists) {
1034
				Professor professor = this.professorDao.query(con, uid);
1035
				if (professor == null) {
1036
					professor = new Professor();
1037
					professor.setId(uid);
1038
					professor.setName(name);
1039
					professor.setPhone(phone);
1040
					this.professorService.insert(con, professor, null);
1041
				} else {
1042
					name = professor.getName();
1043
				}
1044
			} else {
1045
				Professor professor = new Professor();
1046
				professor.setId(uid);
1047
				professor.setName(name);
1048
				professor.setPhone(phone);
1049
				this.professorService.insert(con, professor, null);
1050
				if (inviterId != null) {
1051
					this.growthLogService.invite(con, inviterId, uid);
1052
				}
1053
			}
1054
			return (this.paperAuthorDao.update(con, paper, uid, name) > 0?1:0) + (exists?0:10);
1055
1056
		} finally {
1057
			JfwAppContext.removeCachedObject(state);
1058
		}
1059
	}
1060
871 1061
	/**
872 1062
	 * 邮箱验证并注册
873 1063
	 * 
@ -1288,7 +1478,7 @@ public class SysService {
1288 1478
	}
1289 1479
1290 1480
	@SetCookie(checkResultNull = true, path = "/", value = { "userid=result.getId()", "userMobilePhone=result.getMobilePhone()", "userType=result.getType()",
1291
			"userEmail=result.getEmail()==null?\"\":result.getEmail()","authentication=result.getAuthentication()==null?\"\":result.getAuthentication()",
1481
			"userEmail=result.getEmail()==null?\"\":result.getEmail()", "authentication=result.getAuthentication()==null?\"\":result.getAuthentication()",
1292 1482
			"userAuth=String.valueOf(result.isAuth())", "userName=result.getName()==null?\"\":java.net.URLEncoder.encode(result.getName(),\"utf-8\")" })
1293 1483
	@Post
1294 1484
	@Path("/invitelogin")
@ -1308,14 +1498,14 @@ public class SysService {
1308 1498
		ret.setEmail(user.getEmail());
1309 1499
		if (professor != null) {
1310 1500
			ret.setName(professor.getName());
1311
			ret.setAuthentication(professor.getAuthentication()+"");
1501
			ret.setAuthentication(professor.getAuthentication() + "");
1312 1502
		}
1313 1503
		ret.setAuth(!DEFAULT_PASS_WORD.equals(user.getPasswd()));
1314 1504
		return ret;
1315 1505
	}
1316 1506
1317 1507
	@SetCookie(checkResultNull = true, path = "/", value = { "userid=result.getId()", "userMobilePhone=result.getMobilePhone()", "userType=result.getType()",
1318
			"userEmail=result.getEmail()==null?\"\":result.getEmail()","authentication=result.getAuthentication()==null?\"\":result.getAuthentication()",
1508
			"userEmail=result.getEmail()==null?\"\":result.getEmail()", "authentication=result.getAuthentication()==null?\"\":result.getAuthentication()",
1319 1509
			"userAuth=String.valueOf(result.isAuth())", "userName=result.getName()==null?\"\":java.net.URLEncoder.encode(result.getName(),\"utf-8\")" })
1320 1510
	@Post
1321 1511
	@Path("/slogin")
@ -1331,16 +1521,16 @@ public class SysService {
1331 1521
		ret.setMobilePhone(mobile);
1332 1522
		ret.setType(user.getUserType());
1333 1523
		ret.setEmail(user.getEmail());
1334
		if(professor != null){
1524
		if (professor != null) {
1335 1525
			ret.setName(professor.getName());
1336
			ret.setAuthentication(professor.getAuthentication()+"");
1526
			ret.setAuthentication(professor.getAuthentication() + "");
1337 1527
		}
1338 1528
		ret.setAuth(!DEFAULT_PASS_WORD.equals(user.getPasswd()));
1339 1529
		return ret;
1340 1530
	}
1341 1531
1342 1532
	@SetCookie(checkResultNull = true, path = "/", value = { "userid=result.getId()", "userMobilePhone=result.getMobilePhone()", "userType=result.getType()",
1343
			"userEmail=result.getEmail()==null?\"\":result.getEmail()","authentication=result.getAuthentication()==null?\"\":result.getAuthentication()",
1533
			"userEmail=result.getEmail()==null?\"\":result.getEmail()", "authentication=result.getAuthentication()==null?\"\":result.getAuthentication()",
1344 1534
			"userAuth=String.valueOf(result.isAuth())", "userName=result.getName()==null?\"\":java.net.URLEncoder.encode(result.getName(),\"utf-8\")" })
1345 1535
	@Post
1346 1536
	@Path("/login")
@ -1358,7 +1548,7 @@ public class SysService {
1358 1548
		Professor pf = this.professorDao.query(con, user.getId());
1359 1549
		if (null != pf) {
1360 1550
			ret.setName(pf.getName());
1361
			ret.setAuthentication(pf.getAuthentication()+"");
1551
			ret.setAuthentication(pf.getAuthentication() + "");
1362 1552
		}
1363 1553
		ret.setMobilePhone(user.getMobilePhone());
1364 1554
		ret.setType(user.getUserType());
@ -1368,7 +1558,7 @@ public class SysService {
1368 1558
	}
1369 1559
1370 1560
	@SetCookie(checkResultNull = true, path = "/", value = { "userid=result.getId()", "userMobilePhone=result.getMobilePhone()", "userType=result.getType()",
1371
			"userEmail=result.getEmail()==null?\"\":result.getEmail()","authentication=result.getAuthentication()==null?\"\":result.getAuthentication()",
1561
			"userEmail=result.getEmail()==null?\"\":result.getEmail()", "authentication=result.getAuthentication()==null?\"\":result.getAuthentication()",
1372 1562
			"userAuth=String.valueOf(result.isAuth())", "userName=result.getName()==null?\"\":java.net.URLEncoder.encode(result.getName(),\"utf-8\")" })
1373 1563
	@Post
1374 1564
	@Path("/mobileLogin")
@ -1394,7 +1584,7 @@ public class SysService {
1394 1584
			Professor professor = this.professorDao.query(con, user.getId());
1395 1585
			if (null != professor) {
1396 1586
				ret.setName(professor.getName());
1397
				ret.setAuthentication(professor.getAuthentication()+"");
1587
				ret.setAuthentication(professor.getAuthentication() + "");
1398 1588
			}
1399 1589
			ret.setMobilePhone(user.getMobilePhone());
1400 1590
			ret.setType(user.getUserType());
@ -1406,8 +1596,8 @@ public class SysService {
1406 1596
		}
1407 1597
	}
1408 1598
1409
	@SetCookie(checkResultNull = true, path = "/", value = { "orgId=result.getId()", "orgType=result.getType()",
1410
			"orgAuth=String.valueOf(result.isAuth())","orgEmail=result.getEmail()==null?\"\":result.getEmail()",
1599
	@SetCookie(checkResultNull = true, path = "/", value = { "orgId=result.getId()", "orgType=result.getType()", "orgAuth=String.valueOf(result.isAuth())",
1600
			"orgEmail=result.getEmail()==null?\"\":result.getEmail()",
1411 1601
			"orgName=result.getName()==null?\"\":java.net.URLEncoder.encode(result.getName(),\"utf-8\")" })
1412 1602
	@Post
1413 1603
	@Path("/orgLogin")
@ -1601,10 +1791,13 @@ public class SysService {
1601 1791
	 */
1602 1792
	@Get
1603 1793
	@Path("/regmobilephone")
1604
	public String regMobilePhone(@JdbcConn(false) Connection con, String mobilePhone) throws JfwBaseException, SQLException {
1605
		User user = this.userDao.queryByEmailOrMobilePhone(con, mobilePhone);
1606
		if (null != user) {
1607
			return null;
1794
	public String regMobilePhone(@JdbcConn(false) Connection con, String mobilePhone, @DefaultValue("true") boolean checkExists)
1795
			throws JfwBaseException, SQLException {
1796
		if (checkExists) {
1797
			User user = this.userDao.queryByEmailOrMobilePhone(con, mobilePhone);
1798
			if (null != user) {
1799
				return null;
1800
			}
1608 1801
		}
1609 1802
		StateCode<String, String> sc = new StateCode<String, String>();
1610 1803
		final String key = JfwAppContext.cacheObjectAndGenKey(sc);
@ -1631,6 +1824,36 @@ public class SysService {
1631 1824
		}
1632 1825
		return key;
1633 1826
	}
1827
	
1828
	
1829
	@Get
1830
	@Path("/phoneValidCode")
1831
	public String phoneValidCode(String phone) throws JfwBaseException{
1832
		StateCode<String, String> sc = new StateCode<String, String>();
1833
		final String key = JfwAppContext.cacheObjectAndGenKey(sc);
1834
		try {
1835
			Random rd = new Random();
1836
			int vi = rd.nextInt(10000);
1837
			String vc = String.format("%04d", vi);
1838
			sc.setKey(phone);
1839
			sc.setValue(vc);
1840
			this.mobilePhoneServcie.sendMessage(phone, this.basePhoneContentTemplate,basePhoneReplaceKey, vc);
1841
			long ct = System.currentTimeMillis();
1842
			long et = ct + this.timeLimitWithBasePhone + 5000;
1843
			sc.setBuildTime(ct);
1844
			sc.setExpiredTime(et);
1845
			JfwAppContext.getScheduledExecutorService().schedule(new Runnable() {
1846
				@Override
1847
				public void run() {
1848
					JfwAppContext.removeCachedObject(key);
1849
				}
1850
			}, this.timeLimitWithRegMobilePhone + 10000, TimeUnit.MILLISECONDS);
1851
		} catch (Exception e) {
1852
			JfwAppContext.removeCachedObject(key);
1853
			throw new JfwBaseException(10012, "send mobile phone message to " + phone + " error", e);
1854
		}
1855
		return key;
1856
	}
1634 1857
1635 1858
	@Get
1636 1859
	@Path("/sendMobileForLogin")

+ 14 - 1
src/main/java/com/ekexiu/portal/service/WatchService.java

@ -111,9 +111,11 @@ public class WatchService {
111 111
		return this.watchDao.queryOne(con, professorId, watchObject);
112 112
	}
113 113
	
114

115
	
114 116
	@Get
115 117
	@Path("/qaPro")
116
	public PageQueryResult<Watch> queryPro(@JdbcConn Connection con, String professorId, Integer watchType, 
118
	public PageQueryResult<Watch> queryPro(@JdbcConn Connection con, String professorId, short watchType, 
117 119
			@DefaultValue("10") int pageSize, @DefaultValue("1") int pageNo) throws SQLException {
118 120
		PageQueryResult<Watch> queryResult = this.watchDao.queryPro(con, professorId, watchType, pageSize, pageNo);
119 121
		List<Watch> watchs = queryResult.getData();
@ -172,4 +174,15 @@ public class WatchService {
172 174
		return watchs;
173 175
	}
174 176
	
177
	@Get
178
	@Path("/countObject")
179
	public int countObject(@JdbcConn Connection con,String id,short type)throws SQLException{
180
		return this.watchDao.countWatchObject(con, id, type);
181
	}
182
	@Get
183
	@Path("/countProfessor")
184
	public int countProfessor(@JdbcConn Connection con,String id,short type)throws SQLException{
185
		return this.watchDao.countProfessor(con, id, type);
186
	}
187
	
175 188
}

+ 120 - 0
src/main/java/com/ekexiu/push/service/FeedbackService.java

@ -0,0 +1,120 @@
1
package com.ekexiu.push.service;
2

3
import java.sql.Connection;
4
import java.sql.SQLException;
5

6
import org.jfw.apt.annotation.Autowrie;
7
import org.jfw.apt.annotation.Nullable;
8
import org.jfw.apt.web.annotation.Path;
9
import org.jfw.apt.web.annotation.operate.Post;
10
import org.jfw.apt.web.annotation.param.JdbcConn;
11

12
import com.ekexiu.portal.dao.FeedbackDao;
13
import com.ekexiu.portal.po.Feedback;
14

15
@Path("/feedback")
16
public class FeedbackService {
17

18
	@Autowrie
19
	private FeedbackDao feedbackDao;
20

21
	public FeedbackDao getFeedbackDao() {
22
		return feedbackDao;
23
	}
24

25
	public void setFeedbackDao(FeedbackDao feedbackDao) {
26
		this.feedbackDao = feedbackDao;
27
	}
28
	
29
	@Post
30
	@Path("/error/patent")
31
	public long errorPatent(@JdbcConn(true) Connection con,String cnt,String id,@Nullable String user)throws SQLException{
32
		Feedback fb = new Feedback();
33
		fb.setCategory(1);
34
		fb.setSchema(2);
35
		fb.setParam(id);
36
		fb.setState("0");
37
		fb.setContent(cnt);
38
		fb.setUserId(user);
39
		return this.feedbackDao.insert(con, fb);
40
	}
41
	
42
	@Post
43
	@Path("/error/paper")
44
	public long errorPaper(@JdbcConn(true) Connection con,String cnt,String id,@Nullable String user)throws SQLException{
45
		Feedback fb = new Feedback();
46
		fb.setCategory(1);
47
		fb.setSchema(1);
48
		fb.setParam(id);
49
		fb.setState("0");
50
		fb.setContent(cnt);
51
		fb.setUserId(user);
52
		return this.feedbackDao.insert(con, fb);
53
	}
54
	@Post
55
	@Path("/error/professor")
56
	public long errorProfessor(@JdbcConn(true) Connection con,String cnt,String id,@Nullable String user)throws SQLException{
57
		Feedback fb = new Feedback();
58
		fb.setCategory(1);
59
		fb.setSchema(3);
60
		fb.setParam(id);
61
		fb.setState("0");
62
		fb.setContent(cnt);
63
		fb.setUserId(user);
64
		return this.feedbackDao.insert(con, fb);
65
	}
66
	
67
	@Post
68
	@Path("/error/org")
69
	public long errorOrg(@JdbcConn(true) Connection con,String cnt,String id,@Nullable String user)throws SQLException{
70
		Feedback fb = new Feedback();
71
		fb.setCategory(1);
72
		fb.setSchema(4);
73
		fb.setParam(id);
74
		fb.setState("0");
75
		fb.setContent(cnt);
76
		fb.setUserId(user);
77
		return this.feedbackDao.insert(con, fb);
78
	}
79
	
80
	@Post
81
	@Path("/error/resource")
82
	public long errorResource(@JdbcConn(true) Connection con,String cnt,String id,@Nullable String user)throws SQLException{
83
		Feedback fb = new Feedback();
84
		fb.setCategory(1);
85
		fb.setSchema(5);
86
		fb.setParam(id);
87
		fb.setState("0");
88
		fb.setContent(cnt);
89
		fb.setUserId(user);
90
		return this.feedbackDao.insert(con, fb);
91
	}
92
	
93
	@Post
94
	@Path("/error/article")
95
	public long errorArticle(@JdbcConn(true) Connection con,String cnt,String id,@Nullable String user)throws SQLException{
96
		Feedback fb = new Feedback();
97
		fb.setCategory(1);
98
		fb.setSchema(6);
99
		fb.setParam(id);
100
		fb.setState("0");
101
		fb.setContent(cnt);
102
		fb.setUserId(user);
103
		return this.feedbackDao.insert(con, fb);
104
	}
105
	
106
	@Post
107
	@Path("/error")
108
	public long error(@JdbcConn(true) Connection con,String cnt,String id,@Nullable String user,int schema)throws SQLException{
109
		Feedback fb = new Feedback();
110
		fb.setCategory(1);
111
		fb.setSchema(schema);
112
		fb.setParam(id);
113
		fb.setState("0");
114
		fb.setContent(cnt);
115
		fb.setUserId(user);
116
		return this.feedbackDao.insert(con, fb);
117
	}
118
	
119
	
120
}

+ 533 - 0
src/main/java/com/ekexiu/push/service/PushService.java

@ -0,0 +1,533 @@
1
package com.ekexiu.push.service;
2

3
import java.io.IOException;
4
import java.io.InputStream;
5
import java.io.OutputStream;
6
import java.lang.reflect.Type;
7
import java.net.HttpURLConnection;
8
import java.net.URL;
9
import java.security.MessageDigest;
10
import java.security.cert.CertificateException;
11
import java.security.cert.X509Certificate;
12
import java.util.HashMap;
13
import java.util.Map;
14
import java.util.UUID;
15
import java.util.concurrent.ConcurrentHashMap;
16

17
import javax.net.ssl.HostnameVerifier;
18
import javax.net.ssl.HttpsURLConnection;
19
import javax.net.ssl.SSLContext;
20
import javax.net.ssl.SSLSession;
21
import javax.net.ssl.TrustManager;
22
import javax.net.ssl.X509TrustManager;
23

24
import org.jfw.apt.web.annotation.Path;
25
import org.jfw.apt.web.annotation.operate.Get;
26
import org.jfw.apt.web.annotation.operate.Post;
27
import org.jfw.util.ConstData;
28
import org.jfw.util.io.IoUtil;
29
import org.jfw.util.json.JsonService;
30
import org.jfw.util.reflect.TypeReference;
31

32
import com.ekexiu.operation.push.getui.Message;
33
import com.ekexiu.operation.push.getui.MsgCondition;
34
import com.ekexiu.operation.push.getui.MsgStyle;
35
import com.ekexiu.operation.push.getui.NotificationMessage;
36

37
@Path("/push")
38
public class PushService {
39
	private static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(PushService.class);
40

41
	private static Type RES_TYPE = new TypeReference<Map<String, Object>>() {
42
	}.getType();
43
	
44
	
45
	private static final MsgCondition  android=new MsgCondition("phonetype",new String[]{"ANDROID"},1);
46
	private static final MsgCondition  ios=new MsgCondition("phonetype",new String[]{"IOS"},1);
47
	
48
	private static final MsgCondition[]  onlyAndroid = new MsgCondition[]{android};
49
	
50
	private static final MsgCondition[]  onlyIos = new MsgCondition[]{ios};
51

52
	private static Map<String, String> CONTENT_TYPE = new HashMap<String, String>();
53
	private static Map<String, String> TOKEN_MAP = new ConcurrentHashMap<String, String>();
54
	private static Map<String, String> ERR_MAP = new HashMap<String, String>();
55

56
	final static char[] digits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
57
	// UiIGJTfKNR8oXb8apYdGh3
58
	private String secret = "U96j677DHoA1Pv5X0mxMU9";
59
	private String appKey = "48nq7d7yHu8dgbzVHuisp6";
60
	private String appId = "TUdvbnxu1c97r6Fb6cUy57";
61
	private int timeout = 0;
62

63
	private String token = null;
64
	private long lastBuildTime = 0;
65

66
	public String getSecret() {
67
		return secret;
68
	}
69

70
	public void setSecret(String secret) {
71
		this.secret = secret;
72
	}
73

74
	public String getAppKey() {
75
		return appKey;
76
	}
77

78
	public void setAppKey(String appKey) {
79
		this.appKey = appKey;
80
	}
81

82
	public String getAppId() {
83
		return appId;
84
	}
85

86
	public void setAppId(String appId) {
87
		this.appId = appId;
88
	}
89

90
	public int getTimeout() {
91
		return timeout;
92
	}
93

94
	public void setTimeout(int timeout) {
95
		this.timeout = timeout;
96
	}
97

98
	private String buildSign(long flag) {
99
		String p = this.appKey + flag + this.secret;
100
		MessageDigest messageDigest;
101
		try {
102
			messageDigest = MessageDigest.getInstance("SHA-256");
103
			messageDigest.update(p.getBytes("UTF-8"));
104
			StringBuilder sb = new StringBuilder();
105
			for (byte b : messageDigest.digest()) {
106
				sb.append(digits[(b & 0xf0) >> 4]);
107
				sb.append(digits[b & 0xf]);
108
			}
109
			return sb.toString();
110
		} catch (Exception e) {
111
			throw new RuntimeException("jdk unsupported sh256???????????", e);
112
		}
113
	}
114

115
	private void checkResult(Map<String, Object> ret) {
116
		Object obj = ret.get("result");
117
		if ("ok".equals(obj))
118
			return;
119
		String errMsg = null;
120
		errMsg = ERR_MAP.get(obj);
121
		if (errMsg == null)
122
			errMsg = "其他错误";
123
		log.error("调用用个推restApi,返回结果错误:" + obj + ":" + errMsg);
124
		throw new RuntimeException("调用用个推restApi,返回结果错误:" + obj + ":" + errMsg);
125
	}
126

127
	private void checkToken() {
128
		if (this.token == null) {
129
			log.error("token is null");
130
			throw new RuntimeException("token is null");
131
		}
132
	}
133

134
	public String allocateRequesstId() {
135
		UUID uuid = UUID.randomUUID();
136
		return "A" + Long.toString(uuid.getLeastSignificantBits(), 36) + "_" + Long.toString(uuid.getMostSignificantBits(), 36);
137
	}
138

139
	private void buildToken() {
140
		if(true) return;
141
		long time = System.currentTimeMillis();
142
		String sign = this.buildSign(time);
143
		StringBuilder sb = new StringBuilder();
144
		sb.append("{\"sign\":\"").append(sign).append("\",\"timestamp\":\"").append(time).append("\",\"appkey\":\"").append(this.appKey).append("\"}");
145
		try {
146
			Map<String, Object> ret = post("https://restapi.getui.com/v1/" + this.appId + "/auth_sign", CONTENT_TYPE, sb.toString().getBytes(ConstData.UTF8));
147
			this.checkResult(ret);
148
			String otoken = (String) ret.get("auth_token");
149
			if (otoken == null) {
150
				throw new RuntimeException("返回token is null");
151
			}
152
			this.token = otoken;
153
			this.lastBuildTime = System.currentTimeMillis();
154
			TOKEN_MAP.put("authtoken", this.token);
155
		} catch (Exception e) {
156
			this.token = null;
157
			log.error("build token error", e);
158
		}
159
	}
160

161
	public void refresh() {
162
		if ((this.token != null) && ((System.currentTimeMillis() - this.lastBuildTime) < (24 * 60 * 60 * 1000 - 5000))) {
163
			return;
164
		}
165
		this.buildToken();
166
	}
167

168
	public Map<String, Object> post(String url, Map<String, String> header, byte[] data) throws IOException {
169
		HttpURLConnection connection = getConnection(url);
170
		try {
171
			connection.setRequestMethod("POST");
172
			connection.setUseCaches(false);
173
			for (Map.Entry<String, String> entry : header.entrySet()) {
174
				connection.setRequestProperty(entry.getKey(), entry.getValue());
175
			}
176
			connection.setDoOutput(true);
177
			connection.setDoInput(true);
178
			if (this.timeout > 0) {
179
				connection.setConnectTimeout(this.timeout);
180
				connection.setReadTimeout(this.timeout);
181
			}
182
			connection.setFixedLengthStreamingMode(data.length);
183
			OutputStream out = connection.getOutputStream();
184
			try {
185
				out.write(data);
186
			} finally {
187
				out.close();
188
			}
189
			int code = connection.getResponseCode();
190

191
			if (code == 200) {
192
				InputStream in = null;
193
				byte[] resData = null;
194
				try {
195
					in = connection.getInputStream();
196
					resData = IoUtil.readStream(in, false);
197
				} catch (IOException e) {
198
					log.error("Error read http response stream,url:" + url, e);
199
					throw new IOException("Error read http response stream");
200
				} finally {
201
					if (null != in)
202
						IoUtil.close(in);
203
				}
204
				try {
205
					return JsonService.fromJson(new String(resData, ConstData.UTF8), RES_TYPE);
206
				} catch (Exception e) {
207
					log.error("invalid response data,url:" + url, e);
208
					throw new IOException("invalid response data", e);
209
				}
210
			}
211
			log.error("Error http reponse status:" + code + ",url:" + url);
212
			throw new IOException("Error http reponse status:" + code);
213
		} finally {
214
			connection.disconnect();
215
		}
216
	}
217

218
	@Path("/bindAlias")
219
	@Post
220
	public boolean bindAlias(String alias, String cid) {
221
		String url = "https://restapi.getui.com/v1/" + this.appId + "/bind_alias";
222
		StringBuilder sb = new StringBuilder();
223
		sb.append("{\"alias_list\" : [{\"cid\":\"").append(cid).append("\",\"alias\":\"").append(alias).append("\" }]}");
224
		try {
225
			Map<String, Object> ret = post(url, TOKEN_MAP, sb.toString().getBytes(ConstData.UTF8));
226
			this.checkResult(ret);
227
			return true;
228
		} catch (IOException e) {
229
			log.error("bind alias error[cid:" + cid + ",alias:" + alias + "]", e);
230
			return false;
231
		}
232
	}
233
	
234
	@Path("/bindTags")
235
	@Post
236
	public boolean bindTags(String[] tags, String cid) {
237
		String url = "https://restapi.getui.com/v1/" + this.appId + "/set_tags";
238
		Map<String,Object> msg = new HashMap<String,Object>();
239
		msg.put("cid",cid);
240
		msg.put("tag_list",tags);
241
		try {
242
			Map<String, Object> ret = post(url, TOKEN_MAP, JsonService.toJson(msg).getBytes(ConstData.UTF8));
243
			this.checkResult(ret);
244
			return true;
245
		} catch (IOException e) {
246
			log.error("bind tags error:"+JsonService.toJson(msg), e);
247
			return false;
248
		}
249
	}
250
	@Path("/applyBadge")
251
	@Get
252
	public void applyBadge(int badge,String cid,String devtoken){
253
		String url = "https://restapi.getui.com/v1/" + this.appId + "/set_badge";
254
		StringBuilder sb = new StringBuilder();
255
		sb.append("{\"badge\":").append(badge).append(",\"cid_list\":[\"").append(cid).append("\"],\"devicetoken_list\":[\"").append(devtoken).append("\"]}");
256
		System.out.println(sb.toString());
257
		try {
258
			Map<String, Object> ret = post(url, TOKEN_MAP, sb.toString().getBytes(ConstData.UTF8));
259
			this.checkResult(ret);
260
		} catch (IOException e) {
261
			log.error("apply badge error[cid:" + cid + ",devtoken:" + devtoken + "]", e);
262
		}
263
		
264
	}
265
	
266
	private  Map<String,Object > createIosMessage(String title,String content,String payload){
267
		Map<String,Object> ret = new HashMap<String,Object>();
268
		Map<String,Object> message= new HashMap<String,Object>();
269
		ret.put("message", message);
270
		message.put("appkey",this.appKey);
271
		message.put("is_offline",true);
272
		message.put("msgtype", "transmission");
273
		Map<String,Object> transmission = new HashMap<String,Object>();
274
		ret.put("transmission", transmission);
275
		transmission.put("transmission_type", false);
276
		transmission.put("transmission_content", payload);
277
		Map<String,Object> pushInfo = new HashMap<String,Object>();
278
		ret.put("push_info", pushInfo);
279
		Map<String,Object> aps = new HashMap<String,Object>();
280
		pushInfo.put("aps",aps);
281
		Map<String,Object> alert = new HashMap<String,Object>();
282
		aps.put("alert", alert);
283
		alert.put("title", title);
284
		alert.put("body",content);
285
		aps.put("autoBadge","+1");
286
		aps.put("content-available",1);
287
		aps.put("sound","default");
288
		pushInfo.put("payload",payload);		
289
		ret.put("condition", onlyIos);
290
		return ret;		
291
	}
292

293
	
294
	private  Map<String,Object > createAndriodMessage(String title,String content,String payload){
295
		Map<String,Object> ret = new HashMap<String,Object>();
296
		Message message = new Message();
297
		ret.put("message", message);
298
		message.setAppKey(this.appKey);
299
		message.setMsgtype("notification");
300
		message.setOffline(true);
301
		message.setOfflineExpireTime(2*60*1000);
302
		message.setPushNetworkType(0);
303
		NotificationMessage notification = new NotificationMessage();
304
		ret.put("notification", notification);
305
	    notification.setTransmissionType(true);
306
	    notification.setTransmissionContent(payload);
307
	    MsgStyle style = new MsgStyle();
308
	    notification.setStyle(style);		
309
		style.setType(0);
310
		style.setClearable(true);
311
		style.setRing(true);
312
		style.setText(content);
313
		style.setTitle(title);
314
		style.setVibrate(true);
315
		ret.put("condition", onlyAndroid);
316
		return ret;		
317
	}
318
	
319

320

321
	public void toApp(String title,String content,Object payload){
322
		String url = "https://restapi.getui.com/v1/"+this.appId+"/push_app";
323
		String pl_str = JsonService.toJson(payload);
324
		Map<String,Object> andriodMessage = this.createAndriodMessage(title, content, pl_str);
325
		Map<String,Object> iosMessage = this.createIosMessage(title, content, pl_str);
326
		andriodMessage.put("requestid",this.allocateRequesstId());
327
		iosMessage.put("requestid",this.allocateRequesstId());		
328
		
329
//		System.out.println(JsonService.toJson(andriodMessage));
330
//		System.out.println(JsonService.toJson(iosMessage));
331
		try {
332
			Map<String,Object> ret = post(url, TOKEN_MAP,JsonService.toJson(andriodMessage).getBytes(ConstData.UTF8));
333
			this.checkResult(ret);
334
		} catch (Exception e) {
335
			log.error("send app message error",e);
336
		}
337
		try {
338
			Map<String,Object> ret = post(url, TOKEN_MAP,JsonService.toJson(iosMessage).getBytes(ConstData.UTF8));
339
			this.checkResult(ret);
340
		} catch (Exception e) {
341
			log.error("send app message error",e);
342
		}
343
	}
344
	private MsgCondition createTagCondition(String[] tags){
345
		return new MsgCondition("tag", tags, 0);
346
	}
347
	private void addTag(Map<String,Object> msg,MsgCondition  tagCondition){
348
		MsgCondition[] mcs = (MsgCondition[]) msg.get("condition");
349
		MsgCondition[] mcsn = new MsgCondition[mcs.length+1];
350
		System.arraycopy(mcs,0,mcsn, 0,mcs.length);
351
		mcsn[mcs.length] = tagCondition;
352
		msg.put("condition", mcsn);
353
		
354
	}
355
	
356
	public void pushWithTag(String title,String content,Object payload,String[] tags){
357
		String url = "https://restapi.getui.com/v1/"+this.appId+"/push_app";
358
		String pl_str = JsonService.toJson(payload);
359
		Map<String,Object> andriodMessage = this.createAndriodMessage(title, content, pl_str);
360
		Map<String,Object> iosMessage = this.createIosMessage(title, content, pl_str);
361
		andriodMessage.put("requestid",this.allocateRequesstId());
362
		iosMessage.put("requestid",this.allocateRequesstId());	
363
		
364
		MsgCondition tagC = this.createTagCondition(tags);
365
		addTag(andriodMessage, tagC);
366
		addTag(iosMessage, tagC);
367

368
		try {
369
			Map<String,Object> ret = post(url, TOKEN_MAP,JsonService.toJson(andriodMessage).getBytes(ConstData.UTF8));
370
			this.checkResult(ret);
371
		} catch (Exception e) {
372
			log.error("send app message error",e);
373
		}
374
		try {
375
			Map<String,Object> ret = post(url, TOKEN_MAP,JsonService.toJson(iosMessage).getBytes(ConstData.UTF8));
376
			this.checkResult(ret);
377
		} catch (Exception e) {
378
			log.error("send app message error",e);
379
		}
380
	}
381

382
	public void pushWithCid(String title,String content,Object payload,String cid){
383
		String url = "https://restapi.getui.com/v1/"+this.appId+"/push_single";
384
		String pl_str = JsonService.toJson(payload);
385
		Map<String,Object> androidMessage = this.createAndriodMessage(title, content, pl_str);
386
		Map<String,Object> iosMessage = this.createIosMessage(title, content, pl_str);
387
		androidMessage.put("requestid",this.allocateRequesstId());
388
		androidMessage.put("cid",cid);
389
		iosMessage.put("requestid",this.allocateRequesstId());		
390
		iosMessage.put("cid",cid);
391
		
392
//		System.out.println(JsonService.toJson(androidMessage));
393
//		System.out.println(JsonService.toJson(iosMessage));
394
		try {
395
			Map<String,Object> ret = post(url, TOKEN_MAP,JsonService.toJson(androidMessage).getBytes(ConstData.UTF8));
396
			this.checkResult(ret);
397
		} catch (Exception e) {
398
			log.error("send app message error",e);
399
		}
400
		try {
401
			Map<String,Object> ret = post(url, TOKEN_MAP,JsonService.toJson(iosMessage).getBytes(ConstData.UTF8));
402
			this.checkResult(ret);
403
		} catch (Exception e) {
404
			log.error("send app message error",e);
405
		}	
406
	}
407
	public void pushWithAlias(String title,String content,Object payload,String alias){
408
		String url = "https://restapi.getui.com/v1/"+this.appId+"/push_single";
409
		String pl_str = JsonService.toJson(payload);
410
		Map<String,Object> androidMessage = this.createAndriodMessage(title, content, pl_str);
411
		Map<String,Object> iosMessage = this.createIosMessage(title, content, pl_str);
412
		androidMessage.put("requestid",this.allocateRequesstId());
413
		androidMessage.put("alias",alias);
414
		iosMessage.put("requestid",this.allocateRequesstId());		
415
		iosMessage.put("alias",alias);
416
		
417
//		System.out.println(JsonService.toJson(androidMessage));
418
//		System.out.println(JsonService.toJson(iosMessage));
419
		try {
420
			Map<String,Object> ret = post(url, TOKEN_MAP,JsonService.toJson(androidMessage).getBytes(ConstData.UTF8));
421
			this.checkResult(ret);
422
		} catch (Exception e) {
423
			log.error("send app message error",e);
424
		}
425
		try {
426
			Map<String,Object> ret = post(url, TOKEN_MAP,JsonService.toJson(iosMessage).getBytes(ConstData.UTF8));
427
			this.checkResult(ret);
428
		} catch (Exception e) {
429
			log.error("send app message error",e);
430
		}	
431
	}
432
	
433
	
434
	
435
	public static HttpURLConnection getConnection(String urlString) throws IOException {
436
		URL url = new URL(urlString);
437
		HttpURLConnection conn = null;
438
		conn = (HttpURLConnection) url.openConnection();
439
		String protocal = url.getProtocol();
440
		if ((protocal != null) && (protocal.equalsIgnoreCase("https"))) {
441
			try {
442
				HttpsURLConnection httpsConn = (HttpsURLConnection) conn;
443
				httpsConn.setSSLSocketFactory(getTrustAllSSLContext().getSocketFactory());
444

445
				HostnameVerifier hv = new HostnameVerifier() {
446
					public boolean verify(String arg0, SSLSession arg1) {
447
						return true;
448
					}
449
				};
450
				httpsConn.setHostnameVerifier(hv);
451
			} catch (Exception e) {
452
				log.warn("init httpmanager error", e);
453
				throw new RuntimeException("init httpmanager error", e);
454
			}
455
		}
456
		return conn;
457
	}
458

459
	public static SSLContext getTrustAllSSLContext() throws Exception {
460
		TrustManager[] trustAllCerts = new TrustManager[1];
461
		TrustManager trust = new CustomTrustManager();
462
		trustAllCerts[0] = trust;
463
		SSLContext sc = SSLContext.getInstance("SSL");
464
		sc.init(null, trustAllCerts, null);
465
		return sc;
466
	}
467

468
	static class CustomTrustManager implements TrustManager, X509TrustManager {
469
		public X509Certificate[] getAcceptedIssuers() {
470
			return null;
471
		}
472

473
		public boolean isServerTrusted(X509Certificate[] certs) {
474
			return true;
475
		}
476

477
		public boolean isClientTrusted(X509Certificate[] certs) {
478
			return true;
479
		}
480

481
		public void checkServerTrusted(X509Certificate[] certs, String authType) throws CertificateException {
482
		}
483

484
		public void checkClientTrusted(X509Certificate[] certs, String authType) throws CertificateException {
485
		}
486
	}
487

488
	static {
489
		CONTENT_TYPE.put("Content-Type", "application/json");
490
		TOKEN_MAP.putAll(CONTENT_TYPE);
491
		TOKEN_MAP.put("authtoken", "ef60d2aa2bc3193fc99a99ef43906cee70658156dfb41156acc35f7e7b7fb3dd");
492

493
		ERR_MAP.put("no_msg", "没有消息体");
494
		ERR_MAP.put("alias_error", "找不到别名");
495
		ERR_MAP.put("black_ip", "黑名单ip");
496
		ERR_MAP.put("sign_error", "鉴权失败");
497
		ERR_MAP.put("pushnum_overlimit", "推送次数超限");
498
		ERR_MAP.put("no_appid", "找不到appid");
499
		ERR_MAP.put("no_user", "找不到对应用户");
500
		ERR_MAP.put("too_frequent", "推送过于频繁");
501
		ERR_MAP.put("sensitive_word", "有敏感词出现");
502
		ERR_MAP.put("appid_notmatch", "appid与cid或者appkey不匹配");
503
		ERR_MAP.put("not_auth", "用户没有鉴权");
504
		ERR_MAP.put("black_appid", "黑名单app");
505
		ERR_MAP.put("invalid_param", "参数检验不通过");
506
		ERR_MAP.put("alias_notbind", "别名没有绑定cid");
507
		ERR_MAP.put("tag_over_limit", "tag个数超限");
508
		ERR_MAP.put("successed_online", "在线下发");
509
		ERR_MAP.put("successed_offline", "离线下发");
510
		ERR_MAP.put("taginvalid_or_noauth", "tag无效或者没有使用权限");
511
		ERR_MAP.put("no_valid_push", "没有有效下发");
512
		ERR_MAP.put("successed_ignore", "忽略非活跃用户");
513
		ERR_MAP.put("no_taskid", "找不到taskid");
514
	}
515

516
	public static void main(String[] args) throws Exception {
517
		PushService s = new PushService();
518
//		 s.buildToken();
519
//		 s.checkToken();
520
//		TOKEN_MAP.put("authtoken", "ef60d2aa2bc3193fc99a99ef43906cee70658156dfb41156acc35f7e7b7fb3dd");
521
	long l = System.currentTimeMillis();
522
		s.toApp("title_" + l, "content_" + l, "payload_" + l);
523

524
//	s.applyBadge(1, "f293af1f1cc043185ee9d921b63c4807", "D380AD6865B61F4D179DBB208EE3C7268A672AB9821385050596608A186F6023");
525
		// for(int i = 0 ;i < 100;++i){
526
		// UUID uuid= UUID.randomUUID();
527
		// System.out.println( "A"+Long.toString(
528
		// uuid.getLeastSignificantBits(),36)+"_"+Long.toString(uuid.getMostSignificantBits(),
529
		// 36));
530
		// }
531

532
	}
533
}

+ 180 - 0
src/main/resources/database.sql

@ -1348,3 +1348,183 @@ ALTER TABLE article_pro ADD PRIMARY KEY (article_id, professor_id);
1348 1348

1349 1349
update resource set resource_type='1';
1350 1350

1351
-----begin version 1.9------------------------
1352
ALTER TABLE organization ADD COLUMN addr  text COLLATE "zh_CN.utf8";
1353
COMMENT ON COLUMN organization.addr IS '企为地址';
1354
ALTER TABLE organization ADD COLUMN email  text;
1355
COMMENT ON COLUMN organization.email IS '联系邮箱';
1356
ALTER TABLE organization ADD COLUMN contact_num  text;
1357
COMMENT ON COLUMN organization.contact_num IS '联系电话';
1358
ALTER TABLE organization ADD COLUMN field_of_customer  text  COLLATE "zh_CN.utf8";
1359
COMMENT ON COLUMN organization.field_of_customer IS '客户领域';
1360
ALTER TABLE organization ADD COLUMN field_of_supplier  text  COLLATE "zh_CN.utf8";
1361
COMMENT ON COLUMN organization.field_of_supplier IS '供应商领域';
1362
ALTER TABLE organization ADD COLUMN sort_num  int8 default 0 not null;
1363
COMMENT ON COLUMN organization.sort_num IS '排序值';
1364
ALTER TABLE organization ADD COLUMN page_views  int8 default 0 not null;
1365
COMMENT ON COLUMN organization.page_views IS '浏览量';
1366

1367

1368
COMMENT ON COLUMN watch.watch_type IS '关注类型(专家-1,资源-2,3-文章,4-专利 ,5-论文,6-企业)';
1369
CREATE TABLE ppatent (
1370
id char(32)  NOT NULL,
1371
name text COLLATE "zh_CN.utf8" NOT NULL,
1372
page_views int8 DEFAULT 0 NOT NULL,
1373
code text  NOT NULL,
1374
req_code text NOT NULL,
1375
req_person text COLLATE "zh_CN.utf8",
1376
req_day char(8) NOT NULL,
1377
pub_day char(8) NOT NULL,
1378
summary text COLLATE "zh_CN.utf8" NOT NULL,
1379
ref_param text ,
1380
authors text COLLATE "zh_CN.utf8" NOT NULL,
1381
sort_num int8 DEFAULT 0 NOT NULL,
1382
create_time char(14)  NOT NULL,
1383
keywords text COLLATE "zh_CN.utf8"
1384
);
1385
COMMENT ON COLUMN ppatent.name IS '名称';
1386
COMMENT ON COLUMN ppatent.page_views IS '浏览量';
1387
COMMENT ON COLUMN ppatent.code IS '专利号';
1388
COMMENT ON COLUMN ppatent.req_code IS '申请号';
1389
COMMENT ON COLUMN ppatent.req_person IS '申请人';
1390
COMMENT ON COLUMN ppatent.summary IS '摘要';
1391
COMMENT ON COLUMN ppatent.keywords IS '关键词';
1392
COMMENT ON COLUMN ppatent.authors IS '作者列表,以英文逗号分隔';
1393
COMMENT ON COLUMN ppatent.sort_num IS '排序字段,人工权重';
1394
CREATE UNIQUE INDEX ppatent_pkey ON ppatent USING btree (id);
1395
ALTER TABLE ppatent ADD PRIMARY KEY (id);
1396

1397
CREATE TABLE patent_author (
1398
patent_id char(32) NOT NULL,
1399
professor_id char(32) DEFAULT '################################'::bpchar NOT NULL,
1400
name text COLLATE "zh_CN.utf8" NOT NULL,
1401
ass_time char(14) DEFAULT '00010101010101'::bpchar NOT NULL);
1402
COMMENT ON COLUMN patent_author.patent_id IS '专利ID';
1403
COMMENT ON COLUMN patent_author.professor_id IS '专家id(=32个#时,还没有关专家)';
1404
COMMENT ON COLUMN patent_author.name IS '作者姓名';
1405
COMMENT ON COLUMN patent_author.ass_time IS '关联专家时间';
1406
CREATE UNIQUE INDEX patent_author_pkey ON patent_author USING btree (patent_id,name COLLATE "zh_CN.utf8");
1407
ALTER TABLE patent_author ADD PRIMARY KEY (patent_id,name);
1408

1409
CREATE TABLE ppaper (
1410
id char(32)  NOT NULL,
1411
name text COLLATE "zh_CN.utf8" NOT NULL,
1412
page_views int8 DEFAULT 0 NOT NULL,
1413
cn4periodical text,
1414
en4periodical text,
1415
periodicaltype text,
1416
pub_day text,
1417
summary text COLLATE "zh_CN.utf8" NOT NULL,
1418
keywords text COLLATE "zh_CN.utf8",
1419
authors text COLLATE "zh_CN.utf8" NOT NULL,
1420
sort_num int8 DEFAULT 0 NOT NULL,
1421
create_time char(14) NOT NULL,
1422
ref_param text);
1423
COMMENT ON COLUMN ppaper.name IS '名称';
1424
COMMENT ON COLUMN ppaper.page_views IS '浏览量';
1425
COMMENT ON COLUMN ppaper.cn4periodical IS '期刊中文名';
1426
COMMENT ON COLUMN ppaper.en4periodical IS '期刊英文名';
1427
COMMENT ON COLUMN ppaper.pub_day IS '发表期数';
1428
COMMENT ON COLUMN ppaper.summary IS '摘要';
1429
COMMENT ON COLUMN ppaper.keywords IS '关键词';
1430
COMMENT ON COLUMN ppaper.authors IS '作者列表,以英文逗号分隔';
1431
COMMENT ON COLUMN ppaper.sort_num IS '排序字段,人工权重';
1432
CREATE UNIQUE INDEX ppaper_pkey ON ppaper USING btree (id);
1433
ALTER TABLE ppaper ADD PRIMARY KEY (id);
1434

1435
CREATE TABLE paper_author (
1436
paper_id char(32) NOT NULL,
1437
professor_id char(32) DEFAULT '################################'::bpchar NOT NULL,
1438
name text COLLATE "zh_CN.utf8" NOT NULL,
1439
ass_time char(14) DEFAULT '00010101010101'::bpchar NOT NULL);
1440
COMMENT ON COLUMN paper_author.paper_id IS '专利ID';
1441
COMMENT ON COLUMN paper_author.professor_id IS '专家id(=32个#时,还没有关专家)';
1442
COMMENT ON COLUMN paper_author.name IS '作者姓名';
1443
COMMENT ON COLUMN paper_author.ass_time IS '关联专家时间';
1444
CREATE UNIQUE INDEX paper_author_pkey ON paper_author USING btree (paper_id,name COLLATE "zh_CN.utf8");
1445
ALTER TABLE paper_author ADD PRIMARY KEY (paper_id,name);
1446
CREATE TABLE ORG_REG_INFO (
1447
NAME TEXT  COLLATE "zh_CN.utf8" NOT NULL,
1448
NUM TEXT NOT NULL,
1449
CODE TEXT NOT NULL,
1450
CREDIT_CODE TEXT,
1451
"TYPE" TEXT NOT NULL,
1452
INDUSTRY TEXT NOT NULL,
1453
OPERATING_PERIOD TEXT NOT NULL,
1454
DAY_OF_APPROVAL TEXT NOT NULL,
1455
MANAGER TEXT NOT NULL,
1456
ADDR TEXT NOT NULL,
1457
SCOPE_OF_BUSINESS TEXT NOT NULL);
1458
ALTER TABLE ORG_REG_INFO ADD PRIMARY KEY (CODE);
1459
COMMENT ON COLUMN ORG_REG_INFO.NAME IS '注册名称';
1460
COMMENT ON COLUMN ORG_REG_INFO.NUM IS '工商注册号';
1461
COMMENT ON COLUMN ORG_REG_INFO.CODE IS '组织机构代码';
1462
COMMENT ON COLUMN ORG_REG_INFO.CREDIT_CODE IS '统一信用代码';
1463
COMMENT ON COLUMN ORG_REG_INFO."TYPE" IS '企业类型';
1464
COMMENT ON COLUMN ORG_REG_INFO.INDUSTRY IS '行业';
1465
COMMENT ON COLUMN ORG_REG_INFO.OPERATING_PERIOD IS '营业期限';
1466
COMMENT ON COLUMN ORG_REG_INFO.DAY_OF_APPROVAL IS '核准日期';
1467
COMMENT ON COLUMN ORG_REG_INFO.MANAGER IS '登记机关';
1468
COMMENT ON COLUMN ORG_REG_INFO.ADDR IS '注册地址';
1469
COMMENT ON COLUMN ORG_REG_INFO.SCOPE_OF_BUSINESS IS '经营范围';
1470

1471

1472
CREATE TABLE feedback (
1473
id bigserial NOT NULL,
1474
title text,
1475
category int4 NOT NULL,
1476
"schema" int4 NOT NULL,
1477
param text NOT NULL,
1478
content text NOT NULL,
1479
create_time char(14) NOT NULL,
1480
state char(1) NOT NULL,
1481
user_id text,
1482
PRIMARY KEY (id)
1483
);
1484
COMMENT ON TABLE feedback IS '反馈信息';
1485
COMMENT ON COLUMN feedback.id IS '反馈信息ID';
1486
COMMENT ON COLUMN feedback.title IS '标题';
1487
COMMENT ON COLUMN feedback.category IS '大类  1:纠错';
1488
COMMENT ON COLUMN feedback."schema" IS '小类  1:论文,2:专利, 3 专家 4 机构 5 资源 6 文章';
1489
COMMENT ON COLUMN feedback.content IS '内容';
1490
COMMENT ON COLUMN feedback.param IS '参数:如 论文ID....';
1491
COMMENT ON COLUMN feedback.state IS '状态,0:初始状态   ,其他由不同大类业务确定';
1492
COMMENT ON COLUMN feedback.user_id IS '返馈人ID';
1493

1494

1495
create sequence professor_share_id_seq increment by 1 minvalue 100000 no maxvalue start with 100000;     
1496
ALTER TABLE professor ADD COLUMN share_id int8 DEFAULT nextval('professor_share_id_seq'::regclass) NOT NULL;
1497
COMMENT ON COLUMN professor.share_id IS '共享ID';
1498
create sequence organization_share_id_seq increment by 1 minvalue 100000 no maxvalue start with 100000;     
1499
ALTER TABLE organization ADD COLUMN share_id int8 DEFAULT nextval('organization_share_id_seq'::regclass) NOT NULL;
1500
COMMENT ON COLUMN organization.share_id IS '共享ID';
1501
create sequence article_share_id_seq increment by 1 minvalue 100000 no maxvalue start with 100000;     
1502
ALTER TABLE article ADD COLUMN share_id int8 DEFAULT nextval('article_share_id_seq'::regclass) NOT NULL;
1503
COMMENT ON COLUMN article.share_id IS '共享ID';
1504
create sequence resource_share_id_seq increment by 1 minvalue 100000 no maxvalue start with 100000;     
1505
ALTER TABLE resource ADD COLUMN share_id int8 DEFAULT nextval('resource_share_id_seq'::regclass) NOT NULL;
1506
COMMENT ON COLUMN resource.share_id IS '共享ID';
1507
create sequence ppaper_share_id_seq increment by 1 minvalue 100000 no maxvalue start with 100000;     
1508
ALTER TABLE ppaper ADD COLUMN share_id int8 DEFAULT nextval('ppaper_share_id_seq'::regclass) NOT NULL;
1509
COMMENT ON COLUMN ppaper.share_id IS '共享ID';
1510
create sequence ppatent_share_id_seq increment by 1 minvalue 100000 no maxvalue start with 100000;     
1511
ALTER TABLE ppatent ADD COLUMN share_id int8 DEFAULT nextval('ppatent_share_id_seq'::regclass) NOT NULL;
1512
COMMENT ON COLUMN ppatent.share_id IS '共享ID';
1513

1514

1515

1516
update organization set org_type = null;
1517
ALTER TABLE  organization ADD COLUMN linkman text;
1518
COMMENT ON COLUMN  organization.linkman IS '联系人';
1519

1520

1521

1522

1523

1524

1525

1526

1527

1528

1529

1530