Browse Source

Merge branch 'dev' of http://121.42.53.174:3000/jiapeng/portal-web into dev

XMTT 6 years ago
parent
commit
6aa27bd8d6

+ 68 - 193
src/main/java/com/ekexiu/portal/dao/ArticleDao.java

@ -54,11 +54,11 @@ public abstract class ArticleDao {
54 54
	public abstract int update(Connection con, Article article) throws SQLException;
55 55

56 56
	@Insert
57
	public abstract int insert(Connection con,ArticleWare ware)throws SQLException;
57
	public abstract int insert(Connection con, ArticleWare ware) throws SQLException;
58 58

59 59
	@DeleteWith
60 60
	@From(ArticleWare.class)
61
	public abstract int deleteWare(Connection con,String id)throws SQLException;
61
	public abstract int deleteWare(Connection con, String id) throws SQLException;
62 62

63 63
	@UpdateWith
64 64
	@From(Article.class)
@ -122,23 +122,61 @@ public abstract class ArticleDao {
122 122
	@Where("STATUS = '1' AND ARTICLE_TYPE = '1'")
123 123
	public abstract PageQueryResult<Article> pageQueryProPublish(Connection con, String ownerId, int pageSize, int pageNo) throws SQLException;
124 124

125
	//@LimitSelect
126
	//@Exclude("articleContent")
127
	//@OrderBy(cols = {@LimitColumn(value = "publishTime", asc = false), @LimitColumn(value = "shareId",asc = false, handlerClass = LongHandler.class)}, value = "")
128
	//@Where("STATUS = '1'")
129
	//public abstract List<Article> proPublish(Connection con, String professorId, String publishTime, long shareId, int rows)throws SQLException;
130
    //
131
	//@LimitSelect
132
	//@Exclude("articleContent")
133
	//@OrderBy(cols = {@LimitColumn(value = "publishTime", asc = false), @LimitColumn(value = "shareId",asc = false, handlerClass = LongHandler.class)}, value = "")
134
	//@Where("STATUS = '1'")
135
	//public abstract List<Article> orgPublish(Connection con, String orgId, String publishTime, long shareId, int rows)throws SQLException;
125
	// @LimitSelect
126
	// @Exclude("articleContent")
127
	// @OrderBy(cols = {@LimitColumn(value = "publishTime", asc = false),
128
	// @LimitColumn(value = "shareId",asc = false, handlerClass =
129
	// LongHandler.class)}, value = "")
130
	// @Where("STATUS = '1'")
131
	// public abstract List<Article> proPublish(Connection con, String
132
	// professorId, String publishTime, long shareId, int rows)throws
133
	// SQLException;
134
	//
135
	// @LimitSelect
136
	// @Exclude("articleContent")
137
	// @OrderBy(cols = {@LimitColumn(value = "publishTime", asc = false),
138
	// @LimitColumn(value = "shareId",asc = false, handlerClass =
139
	// LongHandler.class)}, value = "")
140
	// @Where("STATUS = '1'")
141
	// public abstract List<Article> orgPublish(Connection con, String orgId,
142
	// String publishTime, long shareId, int rows)throws SQLException;
143

144
	@LimitSelect
145
	@Exclude("articleContent")
146
	@OrderBy(cols = { @LimitColumn(value = "publishTime", asc = false),
147
			@LimitColumn(value = "shareId", asc = false, handlerClass = LongHandler.class) }, value = "")
148
	@Where("STATUS = '1'")
149
	public abstract List<Article> publish(Connection con, String articleType, String ownerId, String publishTime, long shareId, int rows) throws SQLException;
136 150

137 151
	@LimitSelect
138 152
	@Exclude("articleContent")
139
	@OrderBy(cols = {@LimitColumn(value = "publishTime", asc = false), @LimitColumn(value = "shareId",asc = false, handlerClass = LongHandler.class)}, value = "")
153
	@OrderBy(cols = { @LimitColumn(value = "publishTime", asc = false),
154
			@LimitColumn(value = "shareId", asc = false, handlerClass = LongHandler.class) }, value = "")
155
	@Where("STATUS = '1'")
156
	public abstract List<Article> publishInPlatform(Connection con,
157
			@SqlColumn(handlerClass = StringHandler.class, value = { "ARTICLE_ID IN (SELECT AID FROM REFERENCED_ARTICLE WHERE PID=?" }) String pid,
158
			String publishTime, long shareId, int rows) throws SQLException;
159

160
	@PageSelect
161
	@Exclude("articleContent")
162
	@OrderBy(value = "ORDER BY PUBLISH_TIME DESC")
163
	@Where("STATUS = '1'")
164
	public abstract PageQueryResult<Article> publishInPlatform(Connection con,
165
			@SqlColumn(handlerClass = StringHandler.class, value = { "ARTICLE_ID IN (SELECT AID FROM REFERENCED_ARTICLE WHERE PID=?" }) String pid,
166
			@Nullable @GroupSqlColumn(handlerClass = StringHandler.class, value = { "ARTICLE_TITLE LIKE ?",
167
					"OWNER_ID IN (SELECT ID FROM ORGANIZATION WHERE NAME LIKE ? OR FOR_SHORT LIKE)" }, additional = 1, isAnd = false) String key,
168
			int pageSize, int pageNo) throws SQLException;
169

170
	@PageSelect
171
	@Exclude("articleContent")
172
	@OrderBy(value = "ORDER BY PUBLISH_TIME DESC")
140 173
	@Where("STATUS = '1'")
141
	public abstract List<Article> publish(Connection con,String articleType, String ownerId, String publishTime, long shareId, int rows)throws SQLException;
174
	public abstract PageQueryResult<Article> publishNotInPlatform(Connection con,
175
			@GroupSqlColumn(handlerClass = StringHandler.class, value = { "ARTICLE_ID NOT IN (SELECT AID FROM REFERENCED_ARTICLE WHERE PID=?",
176
					"ARTICLE_TYPE='2' AND OWNER_ID IN (SELECT OID FROM RESIDENT_ORG WHERE PID=?)" }, isAnd = true) String pid,
177
			@Nullable @GroupSqlColumn(handlerClass = StringHandler.class, value = { "ARTICLE_TITLE LIKE ?",
178
					"OWNER_ID IN (SELECT ID FROM ORGANIZATION WHERE NAME LIKE ? OR FOR_SHORT LIKE)" }, additional = 1, isAnd = false) String key,
179
			int pageSize, int pageNo) throws SQLException;
142 180

143 181
	@Exclude("articleContent")
144 182
	@SelectList
@ -175,178 +213,7 @@ public abstract class ArticleDao {
175 213
	public abstract Article queryOne(Connection con, String articleId) throws SQLException;
176 214

177 215
	@SelectList
178
	public abstract List<ArticleWare> queryWares(Connection con,String id)throws SQLException;
179

180
	public List<Article> queryByPageViews(Connection con, String articleId, int rows) throws SQLException {
181
		int index = 1;
182
		boolean hasArticleId = null != articleId;
183
		StringBuilder sql = new StringBuilder();
184
		sql.append(
185
				"SELECT ARTICLE_ID,OWNER_ID,ARTICLE_TITLE,'',SUBJECT,PUBLISH_TIME,ARTICLE_IMG,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME,SHARE_ID,COL_NUM FROM ARTICLE");
186
		sql.append(" WHERE STATUS = '1'");
187
		if (hasArticleId) {
188
			sql.append(" AND ARTICLE_ID != ?");
189
		}
190
		sql.append(" ORDER BY PAGE_VIEWS DESC");
191
		sql.append(" LIMIT ").append(rows);
192
		PreparedStatement ps = con.prepareStatement(sql.toString());
193
		try {
194
			if (hasArticleId) {
195
				ps.setString(index++, articleId);
196
			}
197
			ResultSet rs = ps.executeQuery();
198
			try {
199
				List<Article> articles = new ArrayList<Article>();
200
				while (rs.next()) {
201
					Article article = new Article();
202
					article.setArticleId(rs.getString(1));
203
					String proId = rs.getString(2);
204
					if (rs.wasNull()) {
205
						proId = null;
206
					}
207
					article.setOwnerId(proId);
208
					article.setArticleTitle(rs.getString(3));
209
					String articleContent = rs.getString(4);
210
					if (rs.wasNull()) {
211
						articleContent = null;
212
					}
213
					article.setArticleContent(articleContent);
214
					String subject = rs.getString(5);
215
					if (rs.wasNull()) {
216
						subject = null;
217
					}
218
					article.setSubject(subject);
219
					String publishTime = rs.getString(6);
220
					if (rs.wasNull()) {
221
						publishTime = null;
222
					}
223
					article.setPublishTime(publishTime);
224
					String articleImg = rs.getString(7);
225
					if (rs.wasNull()) {
226
						articleImg = null;
227
					}
228
					article.setArticleImg(articleImg);
229
					String articleType = rs.getString(8);
230
					if (rs.wasNull()) {
231
						articleType = null;
232
					}
233
					article.setArticleType(articleType);
234
					article.setArticleAgree(rs.getInt(9));
235
					article.setPageViews(rs.getInt(10));
236
					String status = rs.getString(11);
237
					if (rs.wasNull()) {
238
						status = null;
239
					}
240
					article.setStatus(status);
241
					article.setCreateTime(rs.getString(12));
242
					article.setModifyTime(rs.getString(13));
243
					article.setShareId(rs.getLong(14));
244
					article.setColNum(rs.getInt(15));
245
					articles.add(article);
246
				}
247
				return articles;
248
			} finally {
249
				try {
250
					rs.close();
251
				} catch (Exception e1) {
252
				}
253
			}
254
		} finally {
255
			try {
256
				ps.close();
257
			} catch (Exception e2) {
258
			}
259
		}
260
	}
261

262
	public List<Article> queryByAuthor(Connection con, String ownerId, String articleId, int rows) throws SQLException {
263
		int index = 1;
264
		boolean hasOwnerId = null != ownerId;
265
		boolean hasArticleId = null != articleId;
266
		StringBuilder sql = new StringBuilder();
267
		sql.append(
268
				"SELECT ARTICLE_ID,OWNER_ID,ARTICLE_TITLE,'',SUBJECT,PUBLISH_TIME,ARTICLE_IMG,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME,SHARE_ID,COL_NUM FROM ARTICLE");
269
		sql.append(" WHERE STATUS = '1'");
270
		if (hasOwnerId) {
271
			sql.append(" AND OWNER_ID = ?");
272
		}
273
		if (hasArticleId) {
274
			sql.append(" AND ARTICLE_ID != ?");
275
		}
276
		sql.append(" ORDER BY PUBLISH_TIME DESC");
277
		sql.append(" LIMIT ").append(rows);
278
		PreparedStatement ps = con.prepareStatement(sql.toString());
279
		try {
280
			if (hasOwnerId) {
281
				ps.setString(index++, ownerId);
282
			}
283
			if (hasArticleId) {
284
				ps.setString(index++, articleId);
285
			}
286
			ResultSet rs = ps.executeQuery();
287
			try {
288
				List<Article> articles = new ArrayList<Article>();
289
				while (rs.next()) {
290
					Article article = new Article();
291
					article.setArticleId(rs.getString(1));
292
					String proId = rs.getString(2);
293
					if (rs.wasNull()) {
294
						proId = null;
295
					}
296
					article.setOwnerId(proId);
297
					article.setArticleTitle(rs.getString(3));
298
					String articleContent = rs.getString(4);
299
					if (rs.wasNull()) {
300
						articleContent = null;
301
					}
302
					article.setArticleContent(articleContent);
303
					String subject = rs.getString(5);
304
					if (rs.wasNull()) {
305
						subject = null;
306
					}
307
					article.setSubject(subject);
308
					String publishTime = rs.getString(6);
309
					if (rs.wasNull()) {
310
						publishTime = null;
311
					}
312
					article.setPublishTime(publishTime);
313
					String articleImg = rs.getString(7);
314
					if (rs.wasNull()) {
315
						articleImg = null;
316
					}
317
					article.setArticleImg(articleImg);
318
					String articleType = rs.getString(8);
319
					if (rs.wasNull()) {
320
						articleType = null;
321
					}
322
					article.setArticleType(articleType);
323
					article.setArticleAgree(rs.getInt(9));
324
					article.setPageViews(rs.getInt(10));
325
					String status = rs.getString(11);
326
					if (rs.wasNull()) {
327
						status = null;
328
					}
329
					article.setStatus(status);
330
					article.setCreateTime(rs.getString(12));
331
					article.setModifyTime(rs.getString(13));
332
					article.setShareId(rs.getLong(14));
333
					article.setColNum(rs.getInt(15));
334
					articles.add(article);
335
				}
336
				return articles;
337
			} finally {
338
				try {
339
					rs.close();
340
				} catch (Exception e1) {
341
				}
342
			}
343
		} finally {
344
			try {
345
				ps.close();
346
			} catch (Exception e2) {
347
			}
348
		}
349
	}
216
	public abstract List<ArticleWare> queryWares(Connection con, String id) throws SQLException;
350 217

351 218
	public String[] queryArticleIdWithSameKeyWord(Connection con, String id, int rows) throws SQLException {
352 219
		List<String> ret = new ArrayList<String>();
@ -505,8 +372,13 @@ public abstract class ArticleDao {
505 372
	@LimitSelect
506 373
	@Exclude("articleContent")
507 374
	@Where("STATUS = '1'")
508
	@OrderBy(cols = {@LimitColumn(value = "sortNum", asc = false, handlerClass = LongHandler.class), @LimitColumn(value = "publishTime", asc = false), @LimitColumn(value = "articleId", asc = false)}, value = "")
509
	public abstract List<Article> indexSearch(Connection con,@Nullable @GroupSqlColumn(handlerClass = StringHandler.class, value = {"OWNER_ID IN (SELECT ID FROM PROFESSOR WHERE NAME LIKE ?)", "OWNER_ID IN (SELECT ID FROM ORGANIZATION WHERE NAME LIKE ? OR FOR_SHORT LIKE ?)", "ARTICLE_TITLE LIKE ?", "SUBJECT LIKE ?"}, additional = 1, isAnd = false) String key, long sortNum, String publishTime, String articleId, int rows) throws SQLException;
375
	@OrderBy(cols = { @LimitColumn(value = "sortNum", asc = false, handlerClass = LongHandler.class), @LimitColumn(value = "publishTime", asc = false),
376
			@LimitColumn(value = "articleId", asc = false) }, value = "")
377
	public abstract List<Article> indexSearch(Connection con,
378
			@Nullable @GroupSqlColumn(handlerClass = StringHandler.class, value = { "OWNER_ID IN (SELECT ID FROM PROFESSOR WHERE NAME LIKE ?)",
379
					"OWNER_ID IN (SELECT ID FROM ORGANIZATION WHERE NAME LIKE ? OR FOR_SHORT LIKE ?)", "ARTICLE_TITLE LIKE ?",
380
					"SUBJECT LIKE ?" }, additional = 1, isAnd = false) String key,
381
			long sortNum, String publishTime, String articleId, int rows) throws SQLException;
510 382

511 383
	// public PageQueryResult<Article> firstPageQuery(Connection con, String
512 384
	// key, int pageSize, int pageNo) throws SQLException {
@ -682,8 +554,9 @@ public abstract class ArticleDao {
682 554
	@Exclude("articleContent")
683 555
	@OrderBy(" ORDER BY selfOrderField DESC,SHARE_ID ASC ")
684 556
	@Where("STATUS IN ('1','0','2')")
685
	public abstract PageQueryResult<SelfArticle> queryPageForSelf(Connection con, @Nullable String ownerId,
686
			@Like @Nullable String articleTitle, int pageSize, int pageNo) throws SQLException;
557
	public abstract PageQueryResult<SelfArticle> queryPageForSelf(Connection con, String articleType, String ownerId,
558
			@Nullable @GroupSqlColumn(handlerClass = StringHandler.class, value = { "ARTICLE_TITLE LIKE ?", "SUBJECT LIKE ?" }, isAnd = false) String key,
559
			int pageSize, int pageNo) throws SQLException;
687 560

688 561
	public PageQueryResult<FindInfo> queryPage(Connection con, int pageSize, int pageNo) throws SQLException {
689 562
		int total = 0;
@ -891,8 +764,10 @@ public abstract class ArticleDao {
891 764
	public abstract List<Article> lasterByPublishTime(Connection con, @GtEq String publishTime, int rows) throws SQLException;
892 765

893 766
	@LimitSelect
894
	@OrderBy( " ORDER BY PAGE_VIEWS DESC")
895
	public abstract List<Article> queryByWareId(Connection con,@SqlColumn(handlerClass = StringHandler.class, value = { "ARTICLE_ID IN (SELECT ID FROM ARTICLE_WARE WHERE WARE =?)" }) String ware,int rows) throws SQLException;
767
	@OrderBy(" ORDER BY PAGE_VIEWS DESC")
768
	public abstract List<Article> queryByWareId(Connection con,
769
			@SqlColumn(handlerClass = StringHandler.class, value = { "ARTICLE_ID IN (SELECT ID FROM ARTICLE_WARE WHERE WARE =?)" }) String ware, int rows)
770
			throws SQLException;
896 771

897 772
	@DefaultValue("0")
898 773
	@QueryVal

+ 21 - 3
src/main/java/com/ekexiu/portal/platform/ButtedOrg.java

@ -7,32 +7,50 @@ import org.jfw.apt.orm.core.enums.DE;
7 7

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

10
@PrimaryKey({"pid","oid"})
10
/**
11
 * 对接的合作机构
12
 * 
13
 * @author Saga
14
 *
15
 */
16
@PrimaryKey({ "pid", "oid" })
11 17
@Table
12 18
public class ButtedOrg implements CreateTimeSupported {
19
	/**
20
	 * 平台ID
21
	 */
13 22
	private String pid;
23
	/**
24
	 * 对接的合作机构ID(企业ID)
25
	 */
14 26
	private String oid;
27

15 28
	private String createTime;
16
	
29

17 30
	@Column(DE.text_de)
18 31
	public String getPid() {
19 32
		return pid;
20 33
	}
34

21 35
	public void setPid(String pid) {
22 36
		this.pid = pid;
23 37
	}
38

24 39
	@Column(DE.text_de)
25 40
	public String getOid() {
26 41
		return oid;
27 42
	}
43

28 44
	public void setOid(String oid) {
29 45
		this.oid = oid;
30 46
	}
47

31 48
	public String getCreateTime() {
32 49
		return createTime;
33 50
	}
51

34 52
	public void setCreateTime(String createTime) {
35 53
		this.createTime = createTime;
36 54
	}
37
	
55

38 56
}

+ 30 - 0
src/main/java/com/ekexiu/portal/platform/ButtedOrgInfo.java

@ -0,0 +1,30 @@
1
package com.ekexiu.portal.platform;
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.StringHandler;
6

7
import com.ekexiu.portal.po.Organization;
8

9
@ExtendView(fromSentence="ORGANIZATION O INNER JOIN BUTTED_ORG B ON O.ID = B.OID" ,tableAlias="O")
10
public class ButtedOrgInfo extends Organization{
11
	
12
	private String buttedTime;
13
	private boolean hasOrgLogo;
14

15
	public boolean isHasOrgLogo() {
16
		return hasOrgLogo;
17
	}
18

19
	public void setHasOrgLogo(boolean hasOrgLogo) {
20
		this.hasOrgLogo = hasOrgLogo;
21
	}
22
	@CalcColumn(column="B.CREATE_TIME BUTTE_TIME",handlerClass=StringHandler.class)
23
	public String getButtedTime() {
24
		return buttedTime;
25
	}
26

27
	public void setButtedTime(String buttedTime) {
28
		this.buttedTime = buttedTime;
29
	}
30
}

+ 12 - 1
src/main/java/com/ekexiu/portal/platform/ButtedProfessor.java

@ -6,11 +6,22 @@ import org.jfw.apt.orm.annotation.entry.Table;
6 6
import org.jfw.apt.orm.core.enums.DE;
7 7

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

9
/**
10
 * 对接的专家
11
 * 
12
 * @author Saga
13
 *
14
 */
10 15
@PrimaryKey({"pid","uid"})
11 16
@Table
12 17
public class ButtedProfessor implements CreateTimeSupported {
18
	/**
19
	 * 平台ID
20
	 */
13 21
	private String pid;
22
	/**
23
	 * 对接的专家ID
24
	 */
14 25
	private String uid;
15 26
	private String createTime;
16 27
	

+ 31 - 0
src/main/java/com/ekexiu/portal/platform/ButtedProfessorInfo.java

@ -0,0 +1,31 @@
1
package com.ekexiu.portal.platform;
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.StringHandler;
6

7
import com.ekexiu.portal.po.Professor;
8

9
@ExtendView(fromSentence="PROFESSOR P INNER JOIN BUTTED_ORG B ON P.ID = B.OID" ,tableAlias="P")
10
public class ButtedProfessorInfo extends Professor {
11
	private String buttedTime;
12
	private Integer hasHeadImage;
13
	
14

15
	public Integer getHasHeadImage() {
16
		return hasHeadImage;
17
	}
18

19
	public void setHasHeadImage(Integer hasHeadImage) {
20
		this.hasHeadImage = hasHeadImage;
21
	}
22

23
	@CalcColumn(column="B.CREATE_TIME BUTTE_TIME",handlerClass=StringHandler.class)
24
	public String getButtedTime() {
25
		return buttedTime;
26
	}
27

28
	public void setButtedTime(String buttedTime) {
29
		this.buttedTime = buttedTime;
30
	}
31
}

+ 136 - 22
src/main/java/com/ekexiu/portal/platform/PlatformDao.java

@ -6,56 +6,170 @@ import java.util.List;
6 6

7 7
import org.jfw.apt.annotation.Nullable;
8 8
import org.jfw.apt.orm.annotation.dao.DAO;
9
import org.jfw.apt.orm.annotation.dao.method.Exclude;
9 10
import org.jfw.apt.orm.annotation.dao.method.From;
11
import org.jfw.apt.orm.annotation.dao.method.LimitColumn;
12
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
10 13
import org.jfw.apt.orm.annotation.dao.method.Where;
14
import org.jfw.apt.orm.annotation.dao.method.operator.Delete;
15
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
11 16
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
17
import org.jfw.apt.orm.annotation.dao.method.operator.LimitQuery;
18
import org.jfw.apt.orm.annotation.dao.method.operator.PageQuery;
12 19
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
13 20
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
14 21
import org.jfw.apt.orm.annotation.dao.method.operator.Update;
15 22
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
16 23
import org.jfw.apt.orm.annotation.dao.param.Alias;
24
import org.jfw.apt.orm.annotation.dao.param.GroupSqlColumn;
17 25
import org.jfw.apt.orm.annotation.dao.param.In;
18 26
import org.jfw.apt.orm.annotation.dao.param.Set;
27
import org.jfw.apt.orm.annotation.dao.param.SqlColumn;
28
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
29
import org.jfw.util.PageQueryResult;
19 30

20 31
@DAO
21 32
public interface PlatformDao {
22 33

23
	
24 34
	@SelectOne
25 35
	@Nullable
26 36
	@Where("STATE='1'")
27
	PlatformUser login(Connection con,String email,String passwd)throws SQLException;
37
	PlatformUser login(Connection con, String email, String passwd) throws SQLException;
38

28 39
	@Nullable
29 40
	@SelectOne
30
	PlatformInfo  queryInfo(Connection con,String id)throws SQLException;
31
	
41
	PlatformInfo queryInfo(Connection con, String id) throws SQLException;
42

32 43
	@SelectOne
33
	@Nullable 
34
	PlatformUser queryUser(Connection con,String email)throws SQLException;
35
	
44
	@Nullable
45
	PlatformUser queryUser(Connection con, String email) throws SQLException;
46

36 47
	@SelectOne
37
	@Nullable 
38
	PlatformUser queryUserById(Connection con,String id)throws SQLException;
39
	
48
	@Nullable
49
	PlatformUser queryUserById(Connection con, String id) throws SQLException;
50

40 51
	@SelectList
41
	List<PlatformInfo> queryInfos(Connection con,@In String[] id)throws SQLException;
42
	
52
	List<PlatformInfo> queryInfos(Connection con, @In String[] id) throws SQLException;
53

43 54
	@UpdateWith
44 55
	@From(PlatformUser.class)
45
	int updatePasswd(Connection con,String id ,@Alias("passwd") String oldpw ,@Set String passwd)throws SQLException;
46
	
56
	int updatePasswd(Connection con, String id, @Alias("passwd") String oldpw, @Set String passwd) throws SQLException;
57

47 58
	@UpdateWith
48 59
	@From(PlatformUser.class)
49
	int updatePasswd(Connection con,String id,String email ,@Alias("passwd") String oldpw ,@Set String passwd)throws SQLException;
50
	
60
	int updatePasswd(Connection con, String id, String email, @Alias("passwd") String oldpw, @Set String passwd) throws SQLException;
61

51 62
	@UpdateWith
52 63
	@From(PlatformUser.class)
53
	int updateMail(Connection con,String id,@Alias("email") String oldemail ,String passwd ,@Set String email)throws SQLException;
54
	
55
	
64
	int updateMail(Connection con, String id, @Alias("email") String oldemail, String passwd, @Set String email) throws SQLException;
65

56 66
	@Update
57
	int update(Connection con,PlatformInfo pi)throws SQLException;
58
	
67
	int update(Connection con, PlatformInfo pi) throws SQLException;
68

59 69
	@Insert
60
	int insert(Connection con,PlatformOrg org) throws SQLException;
70
	int insert(Connection con, PlatformOrg org) throws SQLException;
71

72
	@Insert
73
	int insert(Connection con, ResidentOrg org) throws SQLException;
74

75
	@Insert
76
	int insert(Connection con, ButtedOrg org) throws SQLException;
77

78
	@Insert
79
	int insert(Connection con, ButtedProfessor professor) throws SQLException;
80

81
	@Insert
82
	int insert(Connection con, ReferencedArticle article) throws SQLException;
83

84
	@Delete
85
	int delete(Connection con, ResidentOrg org) throws SQLException;
86

87
	@Delete
88
	int delete(Connection con, ButtedOrg org) throws SQLException;
89

90
	@Delete
91
	int delete(Connection con, ButtedProfessor professor) throws SQLException;
92

93
	@Delete
94
	int delete(Connection con, ReferencedArticle article) throws SQLException;
95

96
	@SelectList
97
	List<ResidentOrg> queryResidentOrgs(Connection con, String pid) throws SQLException;
98

99
	@SelectList
100
	List<ButtedOrg> queryButtedOrgs(Connection con, String pid) throws SQLException;
101

102
	@SelectList
103
	List<ButtedProfessor> queryButtedProfessors(Connection con, String pid) throws SQLException;
104

105
	@SelectList
106
	List<ReferencedArticle> queryReferencedArticles(Connection con, String pid) throws SQLException;
107

108
	@SelectOne
109
	@Nullable
110
	ResidentOrg queryResidentOrg(Connection con, String pid, String oid) throws SQLException;
111

112
	@SelectOne
113
	@Nullable
114
	ButtedOrg queryButtedOrg(Connection con, String pid, String oid) throws SQLException;
115

116
	@SelectOne
117
	@Nullable
118
	ButtedProfessor queryButtedProfessor(Connection con, String pid, String uid) throws SQLException;
119

120
	@SelectOne
121
	@Nullable
122
	ReferencedArticle queryReferencedArticle(Connection con, String pid, String aid) throws SQLException;
123

124
	@DeleteWith
125
	@From(ResidentOrg.class)
126
	int deleteResidentOrg(Connection con, String pid, String oid) throws SQLException;
127

128
	@DeleteWith
129
	@From(ButtedOrg.class)
130
	int deleteButtedOrg(Connection con, String pid, String oid) throws SQLException;
131

132
	@DeleteWith
133
	@From(ButtedProfessor.class)
134
	int deleteButtedProfessor(Connection con, String pid, String uid) throws SQLException;
135

136
	@DeleteWith
137
	@From(ReferencedArticle.class)
138
	int deleteReferencedArticle(Connection con, String pid, String aid) throws SQLException;
139

140
	@LimitQuery
141
	@OrderBy(cols = { @LimitColumn(value = "time", column = "R.CREATE_TIME", handlerClass = StringHandler.class, asc = false),
142
			@LimitColumn(value = "oid", column = "O.ID", asc = false, handlerClass = StringHandler.class) }, value = "")
143
	@Exclude({ "descp" })
144
	List<ResidentOrgInfo> queryResientOrgInfo(Connection con, String time, String oid,
145
			@SqlColumn(handlerClass = StringHandler.class, value = { "R.PID=?" }) String pid,
146
			@Nullable @GroupSqlColumn(handlerClass = StringHandler.class, isAnd = false, value = { "O.NAME LIKE ?", "O.FOR_SHORT LIKE ?" }) String key,
147
			int rows) throws SQLException;
148

149
	@LimitQuery
150
	@OrderBy(cols = { @LimitColumn(value = "time", column = "B.CREATE_TIME", handlerClass = StringHandler.class, asc = false),
151
			@LimitColumn(value = "oid", column = "O.ID", asc = false, handlerClass = StringHandler.class) }, value = "")
152
	@Exclude({ "descp" })
153
	List<ButtedOrgInfo> queryButtedOrgInfo(Connection con, String time, String oid,
154
			@SqlColumn(handlerClass = StringHandler.class, value = { "B.PID=?" }) String pid, int rows) throws SQLException;
155

156
	@PageQuery
157
	@OrderBy(value = "ORDER BY BUTTE_TIME DESC,ID ASC")
158
	@Exclude({ "descp" })
159
	PageQueryResult<ButtedOrgInfo> pageQueryButtedOrgInfo(Connection con, @SqlColumn(handlerClass = StringHandler.class, value = { "B.PID=?" }) String pid,
160
			int pageSize, int pageNo) throws SQLException;
161

162
	@LimitQuery
163
	@OrderBy(cols = { @LimitColumn(value = "time", column = "B.CREATE_TIME", handlerClass = StringHandler.class, asc = false),
164
			@LimitColumn(value = "uid", column = "P.ID", asc = false, handlerClass = StringHandler.class) }, value = "")
165
	@Exclude({ "descp" })
166
	List<ButtedProfessorInfo> queryButtedProfessorInfo(Connection con, String time, String uid,
167
			@SqlColumn(handlerClass = StringHandler.class, value = { "B.PID=?" }) String pid, int rows) throws SQLException;
168

169
	@PageQuery
170
	@OrderBy(value = "ORDER BY BUTTE_TIME DESC,ID ASC")
171
	@Exclude({ "descp" })
172
	PageQueryResult<ButtedProfessorInfo> queryButtedProfessorInfo(Connection con,
173
			@SqlColumn(handlerClass = StringHandler.class, value = { "B.PID=?" }) String pid, int pageSize, int pageNo) throws SQLException;
174

61 175
}

+ 39 - 0
src/main/java/com/ekexiu/portal/platform/PlatformInfo.java

@ -5,20 +5,59 @@ 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.core.defaultImpl.FixLenStringHandler;
7 7
import org.jfw.apt.orm.core.enums.DE;
8

9
/**
10
 * 平台信息表
11
 * @author Saga
12
 *
13
 */
8 14
@PrimaryKey("id")
9 15
@Table
10 16
public class PlatformInfo {
11 17
	private String id;
18
	/**
19
	 * 平台名称
20
	 */
12 21
	private String name;
22
	/**
23
	 * 平台LOGO
24
	 */
13 25
	private String logo;
26
	/**
27
	 * 联系人
28
	 */
14 29
	private String linkman;
30
	/**
31
	 *联系电话
32
	 */
15 33
	private String linkphone;
34
	/**
35
	 * 联系邮箱
36
	 */
16 37
	private String linkeamil;
38
	/**
39
	 * 省
40
	 */
17 41
	private String province;
42
	/**
43
	 * 市
44
	 */
18 45
	private String city;
46
	/**
47
	 * 地址
48
	 */
19 49
	private String addr;
50
	/**
51
	 * 主页
52
	 */
20 53
	private String url;
54
	/**
55
	 * 面向行业
56
	 */
21 57
	private String industry;
58
	/**
59
	 * 平台介绍
60
	 */
22 61
	private String descp;
23 62
	private String createTime;
24 63
	private String modifyTime;

+ 19 - 1
src/main/java/com/ekexiu/portal/platform/PlatformOrg.java

@ -6,12 +6,23 @@ import org.jfw.apt.orm.annotation.entry.Table;
6 6
import org.jfw.apt.orm.core.enums.DE;
7 7

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

9
/**
10
 * 平台
11
 * @author Saga
12
 *
13
 */
10 14
@PrimaryKey("id")
11 15
@Table
12 16
public class PlatformOrg implements CreateTimeSupported {
17
	/**
18
	 * id
19
	 */
13 20
	private String id;
21
	/**
22
	 * 平台ID
23
	 */
14 24
	private String pid;
25
	private String logo;
15 26
	private String name;
16 27
	private String email;
17 28
	private String addr;
@ -89,6 +100,13 @@ public class PlatformOrg implements CreateTimeSupported {
89 100
	public void setCreateTime(String createTime) {
90 101
		this.createTime = createTime;
91 102
	}
103
	@Column(DE.Text_de)
104
	public String getLogo() {
105
		return logo;
106
	}
107
	public void setLogo(String logo) {
108
		this.logo = logo;
109
	}
92 110
	
93 111
	
94 112
}

+ 155 - 30
src/main/java/com/ekexiu/portal/platform/PlatformService.java

@ -17,14 +17,18 @@ import java.util.concurrent.TimeUnit;
17 17
import java.util.concurrent.atomic.AtomicInteger;
18 18

19 19
import org.jfw.apt.annotation.Autowrie;
20
import org.jfw.apt.annotation.DefaultValue;
20 21
import org.jfw.apt.annotation.Nullable;
21 22
import org.jfw.apt.web.annotation.Path;
23
import org.jfw.apt.web.annotation.method.SetCookie;
22 24
import org.jfw.apt.web.annotation.operate.Get;
23 25
import org.jfw.apt.web.annotation.operate.Post;
26
import org.jfw.apt.web.annotation.param.FieldParam;
24 27
import org.jfw.apt.web.annotation.param.JdbcConn;
25 28
import org.jfw.apt.web.annotation.param.RequestParam;
26 29
import org.jfw.apt.web.annotation.param.Upload;
27 30
import org.jfw.util.JpgUtil;
31
import org.jfw.util.PageQueryResult;
28 32
import org.jfw.util.StringUtil;
29 33
import org.jfw.util.context.JfwAppContext;
30 34
import org.jfw.util.exception.JfwBaseException;
@ -34,6 +38,7 @@ import org.jfw.util.web.fileupload.Item;
34 38
import org.jfw.util.web.fileupload.UploadItemIterator;
35 39

36 40
import com.ekexiu.portal.mail.MailService;
41
import com.ekexiu.portal.service.ImageService;
37 42

38 43
@Path("/platform")
39 44
public class PlatformService {
@ -45,8 +50,7 @@ public class PlatformService {
45 50
	private String stateCodeWithRestPasswordWithEmail = "MAIL_REST_SC";
46 51
	private String templateWithRestPasswordWithEmail = "";
47 52
	private String subjectWithRestPasswordWithEmail = "「科袖」平台账户密码找回";
48
	
49
	
53

50 54
	private long bindEmailTimeout = 60 * 10;
51 55

52 56
	private String urlWithBindEmail = "MAIL_REST_URL";
@ -64,6 +68,17 @@ public class PlatformService {
64 68

65 69
	private int imgMaxWidth = 70;
66 70

71
	@Autowrie
72
	private ImageService imageService;
73

74
	public ImageService getImageService() {
75
		return imageService;
76
	}
77

78
	public void setImageService(ImageService imageService) {
79
		this.imageService = imageService;
80
	}
81

67 82
	public int getImgMaxWidth() {
68 83
		return imgMaxWidth;
69 84
	}
@ -96,13 +111,18 @@ public class PlatformService {
96 111
		this.mailService = mailService;
97 112
	}
98 113

114
	@SetCookie(checkResultNull = true, path = "/", value = { "plf_user=result.getId()", "plf_email=result.getEmail()",
115
			"plf_logo=result.getLogo()==null?\"\":result.getLogo()", "plf_name=result.getName()" })
99 116
	@Post
100 117
	@Path("/login")
101 118
	public LoginUserInfo login(@JdbcConn Connection con, String email, String pw) throws JfwBaseException, SQLException {
102 119
		LoginUserInfo ret = null;
103 120
		PlatformUser pu = this.platformDao.queryUser(con, email);
104 121
		if (pu != null) {
105
			if (pw.equals(pu.getPasswd())) {
122
			if (!"1".equals(pu.getState())) {
123
				throw new JfwBaseException(-600004, "user disabled");
124
			}
125
			if (StringUtil.md5(pw).equals(pu.getPasswd())) {
106 126
				PlatformInfo pi = this.platformDao.queryInfo(con, pu.getId());
107 127
				if (pi != null) {
108 128
					ret = new LoginUserInfo();
@ -122,9 +142,9 @@ public class PlatformService {
122 142
		return ret;
123 143
	}
124 144

125
	@Path("reqResetPw")
145
	@Path("/reqResetPw")
126 146
	@Post
127
	public void requestResetPasswordWithEmail(@JdbcConn Connection con, String mail, @Nullable String url) throws SQLException, JfwBaseException {
147
	public void requestResetPasswordWithEmail(@JdbcConn Connection con, String mail,String url) throws SQLException, JfwBaseException {
128 148
		PlatformUser pu = this.platformDao.queryUser(con, mail);
129 149
		if (pu == null)
130 150
			throw new JfwBaseException(-600001, "not found user");
@ -136,9 +156,7 @@ public class PlatformService {
136 156
		final String cachekey = JfwAppContext.cacheObjectAndGenKey(sc);
137 157
		Map<String, String> mailParam = new HashMap<String, String>();
138 158
		mailParam.put(this.stateCodeWithRestPasswordWithEmail, cachekey);
139
		if (url != null) {
140
			mailParam.put(this.urlWithRestPasswordWithEmail, url);
141
		}
159
		mailParam.put(this.urlWithRestPasswordWithEmail, url);
142 160
		try {
143 161
			mailService.sendSimpleMail(mail, this.templateWithRestPasswordWithEmail, mailParam, this.subjectWithRestPasswordWithEmail);
144 162
			JfwAppContext.getScheduledExecutorService().schedule(new Runnable() {
@ -153,12 +171,9 @@ public class PlatformService {
153 171
			throw new JfwBaseException(-600002, "mail service error");
154 172
		}
155 173
	}
156
	
157
	
158
	
159 174

160 175
	@Post
161
	@Path("/restpw")
176
	@Path("/resetpw")
162 177
	public void restpw(@JdbcConn(true) Connection con, String code, String pw) throws SQLException, JfwBaseException {
163 178
		@SuppressWarnings("unchecked")
164 179
		StateCode<String, String> sc = (StateCode<String, String>) JfwAppContext.getCachedObject(code);
@ -171,17 +186,17 @@ public class PlatformService {
171 186
			throw new JfwBaseException(-600002, "user too fresh");
172 187
		}
173 188
	}
174
	
175
	@Path("reqBindMail")
189

190
	@Path("/reqBindMail")
176 191
	@Post
177
	public void requestBindMail(@JdbcConn Connection con, String mail, String id,@Nullable String url) throws SQLException, JfwBaseException {
192
	public void requestBindMail(@JdbcConn Connection con, String mail, String id, String url) throws SQLException, JfwBaseException {
178 193
		PlatformUser pu = this.platformDao.queryUser(con, mail);
179 194
		if (pu != null)
180 195
			throw new JfwBaseException(-600001, "already bind");
181 196
		pu = this.platformDao.queryUserById(con, id);
182 197
		if (pu == null)
183
			throw new JfwBaseException(-600002, "not exists user["+id+"]");
184
		
198
			throw new JfwBaseException(-600002, "not exists user[" + id + "]");
199

185 200
		StateCode<String, String> sc = new StateCode<String, String>();
186 201
		sc.setCode(pu.getId());
187 202
		sc.setKey(pu.getEmail());
@ -191,9 +206,8 @@ public class PlatformService {
191 206
		final String cachekey = JfwAppContext.cacheObjectAndGenKey(sc);
192 207
		Map<String, String> mailParam = new HashMap<String, String>();
193 208
		mailParam.put(this.stateCodeWithBindEmail, cachekey);
194
		if (url != null) {
195
			mailParam.put(this.urlWithBindEmail, url);
196
		}
209

210
		mailParam.put(this.urlWithBindEmail, url);
197 211
		try {
198 212
			mailService.sendSimpleMail(mail, this.templateWithBindEmail, mailParam, this.subjectWithBindEmail);
199 213
			JfwAppContext.getScheduledExecutorService().schedule(new Runnable() {
@ -207,9 +221,6 @@ public class PlatformService {
207 221
			throw new JfwBaseException(-600003, "mail service error");
208 222
		}
209 223
	}
210
	
211
	
212
	
213 224

214 225
	@Post
215 226
	@Path("/bindMail")
@ -226,31 +237,145 @@ public class PlatformService {
226 237
		}
227 238
	}
228 239

229
	
230 240
	@Post
231 241
	@Path("/modifypw")
232
	public int modifypw(@JdbcConn(true) Connection con,String id,String opw,String npw) throws SQLException{
233
		return this.platformDao.updatePasswd(con, id,StringUtil.md5(opw),StringUtil.md5(npw));
242
	public int modifypw(@JdbcConn(true) Connection con, String id, String opw, String npw) throws SQLException {
243
		return this.platformDao.updatePasswd(con, id, StringUtil.md5(opw), StringUtil.md5(npw));
234 244
	}
235
	
245

236 246
	@Post
237 247
	@Path("/info")
238 248
	public int updateInfo(@JdbcConn(true) Connection con, @RequestParam(excludeFields = { "createTime", "modifyTime" }) PlatformInfo pi) throws SQLException {
239 249
		return this.platformDao.update(con, pi);
240 250
	}
241
	
251

242 252
	@Get
243 253
	@Path("/info")
244
	public PlatformInfo info(@JdbcConn Connection con,String id) throws SQLException{
254
	public PlatformInfo info(@JdbcConn Connection con, String id) throws SQLException {
245 255
		return this.platformDao.queryInfo(con, id);
246 256
	}
257

247 258
	@Post
248 259
	@Path("/add/org")
249
	public int addOrg(@JdbcConn(true) Connection con, @RequestParam(excludeFields = { "createTime", "id" }) PlatformOrg po)throws SQLException{
260
	public int addOrg(@JdbcConn(true) Connection con, @RequestParam(excludeFields = { "createTime", "id" }) PlatformOrg po) throws SQLException {
250 261
		po.setId(StringUtil.buildUUID());
251 262
		return this.platformDao.insert(con, po);
252 263
	}
253 264

265
	@Post
266
	@Path("/resident")
267
	public int resident(@JdbcConn(true) Connection con, @RequestParam(fields = { @FieldParam(value = "pid", valueClass = String.class),
268
			@FieldParam(value = "oid", valueClass = String.class) }) ResidentOrg po) throws SQLException {
269
		return this.platformDao.insert(con, po);
270
	}
271

272
	@Post
273
	@Path("/buttedOrg")
274
	public int buttedOrg(@JdbcConn(true) Connection con, @RequestParam(fields = { @FieldParam(value = "pid", valueClass = String.class),
275
			@FieldParam(value = "oid", valueClass = String.class) }) ButtedOrg po) throws SQLException {
276
		return this.platformDao.insert(con, po);
277
	}
278

279
	@Post
280
	@Path("/buttedProfessor")
281
	public int buttedProfessor(@JdbcConn(true) Connection con, @RequestParam(fields = { @FieldParam(value = "pid", valueClass = String.class),
282
			@FieldParam(value = "uid", valueClass = String.class) }) ButtedProfessor po) throws SQLException {
283
		return this.platformDao.insert(con, po);
284
	}
285

286
	@Post
287
	@Path("/referencedArticle")
288
	public int referencedArticle(@JdbcConn(true) Connection con, @RequestParam(fields = { @FieldParam(value = "pid", valueClass = String.class),
289
			@FieldParam(value = "aid", valueClass = String.class) }) ReferencedArticle po) throws SQLException {
290
		return this.platformDao.insert(con, po);
291
	}
292

293
	@Post
294
	@Path("/resident/delete")
295
	public int residentDelete(@JdbcConn(true) Connection con, @RequestParam(fields = { @FieldParam(value = "pid", valueClass = String.class),
296
			@FieldParam(value = "oid", valueClass = String.class) }) ResidentOrg po) throws SQLException {
297
		return this.platformDao.delete(con, po);
298
	}
299

300
	@Post
301
	@Path("/buttedOrg/delete")
302
	public int buttedOrgDelete(@JdbcConn(true) Connection con, @RequestParam(fields = { @FieldParam(value = "pid", valueClass = String.class),
303
			@FieldParam(value = "oid", valueClass = String.class) }) ButtedOrg po) throws SQLException {
304
		return this.platformDao.delete(con, po);
305
	}
306

307
	@Post
308
	@Path("/buttedProfessor/delete")
309
	public int buttedProfessorDelete(@JdbcConn(true) Connection con, @RequestParam(fields = { @FieldParam(value = "pid", valueClass = String.class),
310
			@FieldParam(value = "uid", valueClass = String.class) }) ButtedProfessor po) throws SQLException {
311
		return this.platformDao.delete(con, po);
312
	}
313

314
	@Post
315
	@Path("/referencedArticle/delete")
316
	public int referencedArticleDelete(@JdbcConn(true) Connection con, @RequestParam(fields = { @FieldParam(value = "pid", valueClass = String.class),
317
			@FieldParam(value = "aid", valueClass = String.class) }) ReferencedArticle po) throws SQLException {
318
		return this.platformDao.delete(con, po);
319
	}
320

321
	@Get
322
	@Path("/info/residentOrgs")
323
	public List<ResidentOrgInfo> queryResidentOrginfos(@JdbcConn Connection con, @DefaultValue("\"z\"") String time, @DefaultValue("\"z\"") String oid,
324
			String pid, @Nullable String key, int rows) throws SQLException {
325

326
		List<ResidentOrgInfo> ret = this.platformDao.queryResientOrgInfo(con, time, oid, pid, key == null ? null : ("%" + key + "%"), rows);
327
		for (ResidentOrgInfo roi : ret) {
328
			roi.setHasOrgLogo(this.imageService.hasOrgLogo(roi.getId()));
329
		}
330
		return ret;
331
	}
332

333
	@Get
334
	@Path("/info/buttedOrgs")
335
	public List<ButtedOrgInfo> queryButtedOrginfos(@JdbcConn Connection con, @DefaultValue("\"z\"") String time, @DefaultValue("\"z\"") String oid, String pid,
336
			int rows) throws SQLException {
337

338
		List<ButtedOrgInfo> ret = this.platformDao.queryButtedOrgInfo(con, time, oid, pid, rows);
339
		for (ButtedOrgInfo roi : ret) {
340
			roi.setHasOrgLogo(this.imageService.hasOrgLogo(roi.getId()));
341
		}
342
		return ret;
343
	}
344

345
	@Get
346
	@Path("/info/pqButtedOrgs")
347
	public PageQueryResult<ButtedOrgInfo> pqButtedOrginfos(@JdbcConn Connection con, String pid, int pageSize, int pageNo) throws SQLException {
348

349
		PageQueryResult<ButtedOrgInfo> ret = this.platformDao.pageQueryButtedOrgInfo(con, pid, pageSize, pageNo);
350
		for (ButtedOrgInfo roi : ret.getData()) {
351
			roi.setHasOrgLogo(this.imageService.hasOrgLogo(roi.getId()));
352
		}
353
		return ret;
354
	}
355

356
	@Get
357
	@Path("/info/buttedProfessors")
358
	public List<ButtedProfessorInfo> queryButtedProfessorinfos(@JdbcConn Connection con, @DefaultValue("\"z\"") String time, @DefaultValue("\"z\"") String uid,
359
			String pid, int rows) throws SQLException {
360

361
		List<ButtedProfessorInfo> ret = this.platformDao.queryButtedProfessorInfo(con, time, uid, pid, rows);
362
		for (ButtedProfessorInfo roi : ret) {
363
			roi.setHasHeadImage(this.imageService.hasProfessorImage(roi.getId()));
364
		}
365
		return ret;
366
	}
367

368
	@Get
369
	@Path("/info/pqButtedProfessors")
370
	public PageQueryResult<ButtedProfessorInfo> pageQueryButtedProfessorinfos(@JdbcConn Connection con, String pid, int pageSize, int pageNo)
371
			throws SQLException {
372
		PageQueryResult<ButtedProfessorInfo> ret = this.platformDao.queryButtedProfessorInfo(con, pid, pageSize, pageNo);
373
		for (ButtedProfessorInfo roi : ret.getData()) {
374
			roi.setHasHeadImage(this.imageService.hasProfessorImage(roi.getId()));
375
		}
376
		return ret;
377
	}
378

254 379
	@Post
255 380
	@Path("/upload")
256 381
	public List<UploadFile> upload(@Upload UploadItemIterator it) throws Exception {

+ 1 - 1
src/main/java/com/ekexiu/portal/platform/ReferencedArticle.java

@ -24,7 +24,7 @@ public class ReferencedArticle {
24 24
		return aid;
25 25
	}
26 26
	public void setAid(String aid) {
27
		this.aid = oid;
27
		this.aid = aid;
28 28
	}
29 29
	public String getCreateTime() {
30 30
		return createTime;

+ 30 - 0
src/main/java/com/ekexiu/portal/platform/ResidentOrgInfo.java

@ -0,0 +1,30 @@
1
package com.ekexiu.portal.platform;
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.StringHandler;
6

7
import com.ekexiu.portal.po.Organization;
8

9
@ExtendView(fromSentence="ORGANIZATION O INNER JOIN RESIDENT_ORG R ON O.ID = R.OID" ,tableAlias="O")
10
public class ResidentOrgInfo extends Organization{
11
	
12
	private String residentTime;
13
	private boolean hasOrgLogo;
14

15
	public boolean isHasOrgLogo() {
16
		return hasOrgLogo;
17
	}
18

19
	public void setHasOrgLogo(boolean hasOrgLogo) {
20
		this.hasOrgLogo = hasOrgLogo;
21
	}
22
	@CalcColumn(column="R.CREATE_TIME RESIDENT_TIME",handlerClass=StringHandler.class)
23
	public String getResidentTime() {
24
		return residentTime;
25
	}
26

27
	public void setResidentTime(String residentTime) {
28
		this.residentTime = residentTime;
29
	}
30
}

+ 23 - 5
src/main/java/com/ekexiu/portal/service/ArticleService.java

@ -887,6 +887,24 @@ public class ArticleService {
887 887
	public List<Article> proPublish(@JdbcConn Connection con, String category, String owner, @DefaultValue("\"9\"") String publishTime,@DefaultValue("Long.MAX_VALUE")long shareId, int rows)throws SQLException {
888 888
			return this.articleDao.publish(con,category, owner, publishTime,shareId, rows);
889 889
	}
890
	
891
	@Get
892
	@Path("/publishInPlatform")
893
	public List<Article> publishInPlatform(@JdbcConn Connection con,String pid, @DefaultValue("\"9\"") String publishTime,@DefaultValue("Long.MAX_VALUE")long shareId, int rows)throws SQLException {
894
			return this.articleDao.publishInPlatform(con,pid, publishTime,shareId, rows);
895
	}
896
	@Get
897
	@Path("/pgPublishInPlatform")
898
	public PageQueryResult<Article> pgPublishInPlatform(@JdbcConn Connection con,String pid,@Nullable String key,@DefaultValue("10") int pageSize,@DefaultValue("1") int pageNo)throws SQLException {
899
			return this.articleDao.publishInPlatform(con,pid,key,pageSize,pageNo);
900
	}
901
	
902
	@Get
903
	@Path("/pgPublishNotInPlatform")
904
	public PageQueryResult<Article> pgPublishNotInPlatform(@JdbcConn Connection con,String pid,@Nullable String key,@DefaultValue("10") int pageSize,@DefaultValue("1") int pageNo)throws SQLException {
905
			return this.articleDao.publishInPlatform(con,pid,key,pageSize,pageNo);
906
	}
907
	
890 908

891 909
	@Get
892 910
	@Path("/qaForDesk")
@ -994,12 +1012,12 @@ public class ArticleService {
994 1012

995 1013
	@Get
996 1014
	@Path("/pqself")
997
	public PageQueryResult<SelfArticle> queryPageSelf(@JdbcConn Connection con, @Nullable String ownerId,
998
			@Nullable String articleTitle, @DefaultValue("10") int pageSize, @DefaultValue("1") int pageNo) throws SQLException {
999
		if (articleTitle != null) {
1000
			articleTitle = "%" + articleTitle + "%";
1015
	public PageQueryResult<SelfArticle> queryPageSelf(@JdbcConn Connection con, String articleType, String ownerId,
1016
			@Nullable String key, @DefaultValue("10") int pageSize, @DefaultValue("1") int pageNo) throws SQLException {
1017
		if (key != null) {
1018
			key = "%" + key + "%";
1001 1019
		}
1002
		return this.articleDao.queryPageForSelf(con, ownerId, articleTitle, pageSize, pageNo);
1020
		return this.articleDao.queryPageForSelf(con,articleType,ownerId, key, pageSize, pageNo);
1003 1021
	}
1004 1022

1005 1023
	@Get

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

@ -2260,5 +2260,126 @@ COMMENT ON TABLE WARE is '文章关联服务表';
2260 2260
ALTER TABLE PPATENT ADD COLUMN COOPERATION text;
2261 2261
COMMENT ON COLUMN PPATENT.COOPERATION is '合作备注';
2262 2262

2263
--modify begin at version2.40
2264
CREATE TABLE PLATFORM_USER (
2265
	ID CHAR(32) NOT NULL,
2266
	EMAIL TEXT NOT NULL,
2267
	PHONE TEXT,
2268
	PASSWD TEXT NOT NULL,
2269
	STATE CHAR(1) NOT NULL,
2270
	CREATE_TIME CHAR(14) NOT NULL,
2271
	MODIFY_TIME CHAR(14) NOT NULL);
2272
ALTER TABLE PLATFORM_USER ADD PRIMARY KEY (ID);
2273
ALTER TABLE PLATFORM_USER ADD UNIQUE (EMAIL);
2274
ALTER TABLE PLATFORM_USER ADD UNIQUE (PHONE);
2275

2276
COMMENT ON TABLE PLATFORM_USER is '平台用户表';
2277
COMMENT ON COLUMN PLATFORM.EMAIL is '登录邮箱';
2278
COMMENT ON COLUMN PLATFORM.PHONE is '登录手机号(未户用)';
2279
COMMENT ON COLUMN PLATFORM.PASSWD is '登录密码';
2280
COMMENT ON COLUMN PLATFORM.PHONE is '状态 1:启用  0:未启用';
2281

2282
CREATE TABLE PLATFORM_INFO (
2283
	ID CHAR(10) NOT NULL,
2284
	NAME TEXT NOT NULL,
2285
	LOGO TEXT,
2286
	LINKMAN TEXT NOT NULL,
2287
	LINKPHONE TEXT NOT NULL,
2288
	LINKEAMIL TEXT NOT NULL,
2289
	PROVINCE TEXT,
2290
	CITY TEXT,
2291
	ADDR TEXT,
2292
	URL TEXT,
2293
	INDUSTRY TEXT,
2294
	DESCP TEXT NOT NULL,
2295
	CREATE_TIME CHAR(14) NOT NULL,
2296
	MODIFY_TIME CHAR(14) NOT NULL);
2297
ALTER TABLE PLATFORM_INFO ADD PRIMARY KEY (ID);
2298

2299
COMMENT ON TABLE PLATFORM_INFO is '平台信息表';
2300
COMMENT ON COLUMN PLATFORM_INFO.NAME is '平台名称';
2301
COMMENT ON COLUMN PLATFORM_INFO.LOGO is '平台LOGO';
2302
COMMENT ON COLUMN PLATFORM_INFO.LINKMAN is '联系人';
2303
COMMENT ON COLUMN PLATFORM_INFO.LINKPHONE is '联系电话';
2304
COMMENT ON COLUMN PLATFORM_INFO.LINKEMAIL is '联系邮箱';
2305
COMMENT ON COLUMN PLATFORM_INFO.PROVINCE is '省';
2306
COMMENT ON COLUMN PLATFORM_INFO.CITY is '市';
2307
COMMENT ON COLUMN PLATFORM_INFO.ADDR is '地址';
2308
COMMENT ON COLUMN PLATFORM_INFO.URL is '官网';
2309
COMMENT ON COLUMN PLATFORM_INFO.INDUSTRY is '面向行业';
2310
COMMENT ON COLUMN PLATFORM_INFO.DESCP is '平台介绍';
2311

2312

2313
 CREATE TABLE REFERENCED_ARTICLE (
2314
 	PID TEXT NOT NULL,
2315
 	AID TEXT NOT NULL,
2316
 	CREATE_TIME CHAR(14) NOT NULL);
2317
ALTER TABLE REFERENCED_ARTICLE ADD PRIMARY KEY (PID,OID);
2318
COMMENT ON TABLE REFERENCED_ARTICLE is '企业动态表';
2319
COMMENT ON COLUMN REFERENCED_ARTICLE.PID is '平台ID';
2320
COMMENT ON COLUMN REFERENCED_ARTICLE.AID is '文章ID';
2321
COMMENT ON COLUMN REFERENCED_ARTICLE.CREATE_TIME is '关联时间';
2322

2323
 CREATE TABLE RESIDENT_ORG (
2324
 	PID TEXT NOT NULL,
2325
 	OID TEXT NOT NULL,
2326
 	CREATE_TIME CHAR(14) NOT NULL);
2327
ALTER TABLE RESIDENT_ORG ADD PRIMARY KEY (PID,OID);
2328
COMMENT ON TABLE RESIDENT_ORG is '平台入驻企业表';
2329
COMMENT ON COLUMN RESIDENT_ORG.PID is '平台ID';
2330
COMMENT ON COLUMN RESIDENT_ORG.OID is '企业ID';
2331
COMMENT ON COLUMN RESIDENT_ORG.CREATE_TIME is '入驻时间';
2332

2333

2334
 CREATE TABLE BUTTED_ORG (
2335
 	PID TEXT NOT NULL,
2336
 	OID TEXT NOT NULL,
2337
 	CREATE_TIME CHAR(14) NOT NULL);
2338
ALTER TABLE BUTTED_ORG ADD PRIMARY KEY (PID,OID);
2339
COMMENT ON TABLE BUTTED_ORG is '对接的平台机构表';
2340
COMMENT ON COLUMN BUTTED_ORG.PID is '平台ID';
2341
COMMENT ON COLUMN BUTTED_ORG.OID is '对接的机构ID';
2342
COMMENT ON COLUMN BUTTED_ORG.CREATE_TIME is '对接时间';
2343

2344

2345
 CREATE TABLE BUTTED_PROFESSOR (
2346
 	PID TEXT NOT NULL,
2347
 	UID TEXT NOT NULL,
2348
 	CREATE_TIME CHAR(14) NOT NULL);
2349
ALTER TABLE BUTTED_PROFESSOR ADD PRIMARY KEY (PID,OID);
2350
COMMENT ON TABLE BUTTED_PROFESSOR is '对接的平台专家表';
2351
COMMENT ON COLUMN BUTTED_PROFESSOR.PID is '平台ID';
2352
COMMENT ON COLUMN BUTTED_PROFESSOR.UID is '对接的专家ID';
2353
COMMENT ON COLUMN BUTTED_PROFESSOR.CREATE_TIME is '对接时间';
2354

2355
CREATE TABLE PLATFORM_ORG (
2356
	ID TEXT NOT NULL,
2357
	PID TEXT NOT NULL,
2358
	LOGO TEXT,
2359
	NAME TEXT NOT NULL,
2360
	EMAIL TEXT NOT NULL,
2361
	ADDR TEXT,
2362
	LINKMAN TEXT,
2363
	LINKPHONE TEXT,
2364
	INDUSTRY TEXT,
2365
	DESCP TEXT,
2366
	CREATE_TIME CHAR(14) NOT NULL);
2367
ALTER TABLE PLATFORM_ORG ADD PRIMARY KEY (ID);
2368

2369
COMMENT ON TABLE PLATFORM_ORG is '平台待入驻企业表';
2370
COMMENT ON COLUMN PLATFORM_ORG.PID is '平台ID';
2371
COMMENT ON COLUMN PLATFORM_ORG.NAME is '企业全称';
2372
COMMENT ON COLUMN PLATFORM_ORG.EMAIL is '企业邮箱';
2373
COMMENT ON COLUMN PLATFORM_ORG.ADDR is '企业地址';
2374
COMMENT ON COLUMN PLATFORM_ORG.LINKMAN is '联系人';
2375
COMMENT ON COLUMN PLATFORM_ORG.LINKPHONE is '联系电话';
2376
COMMENT ON COLUMN PLATFORM_ORG.INDUSTRY is '所属行业';
2377
COMMENT ON COLUMN PLATFORM_ORG.DESCP is '企业介绍';
2378

2379

2380

2381

2382

2383

2263 2384

2264 2385