jiapeng 7 vuotta sitten
vanhempi
commit
b0f9261928
31 muutettua tiedostoa jossa 1047 lisäystä ja 161 poistoa
  1. 23 0
      src/main/java/com/ekexiu/portal/dao/ArtKeyWordDao.java
  2. 26 0
      src/main/java/com/ekexiu/portal/dao/ArticleOrgDao.java
  3. 5 9
      src/main/java/com/ekexiu/portal/dao/ArticleProDao.java
  4. 5 10
      src/main/java/com/ekexiu/portal/dao/ArticleResDao.java
  5. 7 0
      src/main/java/com/ekexiu/portal/dao/OrgDao.java
  6. 23 0
      src/main/java/com/ekexiu/portal/dao/OrgKeyWordDao.java
  7. 23 0
      src/main/java/com/ekexiu/portal/dao/PapKeyWordDao.java
  8. 23 0
      src/main/java/com/ekexiu/portal/dao/PatKeyWordDao.java
  9. 25 0
      src/main/java/com/ekexiu/portal/dao/ProKeyWordDao.java
  10. 6 0
      src/main/java/com/ekexiu/portal/dao/ProfessorDao.java
  11. 23 0
      src/main/java/com/ekexiu/portal/dao/ResKeyWordDao.java
  12. 12 1
      src/main/java/com/ekexiu/portal/job/ArticleTaskJobEntry.java
  13. 26 0
      src/main/java/com/ekexiu/portal/po/ArtKeyWord.java
  14. 45 0
      src/main/java/com/ekexiu/portal/po/ArticleOrg.java
  15. 26 0
      src/main/java/com/ekexiu/portal/po/OrgKeyWord.java
  16. 26 0
      src/main/java/com/ekexiu/portal/po/PapKeyWord.java
  17. 26 0
      src/main/java/com/ekexiu/portal/po/PatKeyWord.java
  18. 28 0
      src/main/java/com/ekexiu/portal/po/ProKeyWord.java
  19. 9 1
      src/main/java/com/ekexiu/portal/po/Professor.java
  20. 26 0
      src/main/java/com/ekexiu/portal/po/ResKeyWord.java
  21. 101 4
      src/main/java/com/ekexiu/portal/service/ArticleService.java
  22. 192 0
      src/main/java/com/ekexiu/portal/service/KeyWordService.java
  23. 44 0
      src/main/java/com/ekexiu/portal/service/OrgService.java
  24. 14 0
      src/main/java/com/ekexiu/portal/service/PpaperService.java
  25. 12 0
      src/main/java/com/ekexiu/portal/service/PpatentServcie.java
  26. 200 132
      src/main/java/com/ekexiu/portal/service/ProfessorService.java
  27. 40 1
      src/main/java/com/ekexiu/portal/service/ResourceService.java
  28. 28 0
      src/main/resources/database.sql
  29. 1 1
      src/main/resources/project-test-dev.properties
  30. 1 1
      src/main/resources/project-test.properties
  31. 1 1
      src/main/resources/project.properties

+ 23 - 0
src/main/java/com/ekexiu/portal/dao/ArtKeyWordDao.java

@ -0,0 +1,23 @@
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.Batch;
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.operator.DeleteWith;
10
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
11

12
import com.ekexiu.portal.po.ArtKeyWord;
13

14
@DAO
15
public interface ArtKeyWordDao {
16
	@Insert
17
	@Batch
18
	int[] insert(Connection con,ArtKeyWord[] okws)throws SQLException;
19
	
20
	@DeleteWith
21
	@From(ArtKeyWord.class)
22
	int delete(Connection con,String id)throws SQLException;
23
}

+ 26 - 0
src/main/java/com/ekexiu/portal/dao/ArticleOrgDao.java

@ -0,0 +1,26 @@
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.operator.DeleteWith;
10
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
11
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
12

13
import com.ekexiu.portal.po.ArticleOrg;
14

15
@DAO
16
public interface ArticleOrgDao {
17
	
18
	@Insert
19
	int insert(Connection con,ArticleOrg org) throws SQLException;
20
	@SelectList
21
	public abstract List<ArticleOrg> query(Connection con, String articleId) throws SQLException;
22
	@DeleteWith
23
	@From(ArticleOrg.class)
24
	public abstract int delete(Connection con, String articleId) throws SQLException;
25
	
26
}

+ 5 - 9
src/main/java/com/ekexiu/portal/dao/ArticleProDao.java

@ -4,15 +4,11 @@ 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;
8
import org.jfw.apt.orm.annotation.dao.Column;
9 7
import org.jfw.apt.orm.annotation.dao.DAO;
10 8
import org.jfw.apt.orm.annotation.dao.method.From;
11 9
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
12 10
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
13
import org.jfw.apt.orm.annotation.dao.method.operator.QueryVal;
14 11
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
15
import org.jfw.apt.orm.core.defaultImpl.IntHandler;
16 12

17 13
import com.ekexiu.portal.po.ArticlePro;
18 14

@ -21,11 +17,11 @@ public abstract class ArticleProDao {
21 17
	@Insert
22 18
	public abstract int insert(Connection con, ArticlePro articlePro) throws SQLException;
23 19

24
	@QueryVal
25
	@From(ArticlePro.class)
26
	@Column(handlerClass = IntHandler.class, value = "COUNT(1)")
27
	@DefaultValue("0")
28
	public abstract int queryByArticleId(Connection con, String articleId) throws SQLException;
20
//	@QueryVal
21
//	@From(ArticlePro.class)
22
//	@Column(handlerClass = IntHandler.class, value = "COUNT(1)")
23
//	@DefaultValue("0")
24
//	public abstract int queryByArticleId(Connection con, String articleId) throws SQLException;
29 25

30 26
	@SelectList
31 27
	public abstract List<ArticlePro> query(Connection con, String articleId) throws SQLException;

+ 5 - 10
src/main/java/com/ekexiu/portal/dao/ArticleResDao.java

@ -7,16 +7,11 @@ import java.sql.SQLException;
7 7
import java.util.ArrayList;
8 8
import java.util.List;
9 9

10
import org.jfw.apt.annotation.DefaultValue;
11
import org.jfw.apt.orm.annotation.dao.Column;
12 10
import org.jfw.apt.orm.annotation.dao.DAO;
13 11
import org.jfw.apt.orm.annotation.dao.method.From;
14 12
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
15 13
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
16
import org.jfw.apt.orm.annotation.dao.method.operator.QueryVal;
17
import org.jfw.apt.orm.core.defaultImpl.IntHandler;
18 14

19
import com.ekexiu.portal.po.ArticlePro;
20 15
import com.ekexiu.portal.po.ArticleRes;
21 16

22 17
@DAO
@ -24,11 +19,11 @@ public abstract class ArticleResDao {
24 19
	@Insert
25 20
	public abstract int insert(Connection con, ArticleRes articleRes) throws SQLException;
26 21

27
	@QueryVal
28
	@From(ArticlePro.class)
29
	@Column(handlerClass = IntHandler.class, value = "COUNT(1)")
30
	@DefaultValue("0")
31
	public abstract int queryByArticleId(Connection con, String articleId) throws SQLException;
22
//	@QueryVal
23
//	@From(ArticlePro.class)
24
//	@Column(handlerClass = IntHandler.class, value = "COUNT(1)")
25
//	@DefaultValue("0")
26
//	public abstract int queryByArticleId(Connection con, String articleId) throws SQLException;
32 27

33 28
	public List<ArticleRes> query(Connection con, String articleId) throws SQLException{
34 29
        int index = 1;

+ 7 - 0
src/main/java/com/ekexiu/portal/dao/OrgDao.java

@ -226,5 +226,12 @@ public abstract class OrgDao {
226 226
	@From(Organization.class)
227 227
	@Select(Organization.class)
228 228
	public abstract List<EditOrganization> query(Connection con,@In String[] id) throws SQLException;
229
	
230
	@LimitQuery
231
	@Select(Organization.class)
232
	@From(Organization.class)
233
	@OrderBy(" ORDER BY SORT_NUM DESC,PAGE_VIEWS DESC,SHARE_ID ASC")
234
	@Or
235
	public abstract List<EditOrganization> relateQuery(Connection con,@Nullable @SqlColumn(value={"(IS_JOIN='1' AND NAME LIKE ?)","(IS_JOIN='1' AND FOR_SHORT LIKE ?)"},handlerClass=StringHandler.class) String kw,int rows)throws SQLException;
229 236
230 237
}

+ 23 - 0
src/main/java/com/ekexiu/portal/dao/OrgKeyWordDao.java

@ -0,0 +1,23 @@
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.Batch;
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.operator.DeleteWith;
10
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
11

12
import com.ekexiu.portal.po.OrgKeyWord;
13

14
@DAO
15
public interface OrgKeyWordDao {
16
	@Insert
17
	@Batch
18
	int[] insert(Connection con,OrgKeyWord[] okws)throws SQLException;
19
	
20
	@DeleteWith
21
	@From(OrgKeyWord.class)
22
	int delete(Connection con,String id)throws SQLException;
23
}

+ 23 - 0
src/main/java/com/ekexiu/portal/dao/PapKeyWordDao.java

@ -0,0 +1,23 @@
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.Batch;
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.operator.DeleteWith;
10
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
11

12
import com.ekexiu.portal.po.PapKeyWord;
13

14
@DAO
15
public interface PapKeyWordDao {
16
	@Insert
17
	@Batch
18
	int[] insert(Connection con,PapKeyWord[] okws)throws SQLException;
19
	
20
	@DeleteWith
21
	@From(PapKeyWord.class)
22
	int delete(Connection con,String id)throws SQLException;
23
}

+ 23 - 0
src/main/java/com/ekexiu/portal/dao/PatKeyWordDao.java

@ -0,0 +1,23 @@
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.Batch;
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.operator.DeleteWith;
10
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
11

12
import com.ekexiu.portal.po.PatKeyWord;
13

14
@DAO
15
public interface PatKeyWordDao {
16
	@Insert
17
	@Batch
18
	int[] insert(Connection con,PatKeyWord[] okws)throws SQLException;
19
	
20
	@DeleteWith
21
	@From(PatKeyWord.class)
22
	int delete(Connection con,String id)throws SQLException;
23
}

+ 25 - 0
src/main/java/com/ekexiu/portal/dao/ProKeyWordDao.java

@ -0,0 +1,25 @@
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.Batch;
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.operator.DeleteWith;
10
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
11

12
import com.ekexiu.portal.po.ProKeyWord;
13

14
@DAO
15
public interface ProKeyWordDao {
16

17
	@Insert
18
	@Batch
19
	int[] insert(Connection con,ProKeyWord[] pkw)throws SQLException;
20
	
21
	@DeleteWith
22
	@From(ProKeyWord.class)
23
	int delete(Connection con,String id)throws SQLException;
24
	
25
}

+ 6 - 0
src/main/java/com/ekexiu/portal/dao/ProfessorDao.java

@ -17,6 +17,7 @@ import org.jfw.apt.orm.annotation.dao.method.From;
17 17
import org.jfw.apt.orm.annotation.dao.method.Or;
18 18
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
19 19
import org.jfw.apt.orm.annotation.dao.method.Select;
20
import org.jfw.apt.orm.annotation.dao.method.SetSentence;
20 21
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
21 22
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
22 23
import org.jfw.apt.orm.annotation.dao.method.operator.PageSelect;
@ -45,6 +46,11 @@ import com.ekexiu.portal.pojo.UserInfo;
45 46
public abstract class ProfessorDao {
46 47
	@Insert
47 48
	public abstract int insert(Connection con, Professor professor) throws SQLException;
49
	
50
	@UpdateWith
51
	@From(Professor.class)
52
	@SetSentence("PAGE_VIEWS = PAGE_VIEWS + 1")
53
	public abstract int incPageViews(Connection con,String id)throws SQLException;
48 54

49 55
	@Update
50 56
	public abstract int update(Connection con, Professor professor) throws SQLException;

+ 23 - 0
src/main/java/com/ekexiu/portal/dao/ResKeyWordDao.java

@ -0,0 +1,23 @@
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.Batch;
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.operator.DeleteWith;
10
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
11

12
import com.ekexiu.portal.po.ResKeyWord;
13

14
@DAO
15
public interface ResKeyWordDao {
16
	@Insert
17
	@Batch
18
	int[] insert(Connection con,ResKeyWord[] okws)throws SQLException;
19
	
20
	@DeleteWith
21
	@From(ResKeyWord.class)
22
	int delete(Connection con,String id)throws SQLException;
23
}

+ 12 - 1
src/main/java/com/ekexiu/portal/job/ArticleTaskJobEntry.java

@ -13,6 +13,7 @@ import org.jfw.apt.annotation.Bean;
13 13

14 14
import com.ekexiu.portal.dao.ArticleDao;
15 15
import com.ekexiu.portal.po.Article;
16
import com.ekexiu.portal.service.ArticleService;
16 17

17 18
@Bean
18 19
public class ArticleTaskJobEntry implements Runnable {
@ -23,6 +24,16 @@ public class ArticleTaskJobEntry implements Runnable {
23 24
	private DataSource dataSource;
24 25
	@Autowrie
25 26
	private ArticleDao articleDao;
27
	@Autowrie
28
	private ArticleService articleService;
29
	
30
	
31
	public ArticleService getArticleService() {
32
		return articleService;
33
	}
34
	public void setArticleService(ArticleService articleService) {
35
		this.articleService = articleService;
36
	}
26 37
	public long getDelayTime() {
27 38
		return delayTime;
28 39
	}
@ -50,7 +61,7 @@ public class ArticleTaskJobEntry implements Runnable {
50 61
				SimpleDateFormat df = new SimpleDateFormat(this.dateFormat);
51 62
				List<Article> articles = this.articleDao.queryTiming(con, df.format(new Date()));
52 63
				for (Article article : articles) {
53
					this.articleDao.updateStatus(con, article.getArticleId(), "1");
64
					this.articleService.publish(con,article.getArticleId());
54 65
					logger.info("定时发布文章:"+article.getArticleId()+"--"+df.format(new Date()));
55 66
				}
56 67
                con.commit();

+ 26 - 0
src/main/java/com/ekexiu/portal/po/ArtKeyWord.java

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

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

7
@Table
8
public class ArtKeyWord {
9
	private String id;
10
	private String kw;
11
	
12
	@Column(DE.id_32)
13
	public String getId() {
14
		return id;
15
	}
16
	public void setId(String id) {
17
		this.id = id;
18
	}
19
	@Column(DE.text_de)
20
	public String getKw() {
21
		return kw;
22
	}
23
	public void setKw(String kw) {
24
		this.kw = kw;
25
	}
26
}

+ 45 - 0
src/main/java/com/ekexiu/portal/po/ArticleOrg.java

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

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

9
import com.ekexiu.portal.basepo.CreateTimeSupported;
10
@Table
11
@Uniques(@Unique(clolumns = { "articleId", "orgId" }, name = "ARTICLE_ORG_UQ"))
12
public class ArticleOrg implements CreateTimeSupported {
13
	private String articleId;
14
	private String orgId;
15
	private String createTime;
16
	private Article article;
17
	@Override
18
	public String getCreateTime() {
19
		return this.createTime;
20
	}
21
	@Override
22
	public void setCreateTime(String createTime) {
23
		this.createTime = createTime;
24
	}
25
	@Column(DE.id_32)
26
	public String getArticleId() {
27
		return articleId;
28
	}
29
	public void setArticleId(String articleId) {
30
		this.articleId = articleId;
31
	}
32
	@Column(DE.id_32)
33
	public String getOrgId() {
34
		return orgId;
35
	}
36
	public void setOrgId(String orgId) {
37
		this.orgId = orgId;
38
	}
39
	public Article getArticle() {
40
		return article;
41
	}
42
	public void setArticle(Article article) {
43
		this.article = article;
44
	}
45
}

+ 26 - 0
src/main/java/com/ekexiu/portal/po/OrgKeyWord.java

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

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

7
@Table
8
public class OrgKeyWord {
9
	private String id;
10
	private String kw;
11
	
12
	@Column(DE.id_32)
13
	public String getId() {
14
		return id;
15
	}
16
	public void setId(String id) {
17
		this.id = id;
18
	}
19
	@Column(DE.text_de)
20
	public String getKw() {
21
		return kw;
22
	}
23
	public void setKw(String kw) {
24
		this.kw = kw;
25
	}
26
}

+ 26 - 0
src/main/java/com/ekexiu/portal/po/PapKeyWord.java

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

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

7
@Table
8
public class PapKeyWord {
9
	private String id;
10
	private String kw;
11
	
12
	@Column(DE.id_32)
13
	public String getId() {
14
		return id;
15
	}
16
	public void setId(String id) {
17
		this.id = id;
18
	}
19
	@Column(DE.text_de)
20
	public String getKw() {
21
		return kw;
22
	}
23
	public void setKw(String kw) {
24
		this.kw = kw;
25
	}
26
}

+ 26 - 0
src/main/java/com/ekexiu/portal/po/PatKeyWord.java

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

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

7
@Table
8
public class PatKeyWord {
9
	private String id;
10
	private String kw;
11
	
12
	@Column(DE.id_32)
13
	public String getId() {
14
		return id;
15
	}
16
	public void setId(String id) {
17
		this.id = id;
18
	}
19
	@Column(DE.text_de)
20
	public String getKw() {
21
		return kw;
22
	}
23
	public void setKw(String kw) {
24
		this.kw = kw;
25
	}
26
}

+ 28 - 0
src/main/java/com/ekexiu/portal/po/ProKeyWord.java

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

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

7
@Table
8
public class ProKeyWord {
9

10
	private String id;
11
	private String kw;
12
	
13
	@Column(DE.id_32)
14
	public String getId() {
15
		return id;
16
	}
17
	public void setId(String id) {
18
		this.id = id;
19
	}
20
	@Column(DE.text_de)
21
	public String getKw() {
22
		return kw;
23
	}
24
	public void setKw(String kw) {
25
		this.kw = kw;
26
	}
27
	
28
}

+ 9 - 1
src/main/java/com/ekexiu/portal/po/Professor.java

@ -55,6 +55,7 @@ public class Professor implements CreateTimeSupported, ModifyTimeSupported{
55 55
	private Integer growthValue;
56 56
	private String scorePercent;
57 57
	private long shareId;
58
	private long pageViews;
58 59
	
59 60
	private Organization organization;
60 61
	private List<Resource> resources;
@ -342,5 +343,12 @@ public class Professor implements CreateTimeSupported, ModifyTimeSupported{
342 343
		this.shareId = shareId;
343 344
	}
344 345
345
	
346
	@Column(DE.bigSerial)
347
	public long getPageViews() {
348
		return pageViews;
349
	}
350
351
	public void setPageViews(long pageViews) {
352
		this.pageViews = pageViews;
353
	}
346 354
}

+ 26 - 0
src/main/java/com/ekexiu/portal/po/ResKeyWord.java

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

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

7
@Table
8
public class ResKeyWord {
9
	private String id;
10
	private String kw;
11
	
12
	@Column(DE.id_32)
13
	public String getId() {
14
		return id;
15
	}
16
	public void setId(String id) {
17
		this.id = id;
18
	}
19
	@Column(DE.text_de)
20
	public String getKw() {
21
		return kw;
22
	}
23
	public void setKw(String kw) {
24
		this.kw = kw;
25
	}
26
}

+ 101 - 4
src/main/java/com/ekexiu/portal/service/ArticleService.java

@ -29,6 +29,7 @@ import org.jfw.util.io.IoUtil;
29 29

30 30
import com.ekexiu.portal.dao.ArticleAgreeDao;
31 31
import com.ekexiu.portal.dao.ArticleDao;
32
import com.ekexiu.portal.dao.ArticleOrgDao;
32 33
import com.ekexiu.portal.dao.ArticleProDao;
33 34
import com.ekexiu.portal.dao.ArticleResDao;
34 35
import com.ekexiu.portal.dao.LeaveWordDao;
@ -39,6 +40,7 @@ import com.ekexiu.portal.dao.ResourceDao;
39 40
import com.ekexiu.portal.dao.WatchDao;
40 41
import com.ekexiu.portal.po.Article;
41 42
import com.ekexiu.portal.po.ArticleAgree;
43
import com.ekexiu.portal.po.ArticleOrg;
42 44
import com.ekexiu.portal.po.ArticlePro;
43 45
import com.ekexiu.portal.po.ArticleRes;
44 46
import com.ekexiu.portal.po.Image;
@ -79,6 +81,30 @@ public class ArticleService {
79 81
	private ArticleProDao articleProDao;
80 82
	@Autowrie
81 83
	private ArticleResDao articleResDao;
84
	
85
	@Autowrie
86
	private ArticleOrgDao articleOrgDao;
87
	
88
	@Autowrie
89
	private KeyWordService keyWordService;
90
	
91
	
92

93
	public KeyWordService getKeyWordService() {
94
		return keyWordService;
95
	}
96

97
	public void setKeyWordService(KeyWordService keyWordService) {
98
		this.keyWordService = keyWordService;
99
	}
100

101
	public ArticleOrgDao getArticleOrgDao() {
102
		return articleOrgDao;
103
	}
104

105
	public void setArticleOrgDao(ArticleOrgDao articleOrgDao) {
106
		this.articleOrgDao = articleOrgDao;
107
	}
82 108

83 109
	public String getDateFormat() {
84 110
		return dateFormat;
@ -292,7 +318,7 @@ public class ArticleService {
292 318
	@Post
293 319
	@Path("/save")
294 320
	public String saveArticle(@JdbcConn(true) Connection con,Article article,@Nullable String[] professors,
295
			@Nullable String[] resources) throws SQLException, IOException, JfwBaseException{
321
			@Nullable String[] resources,@Nullable String[] orgs) throws SQLException, IOException, JfwBaseException{
296 322
		if(article.getArticleId() == null){
297 323
			String articleId = StringUtil.buildUUID();
298 324
			if(article.getArticleImg() != null){
@ -312,6 +338,7 @@ public class ArticleService {
312 338
				throw new JfwBaseException(-1, "错误参数:文章发布者ID");
313 339
			}
314 340
			this.articleDao.insert(con, article);
341
			this.keyWordService.refreshArticle(con,articleId, KeyWordService.splitKeyWord(article.getSubject()));
315 342
			if(professors != null){
316 343
				for (String professor : professors) {
317 344
					ArticlePro articlePro = new ArticlePro();
@ -328,6 +355,14 @@ public class ArticleService {
328 355
					this.articleResDao.insert(con, articleRes);
329 356
				}
330 357
			}
358
			if(orgs!=null && orgs.length>0){
359
				for(String org:orgs){
360
					ArticleOrg articleOrg = new ArticleOrg();
361
					articleOrg.setArticleId(articleId);
362
					articleOrg.setOrgId(org);
363
					this.articleOrgDao.insert(con, articleOrg);
364
				}
365
			}
331 366
			return articleId;
332 367
		}else if(article.getArticleId().trim().length() == 32){
333 368
			if(article.getArticleImg() != null){
@ -336,8 +371,10 @@ public class ArticleService {
336 371
			}
337 372
			this.articleDao.update(con, article);
338 373
			this.articleDao.updatePublishTime(con, article.getArticleId(), "1", this.publishTime());
374
			this.keyWordService.refreshArticle(con,article.getArticleId(), KeyWordService.splitKeyWord(article.getSubject()));
339 375
			this.articleProDao.delete(con, article.getArticleId());
340 376
			this.articleResDao.delete(con, article.getArticleId());
377
			this.articleOrgDao.delete(con, article.getArticleId());
341 378
			if(professors != null){
342 379
				for (String professor : professors) {
343 380
					ArticlePro articlePro = new ArticlePro();
@ -354,6 +391,14 @@ public class ArticleService {
354 391
					this.articleResDao.insert(con, articleRes);
355 392
				}
356 393
			}
394
			if(orgs!=null && orgs.length>0){
395
				for(String org:orgs){
396
					ArticleOrg articleOrg = new ArticleOrg();
397
					articleOrg.setArticleId(article.getArticleId());
398
					articleOrg.setOrgId(org);
399
					this.articleOrgDao.insert(con, articleOrg);
400
				}
401
			}
357 402
			return article.getArticleId();
358 403
		}else{
359 404
			throw new JfwBaseException(-2, "bad parameter:articleId");
@ -363,7 +408,7 @@ public class ArticleService {
363 408
	@Post
364 409
	@Path("/draft")
365 410
	public String draft(@JdbcConn(true) Connection con,Article article,@Nullable String[] professors,
366
			@Nullable String[] resources) throws SQLException, IOException, JfwBaseException{
411
			@Nullable String[] resources,@Nullable String[] orgs) throws SQLException, IOException, JfwBaseException{
367 412
		if(article.getArticleId() == null){
368 413
			String articleId = StringUtil.buildUUID();
369 414
			if(article.getArticleImg() != null){
@ -382,6 +427,7 @@ public class ArticleService {
382 427
				throw new JfwBaseException(-1, "错误参数:文章发布者ID");
383 428
			}
384 429
			this.articleDao.insert(con, article);
430
			this.keyWordService.refreshArticle(con,articleId, null);
385 431
			if(professors != null){
386 432
				for (String professor : professors) {
387 433
					ArticlePro articlePro = new ArticlePro();
@ -398,6 +444,14 @@ public class ArticleService {
398 444
					this.articleResDao.insert(con, articleRes);
399 445
				}
400 446
			}
447
			if(orgs!=null && orgs.length>0){
448
				for(String org:orgs){
449
					ArticleOrg articleOrg = new ArticleOrg();
450
					articleOrg.setArticleId(articleId);
451
					articleOrg.setOrgId(org);
452
					this.articleOrgDao.insert(con, articleOrg);
453
				}
454
			}
401 455
			return articleId;
402 456
		}else if(article.getArticleId().trim().length() == 32){
403 457
			if(article.getArticleImg() != null){
@ -406,8 +460,10 @@ public class ArticleService {
406 460
			}
407 461
			this.articleDao.update(con, article);
408 462
			this.articleDao.updateStatus(con, article.getArticleId(), "0");
463
			this.keyWordService.refreshArticle(con, article.getArticleId(), null);
409 464
			this.articleProDao.delete(con, article.getArticleId());
410 465
			this.articleResDao.delete(con, article.getArticleId());
466
			this.articleOrgDao.delete(con, article.getArticleId());
411 467
			if(professors != null){
412 468
				for (String professor : professors) {
413 469
					ArticlePro articlePro = new ArticlePro();
@ -424,6 +480,14 @@ public class ArticleService {
424 480
					this.articleResDao.insert(con, articleRes);
425 481
				}
426 482
			}
483
			if(orgs!=null && orgs.length>0){
484
				for(String org:orgs){
485
					ArticleOrg articleOrg = new ArticleOrg();
486
					articleOrg.setArticleId(article.getArticleId());
487
					articleOrg.setOrgId(org);
488
					this.articleOrgDao.insert(con, articleOrg);
489
				}
490
			}
427 491
			return article.getArticleId();
428 492
		}else{
429 493
			throw new JfwBaseException(-2, "bad parameter:articleId");
@ -433,7 +497,7 @@ public class ArticleService {
433 497
	@Post
434 498
	@Path("/timing")
435 499
	public String timingPublish(@JdbcConn(true) Connection con,Article article,@Nullable String[] professors,
436
			@Nullable String[] resources) throws SQLException, IOException, JfwBaseException{
500
			@Nullable String[] resources,@Nullable String[] orgs) throws SQLException, IOException, JfwBaseException{
437 501
		if(article.getPublishTime() == null){
438 502
			throw new JfwBaseException(-3, "no parameter found:publishTime");
439 503
		}
@ -471,6 +535,14 @@ public class ArticleService {
471 535
					this.articleResDao.insert(con, articleRes);
472 536
				}
473 537
			}
538
			if(orgs!=null && orgs.length>0){
539
				for(String org:orgs){
540
					ArticleOrg articleOrg = new ArticleOrg();
541
					articleOrg.setArticleId(articleId);
542
					articleOrg.setOrgId(org);
543
					this.articleOrgDao.insert(con, articleOrg);
544
				}
545
			}
474 546
			return articleId;
475 547
		}else if(article.getArticleId().trim().length() == 32){
476 548
			if(article.getArticleImg() != null){
@ -479,9 +551,11 @@ public class ArticleService {
479 551
			}
480 552
			this.articleDao.update(con, article);
481 553
			this.articleDao.updatePublishTime(con, article.getArticleId(), "2", article.getPublishTime());
554
			this.keyWordService.refreshArticle(con,article.getArticleId(), null);
482 555
			this.articleResDao.delete(con, article.getArticleId());
483 556
			this.articleProDao.delete(con, article.getArticleId());
484
			this.articleResDao.delete(con, article.getArticleId());
557
			this.articleOrgDao.delete(con, article.getArticleId());
558
			
485 559
			if(professors != null){
486 560
				for (String professor : professors) {
487 561
					ArticlePro articlePro = new ArticlePro();
@ -498,6 +572,14 @@ public class ArticleService {
498 572
					this.articleResDao.insert(con, articleRes);
499 573
				}
500 574
			}
575
			if(orgs!=null && orgs.length>0){
576
				for(String org:orgs){
577
					ArticleOrg articleOrg = new ArticleOrg();
578
					articleOrg.setArticleId(article.getArticleId());
579
					articleOrg.setOrgId(org);
580
					this.articleOrgDao.insert(con, articleOrg);
581
				}
582
			}
501 583
			return article.getArticleId();
502 584
		}else{
503 585
			throw new JfwBaseException(-2, "bad parameter:articleId");
@ -526,6 +608,7 @@ public class ArticleService {
526 608
	public void updateDraft(@JdbcConn(true) Connection con, String articleId) throws SQLException{
527 609
		//修改文章状态为草稿
528 610
		this.articleDao.updateStatus(con, articleId, "0");
611
		this.keyWordService.refreshArticle(con,articleId,null);
529 612
	}
530 613
	
531 614
	@Post
@ -533,6 +616,10 @@ public class ArticleService {
533 616
	public void publish(@JdbcConn(true) Connection con,String articleId) throws SQLException{
534 617
		//修改文章状态为发布
535 618
		this.articleDao.updateStatus(con, articleId, "1");
619
		Article a = this.articleDao.queryOne(con, articleId);
620
		if(a!=null){
621
			this.keyWordService.refreshArticle(con,articleId,KeyWordService.splitKeyWord(a.getSubject()));
622
		}
536 623
	}
537 624
	
538 625
	@Post
@ -540,6 +627,7 @@ public class ArticleService {
540 627
	public void deleteArticle(@JdbcConn(true) Connection con,String articleId) throws SQLException{
541 628
		//修改文章状态为删除
542 629
		this.articleDao.updateStatus(con, articleId, "3");
630
		this.keyWordService.refreshArticle(con, articleId,null);
543 631
	}
544 632
	
545 633
	@Post
@ -730,6 +818,12 @@ public class ArticleService {
730 818
	public List<ArticleRes> ralateRes(@JdbcConn Connection con,String articleId) throws SQLException{
731 819
		return this.articleResDao.query(con, articleId);
732 820
	}
821
	@Get
822
	@Path("/ralateOrg")
823
	public List<ArticleOrg> ralateOrg(@JdbcConn Connection con,String articleId) throws SQLException{
824
		return this.articleOrgDao.query(con, articleId);
825
	}	
826
	
733 827
	
734 828
	@Get
735 829
	@Path("/ralateArticles")
@ -755,6 +849,9 @@ public class ArticleService {
755 849
		this.leaveWordDao.deleteArticle(con, articleId);
756 850
		this.articleAgreeDao.delete(con, articleId);
757 851
		this.watchDao.deleteWatch(con, articleId);
852
		this.articleOrgDao.delete(con, articleId);
853
		this.articleProDao.delete(con, articleId);
854
		this.articleProDao.delete(con, articleId);
758 855
	}
759 856
	
760 857
	@Path("/byShareId")

+ 192 - 0
src/main/java/com/ekexiu/portal/service/KeyWordService.java

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

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

7
import org.jfw.apt.annotation.Autowrie;
8
import org.jfw.apt.annotation.Bean;
9

10
import com.ekexiu.portal.dao.ArtKeyWordDao;
11
import com.ekexiu.portal.dao.OrgKeyWordDao;
12
import com.ekexiu.portal.dao.PapKeyWordDao;
13
import com.ekexiu.portal.dao.PatKeyWordDao;
14
import com.ekexiu.portal.dao.ProKeyWordDao;
15
import com.ekexiu.portal.dao.ResKeyWordDao;
16
import com.ekexiu.portal.po.ArtKeyWord;
17
import com.ekexiu.portal.po.OrgKeyWord;
18
import com.ekexiu.portal.po.PapKeyWord;
19
import com.ekexiu.portal.po.PatKeyWord;
20
import com.ekexiu.portal.po.ProKeyWord;
21
import com.ekexiu.portal.po.ResKeyWord;
22

23
@Bean
24
public class KeyWordService {
25

26
	@Autowrie
27
	private ProKeyWordDao proKeyWordDao;
28
	@Autowrie
29
	private OrgKeyWordDao orgKeyWordDao;
30
	@Autowrie
31
	private ResKeyWordDao resKeyWordDao;
32
	@Autowrie
33
	private ArtKeyWordDao artKeyWordDao;
34
	@Autowrie
35
	private PatKeyWordDao patKeyWordDao;
36
	@Autowrie
37
	private PapKeyWordDao papKeyWordDao;
38
	
39
	
40
	public ProKeyWordDao getProKeyWordDao() {
41
		return proKeyWordDao;
42
	}
43

44
	public void setProKeyWordDao(ProKeyWordDao proKeyWordDao) {
45
		this.proKeyWordDao = proKeyWordDao;
46
	}
47

48
	public OrgKeyWordDao getOrgKeyWordDao() {
49
		return orgKeyWordDao;
50
	}
51

52
	public void setOrgKeyWordDao(OrgKeyWordDao orgKeyWordDao) {
53
		this.orgKeyWordDao = orgKeyWordDao;
54
	}
55

56
	public ResKeyWordDao getResKeyWordDao() {
57
		return resKeyWordDao;
58
	}
59

60
	public void setResKeyWordDao(ResKeyWordDao resKeyWordDao) {
61
		this.resKeyWordDao = resKeyWordDao;
62
	}
63

64
	public ArtKeyWordDao getArtKeyWordDao() {
65
		return artKeyWordDao;
66
	}
67

68
	public void setArtKeyWordDao(ArtKeyWordDao artKeyWordDao) {
69
		this.artKeyWordDao = artKeyWordDao;
70
	}
71

72
	public PatKeyWordDao getPatKeyWordDao() {
73
		return patKeyWordDao;
74
	}
75

76
	public void setPatKeyWordDao(PatKeyWordDao patKeyWordDao) {
77
		this.patKeyWordDao = patKeyWordDao;
78
	}
79

80
	public PapKeyWordDao getPapKeyWordDao() {
81
		return papKeyWordDao;
82
	}
83

84
	public void setPapKeyWordDao(PapKeyWordDao papKeyWordDao) {
85
		this.papKeyWordDao = papKeyWordDao;
86
	}
87

88
	public void refreshProfessor(Connection con,String id,String[] kws)throws SQLException{
89
		proKeyWordDao.delete(con, id);
90
		if(kws!=null && kws.length>0){
91
			ProKeyWord[] okws = new ProKeyWord[kws.length];
92
			for(int i = 0 ;i < kws.length ; ++i){
93
				ProKeyWord okw = new ProKeyWord();
94
				okw.setId(id);
95
				okw.setKw(kws[i]);
96
				okws[i]= okw;
97
			}
98
			proKeyWordDao.insert(con, okws);
99
		}
100
	}
101
	
102
	public void refreshOrg(Connection con,String id,String[] kws)throws SQLException{
103
		orgKeyWordDao.delete(con, id);
104
		if(kws!=null && kws.length>0){
105
			OrgKeyWord[] okws = new OrgKeyWord[kws.length];
106
			for(int i = 0 ;i < kws.length ; ++i){
107
				OrgKeyWord okw = new OrgKeyWord();
108
				okw.setId(id);
109
				okw.setKw(kws[i]);
110
				okws[i]= okw;
111
			}
112
			orgKeyWordDao.insert(con, okws);
113
		}
114
	}
115
	
116
	public void refreshArticle(Connection con,String id,String[] kws)throws SQLException{
117
		artKeyWordDao.delete(con, id);
118
		if(kws!=null && kws.length>0){
119
			ArtKeyWord[] okws = new ArtKeyWord[kws.length];
120
			for(int i = 0 ;i < kws.length ; ++i){
121
				ArtKeyWord okw = new ArtKeyWord();
122
				okw.setId(id);
123
				okw.setKw(kws[i]);
124
				okws[i]= okw;
125
			}
126
			artKeyWordDao.insert(con, okws);
127
		}
128
	}
129
	
130
	public void refreshResource(Connection con,String id,String[] kws)throws SQLException{
131
		resKeyWordDao.delete(con, id);
132
		if(kws!=null && kws.length>0){
133
			ResKeyWord[] okws = new ResKeyWord[kws.length];
134
			for(int i = 0 ;i < kws.length ; ++i){
135
				ResKeyWord okw = new ResKeyWord();
136
				okw.setId(id);
137
				okw.setKw(kws[i]);
138
				okws[i]= okw;
139
			}
140
			resKeyWordDao.insert(con, okws);
141
		}
142
	}
143
	
144
	public void refreshPaper(Connection con,String id,String[] kws)throws SQLException{
145
		papKeyWordDao.delete(con, id);
146
		if(kws!=null && kws.length>0){
147
			PapKeyWord[] okws = new PapKeyWord[kws.length];
148
			for(int i = 0 ;i < kws.length ; ++i){
149
				PapKeyWord okw = new PapKeyWord();
150
				okw.setId(id);
151
				okw.setKw(kws[i]);
152
				okws[i]= okw;
153
			}
154
			papKeyWordDao.insert(con, okws);
155
		}
156
	}
157
	
158
	
159
	public void refreshPatent(Connection con,String id,String[] kws)throws SQLException{
160
		patKeyWordDao.delete(con, id);
161
		if(kws!=null && kws.length>0){
162
			PatKeyWord[] okws = new PatKeyWord[kws.length];
163
			for(int i = 0 ;i < kws.length ; ++i){
164
				PatKeyWord okw = new PatKeyWord();
165
				okw.setId(id);
166
				okw.setKw(kws[i]);
167
				okws[i]= okw;
168
			}
169
			patKeyWordDao.insert(con, okws);
170
		}
171
	}
172
	public static String[] splitKeyWord(String kws){
173
		if(kws == null || kws.trim().length()== 0) return null;
174
		kws = kws.trim();		
175
		ArrayList<String> result = new ArrayList<String>();
176
		char[] cs = kws.toCharArray();
177
		int mi = cs.length;
178
		if (mi > 0) {
179
			int begin = 0;
180
			for (int i = 0; i < mi; ++i) {
181
				char c = cs[i];
182
				if (c == ',') {
183
					if (i != begin) result.add(new String(cs, begin, i - begin));
184
					begin = i + 1;
185
				}
186
			}
187
			if (begin!= mi) result.add(new String(cs, begin, mi - begin));
188
		} 
189
		return result.isEmpty()?null :result.toArray(new String[result.size()]);
190
	}
191
	
192
}

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

@ -39,8 +39,18 @@ public class OrgService {
39 39
	@Autowrie
40 40
	private OrgRegInfoDao orgRegInfoDao;
41 41
	
42
	@Autowrie
43
	private KeyWordService keyWordService;
42 44
	
43 45
	
46
	public KeyWordService getKeyWordService() {
47
		return keyWordService;
48
	}
49
50
	public void setKeyWordService(KeyWordService keyWordService) {
51
		this.keyWordService = keyWordService;
52
	}
53
44 54
	public OrgRegInfoDao getOrgRegInfoDao() {
45 55
		return orgRegInfoDao;
46 56
	}
@ -88,6 +98,18 @@ public class OrgService {
88 98
		organization.setId(StringUtil.buildUUID());
89 99
		if(organization.getOrgType()== null) organization.setOrgType(this.defaultOrgType);
90 100
		this.orgDao.insert(con, organization);
101
		Organization no = this.orgDao.query(con, organization.getId());
102
		if(no!=null && no.getIsJoin().equals("1")){
103
			String s = no.getSubject();
104
			String in = no.getIndustry();
105
			String kw = s==null?"":s.trim();
106
			kw = kw + (in==null?"":(","+in.trim()));
107
			
108
			this.keyWordService.refreshOrg(con,organization.getId(),KeyWordService.splitKeyWord(kw));
109
		}else{
110
			this.keyWordService.refreshOrg(con,organization.getId(),null);
111
		}
112
		
91 113
	}
92 114
	
93 115
	
@ -98,6 +120,17 @@ public class OrgService {
98 120
			this.imageService.saveOrgLogo(organization.getId(), fn);
99 121
		}
100 122
		this.orgDao.update(con, organization);
123
		Organization no = this.orgDao.query(con, organization.getId());
124
		if(no!=null && no.getIsJoin().equals("1")){
125
			String s = no.getSubject();
126
			String in = no.getIndustry();
127
			String kw = s==null?"":s.trim();
128
			kw = kw + (in==null?"":(","+in.trim()));
129
			
130
			this.keyWordService.refreshOrg(con,organization.getId(),KeyWordService.splitKeyWord(kw));
131
		}else{
132
			this.keyWordService.refreshOrg(con,organization.getId(),null);
133
		}
101 134
	}
102 135
	
103 136
	@Get
@ -203,4 +236,15 @@ public class OrgService {
203 236
		}
204 237
		return ret;
205 238
	}
239
	
240
	@Get
241
	@Path("/qr")
242
	public List<EditOrganization> relateQuery(@JdbcConn Connection con,@Nullable String kw,@DefaultValue("3") int limit) throws SQLException{
243
		List<EditOrganization> ret = this.orgDao.relateQuery(con, kw, limit);
244
		for (EditOrganization organization :ret) {
245
			organization.setHasOrgLogo(this.imageService.hasOrgLogo(organization.getId()));
246
		}
247
		return ret;
248
		
249
	}
206 250
}

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

@ -26,6 +26,19 @@ public class PpaperService {
26 26
	private PpaperDao ppaperDao;
27 27
	@Autowrie
28 28
	private PaperAuthorDao paperAuthorDao;
29
	
30
	@Autowrie
31
	private KeyWordService keyWordService;
32
	
33
	
34

35
	public KeyWordService getKeyWordService() {
36
		return keyWordService;
37
	}
38

39
	public void setKeyWordService(KeyWordService keyWordService) {
40
		this.keyWordService = keyWordService;
41
	}
29 42

30 43
	public PpaperDao getPpaperDao() {
31 44
		return ppaperDao;
@ -136,6 +149,7 @@ public class PpaperService {
136 149
	@Path("/kw")
137 150
	public void update(@JdbcConn(true) Connection con, String id, @Nullable String keywords) throws SQLException {
138 151
		this.ppaperDao.update(con, id, keywords);
152
		this.keyWordService.refreshPaper(con, id, KeyWordService.splitKeyWord(keywords));		
139 153
	}
140 154

141 155
	@Get

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

@ -27,7 +27,18 @@ public class PpatentServcie {
27 27
	@Autowrie
28 28
	private PatentAuthorDao patentAuthorDao;
29 29
	
30
	@Autowrie
31
	private KeyWordService keyWordService;
32
	
30 33
	
34

35
	public KeyWordService getKeyWordService() {
36
		return keyWordService;
37
	}
38

39
	public void setKeyWordService(KeyWordService keyWordService) {
40
		this.keyWordService = keyWordService;
41
	}
31 42
	
32 43
	public PpatentDao getPpatentDao() {
33 44
		return ppatentDao;
@ -134,6 +145,7 @@ public class PpatentServcie {
134 145
	@Path("/kw")
135 146
	public void update(@JdbcConn(true) Connection con,String id,@Nullable String keywords)throws SQLException{
136 147
		this.ppatentDao.update(con, id, keywords);
148
		this.keyWordService.refreshPatent(con, id, KeyWordService.splitKeyWord(keywords));		
137 149
	}
138 150
	@Get
139 151
	@Path("/byShareId")

+ 200 - 132
src/main/java/com/ekexiu/portal/service/ProfessorService.java

@ -92,6 +92,17 @@ public class ProfessorService {
92 92
	@Autowrie
93 93
	private OrgResStaffDao orgResStaffDao;
94 94

95
	@Autowrie
96
	private KeyWordService keyWordService;
97

98
	public KeyWordService getKeyWordService() {
99
		return keyWordService;
100
	}
101

102
	public void setKeyWordService(KeyWordService keyWordService) {
103
		this.keyWordService = keyWordService;
104
	}
105

95 106
	public GrowthLogService getGrowthLogService() {
96 107
		return growthLogService;
97 108
	}
@ -243,7 +254,6 @@ public class ProfessorService {
243 254
	public void setOrgDao(OrgDao orgDao) {
244 255
		this.orgDao = orgDao;
245 256
	}
246
	
247 257

248 258
	public ImageDao getImageDao() {
249 259
		return imageDao;
@ -263,37 +273,36 @@ public class ProfessorService {
263 273

264 274
	@Post
265 275
	@Path
266
	public String insert(@JdbcConn(true) Connection con, Professor professor, @Nullable String orgName)
267
			throws SQLException, IOException {
268
		if(professor.getId() == null ) {
276
	public String insert(@JdbcConn(true) Connection con, Professor professor, @Nullable String orgName) throws SQLException, IOException {
277
		if (professor.getId() == null) {
269 278
			professor.setId(StringUtil.buildUUID());
270 279
		}
271 280
		if (professor.getOrgId() == null && orgName != null) {
272
			if(null != this.orgDao.queryByName(con, orgName)){
281
			if (null != this.orgDao.queryByName(con, orgName)) {
273 282
				professor.setOrgId(this.orgDao.queryByName(con, orgName));
274 283
			} else {
275 284
				professor.setOrgId(this.orgService.createOrganization(con, orgName));
276 285
			}
277 286
		}
278
		if(professor.getOrgAuth() == null){
287
		if (professor.getOrgAuth() == null) {
279 288
			professor.setOrgAuth("0");
280 289
		}
281 290
		User user = this.userDao.query(con, professor.getId());
282
		if(user != null){
291
		if (user != null) {
283 292
			int value = 0;
284
			if(user.getMobilePhone() != null && user.getMobilePhone().trim().length() == 11){
293
			if (user.getMobilePhone() != null && user.getMobilePhone().trim().length() == 11) {
285 294
				professor.setPhone(user.getMobilePhone());
286 295
				value = value + this.rule.getBindMobile();
287 296
				this.growthLogService.firstBindMobile(con, professor.getId());
288 297
			}
289
			if(user.getEmail() != null && !"".equals(user.getEmail())){
298
			if (user.getEmail() != null && !"".equals(user.getEmail())) {
290 299
				professor.setEmail(user.getEmail());
291 300
				value = value + this.rule.getBindEmail();
292 301
				this.growthLogService.firstBindEmail(con, professor.getId());
293 302
			}
294 303
			professor.setScoreValue(value);
295 304
			professor.setGrowthValue(value);
296
		}else{
305
		} else {
297 306
			professor.setScoreValue(0);
298 307
			professor.setGrowthValue(0);
299 308
		}
@ -304,30 +313,30 @@ public class ProfessorService {
304 313
	@Put
305 314
	@Path
306 315
	public void update(@JdbcConn(true) Connection con, @RequestBody EditProfessor professor) throws SQLException, IOException {
307
		if(professor.getOrgName()!=null)
308
			if(null != this.orgDao.queryByName(con, professor.getOrgName())){
316
		if (professor.getOrgName() != null)
317
			if (null != this.orgDao.queryByName(con, professor.getOrgName())) {
309 318
				professor.setOrgId(this.orgDao.queryByName(con, professor.getOrgName()));
310 319
			} else {
311 320
				professor.setOrgId(this.orgService.createOrganization(con, professor.getOrgName()));
312 321
			}
313 322
		this.professorDao.update(con, professor);
314 323
	}
315
	
324

316 325
	@Post
317 326
	@Path("/updatePro")
318
	public void updatePro(@JdbcConn(true) Connection con,EditProfessor professor)throws SQLException, IOException{
319
		if(professor.getOrgName()!=null)
320
			if(null != this.orgDao.queryByName(con, professor.getOrgName())){
327
	public void updatePro(@JdbcConn(true) Connection con, EditProfessor professor) throws SQLException, IOException {
328
		if (professor.getOrgName() != null)
329
			if (null != this.orgDao.queryByName(con, professor.getOrgName())) {
321 330
				professor.setOrgId(this.orgDao.queryByName(con, professor.getOrgName()));
322 331
			} else {
323 332
				professor.setOrgId(this.orgService.createOrganization(con, professor.getOrgName()));
324 333
			}
325 334
		this.professorDao.update(con, professor);
326 335
	}
327
	
336

328 337
	@Get
329 338
	@Path("/queryInvite")
330
	public List<EditProfessor> queryInvite(@JdbcConn Connection con, String id) throws SQLException{
339
	public List<EditProfessor> queryInvite(@JdbcConn Connection con, String id) throws SQLException {
331 340
		List<EditProfessor> professors = this.professorDao.queryInvite(con, id);
332 341
		for (EditProfessor professor : professors) {
333 342
			professor.setHasHeadImage(this.imageService.hasProfessorImage(professor.getId()));
@ -336,27 +345,27 @@ public class ProfessorService {
336 345
		}
337 346
		return professors;
338 347
	}
339
	
348

340 349
	@Get
341 350
	@Path("/auth")
342
	public Professor queryAuth(@JdbcConn Connection con, String id) throws SQLException{
351
	public Professor queryAuth(@JdbcConn Connection con, String id) throws SQLException {
343 352
		return this.professorDao.queryAuth(con, id);
344 353
	}
345
	
354

346 355
	@Get
347 356
	@Path("/baseInfo/{id}")
348 357
	public EditProfessor queryBaseInfo(@JdbcConn Connection con, @PathVar String id) throws SQLException {
349 358
		EditProfessor professor = this.professorDao.queryBaseInfo(con, id);
350
		if(null != professor){
359
		if (null != professor) {
351 360
			professor.setHasHeadImage(this.imageService.hasProfessorImage(id));
352 361
		}
353 362
		return professor;
354 363
	}
355
	
364

356 365
	@Get
357 366
	@Path("/qaByName")
358
	public List<EditProfessor> queryByName(@JdbcConn Connection con,@Nullable String name,@DefaultValue("3") int total)throws SQLException {
359
		if(name != null){
367
	public List<EditProfessor> queryByName(@JdbcConn Connection con, @Nullable String name, @DefaultValue("3") int total) throws SQLException {
368
		if (name != null) {
360 369
			name = "%" + name + "%";
361 370
		}
362 371
		List<EditProfessor> professors = this.professorDao.queryByName(con, name, total);
@ -365,35 +374,36 @@ public class ProfessorService {
365 374
		}
366 375
		return professors;
367 376
	}
368
	
377

369 378
	@Get
370 379
	@Path("/editBaseInfo/{id}")
371 380
	public EditProfessor queryEditBaseInfo(@JdbcConn Connection con, @PathVar String id) throws SQLException {
372 381
		EditProfessor professor = this.professorDao.queryEditBaseInfo(con, id);
373
		if(null != professor){
382
		if (null != professor) {
374 383
			professor.setHasHeadImage(this.imageService.hasProfessorImage(id));
375 384
		}
376 385
		return professor;
377 386
	}
378
	
387

379 388
	@Get
380 389
	@Path("/{id}")
381 390
	public Professor query(@JdbcConn Connection con, @PathVar String id) throws SQLException {
382 391
		return this.professorDao.query(con, id);
383 392
	}
393

384 394
	@Get
385 395
	@Path("/qa")
386 396
	public List<Professor> queryAll(@JdbcConn Connection con) throws SQLException {
387 397
		return this.professorDao.query(con);
388 398
	}
389
	
399

390 400
	@Get
391 401
	@Path("/pqOrgAuth")
392
	public PageQueryResult<EditProfessor> queryPageOrgAuth(@JdbcConn Connection con,String orgId,@Nullable String orgAuth,
393
			@DefaultValue("10") int pageSize,@DefaultValue("1") int pageNo)throws SQLException{
402
	public PageQueryResult<EditProfessor> queryPageOrgAuth(@JdbcConn Connection con, String orgId, @Nullable String orgAuth, @DefaultValue("10") int pageSize,
403
			@DefaultValue("1") int pageNo) throws SQLException {
394 404
		PageQueryResult<EditProfessor> queryResult = this.professorDao.queryPage(con, orgId, orgAuth, pageSize, pageNo);
395 405
		List<EditProfessor> professors = queryResult.getData();
396
		if(!professors.isEmpty()){
406
		if (!professors.isEmpty()) {
397 407
			for (EditProfessor professor : professors) {
398 408
				professor.setHasHeadImage(this.imageService.hasProfessorImage(professor.getId()));
399 409
				professor.setResearchAreas(this.researchAreaDao.query(con, professor.getId()));
@ -402,10 +412,10 @@ public class ProfessorService {
402 412
		}
403 413
		return queryResult;
404 414
	}
405
	
415

406 416
	@Get
407 417
	@Path("/qaOrgAuth")
408
	public List<EditProfessor> queryOrgAuth(@JdbcConn Connection con,String orgId,@Nullable String orgAuth)throws SQLException{
418
	public List<EditProfessor> queryOrgAuth(@JdbcConn Connection con, String orgId, @Nullable String orgAuth) throws SQLException {
409 419
		List<EditProfessor> professors = this.professorDao.queryByOrg(con, orgId, orgAuth);
410 420
		for (EditProfessor professor : professors) {
411 421
			professor.setHasHeadImage(this.imageService.hasProfessorImage(professor.getId()));
@ -413,7 +423,7 @@ public class ProfessorService {
413 423
		}
414 424
		return professors;
415 425
	}
416
	
426

417 427
	public void updateStarAvg(Connection con) throws SQLException {
418 428
		try {
419 429
			List<Professor> professors = this.professorDao.queryStar(con);
@ -432,7 +442,7 @@ public class ProfessorService {
432 442
			e.printStackTrace();
433 443
		}
434 444
	}
435
	
445

436 446
	public void updateScorePercent(Connection con) throws SQLException {
437 447
		List<Professor> professors = this.professorDao.queryList(con);
438 448
		int count = this.professorDao.queryCount(con);
@ -440,8 +450,8 @@ public class ProfessorService {
440 450
			for (Professor professor : professors) {
441 451
				int lessThan = this.professorDao.queryCountLessThan(con, professor.getScoreValue());
442 452
				double value = 0;
443
				if(count != 0){
444
					value = (double)lessThan/(double)count;
453
				if (count != 0) {
454
					value = (double) lessThan / (double) count;
445 455
				}
446 456
				DecimalFormat df = new DecimalFormat("#%");
447 457
				this.professorDao.updateScorePercent(con, professor.getId(), df.format(value));
@ -451,13 +461,14 @@ public class ProfessorService {
451 461
			e.printStackTrace();
452 462
		}
453 463
	}
454
	
464

455 465
	@Get
456 466
	@Path("/pqHot")
457
	public PageQueryResult<EditProfessor> queryHot(@JdbcConn Connection con,@DefaultValue("8") int pageSize,@DefaultValue("1") int pageNo) throws SQLException {
467
	public PageQueryResult<EditProfessor> queryHot(@JdbcConn Connection con, @DefaultValue("8") int pageSize, @DefaultValue("1") int pageNo)
468
			throws SQLException {
458 469
		PageQueryResult<EditProfessor> queryResult = this.professorDao.queryHot(con, pageSize, pageNo);
459 470
		List<EditProfessor> professors = queryResult.getData();
460
		if(!professors.isEmpty()){
471
		if (!professors.isEmpty()) {
461 472
			for (EditProfessor editProfessor : professors) {
462 473
				editProfessor.setHasHeadImage(this.imageService.hasProfessorImage(editProfessor.getId()));
463 474
				editProfessor.setResearchAreas(this.researchAreaDao.query(con, editProfessor.getId()));
@ -466,21 +477,30 @@ public class ProfessorService {
466 477
		}
467 478
		return queryResult;
468 479
	}
469
	
480

470 481
	@Get
471 482
	@Path("/pqAPP")
472
	public PageQueryResult<EditProfessor> queryAPP(@JdbcConn Connection con, @Nullable String key,
473
			@Nullable String subject,@Nullable String industry,@Nullable String province,
474
			@Nullable String address, @DefaultValue("1") Integer authType, 
475
			@DefaultValue("10") int pageSize,@DefaultValue("1") int pageNo) throws SQLException{
476
		if(key!=null) {key="%"+key+"%";}
477
		if(subject!=null) {subject ="%"+subject+"%";}
478
		if(null!=industry) {industry="%"+industry+"%";}
479
		if(null!=province) {province="%"+province+"%";}
480
		if(null!=address) {address="%"+address+"%";}
481
		PageQueryResult<EditProfessor> queryResult = this.professorDao.queryAPP(con,key,subject,industry,province,address,authType,pageSize,pageNo);
483
	public PageQueryResult<EditProfessor> queryAPP(@JdbcConn Connection con, @Nullable String key, @Nullable String subject, @Nullable String industry,
484
			@Nullable String province, @Nullable String address, @DefaultValue("1") Integer authType, @DefaultValue("10") int pageSize,
485
			@DefaultValue("1") int pageNo) throws SQLException {
486
		if (key != null) {
487
			key = "%" + key + "%";
488
		}
489
		if (subject != null) {
490
			subject = "%" + subject + "%";
491
		}
492
		if (null != industry) {
493
			industry = "%" + industry + "%";
494
		}
495
		if (null != province) {
496
			province = "%" + province + "%";
497
		}
498
		if (null != address) {
499
			address = "%" + address + "%";
500
		}
501
		PageQueryResult<EditProfessor> queryResult = this.professorDao.queryAPP(con, key, subject, industry, province, address, authType, pageSize, pageNo);
482 502
		List<EditProfessor> editProfessors = queryResult.getData();
483
		if(!editProfessors.isEmpty()) {
503
		if (!editProfessors.isEmpty()) {
484 504
			for (EditProfessor editProfessor : editProfessors) {
485 505
				editProfessor.setHasHeadImage(this.imageService.hasProfessorImage(editProfessor.getId()));
486 506
				editProfessor.setResearchAreas(this.researchAreaDao.query(con, editProfessor.getId()));
@ -490,82 +510,97 @@ public class ProfessorService {
490 510
		}
491 511
		return queryResult;
492 512
	}
493
	
513

494 514
	@Post
495 515
	@Path("/sortFirst")
496
	public void updateSortFirst(@JdbcConn(true) Connection con, String id, Integer sortFirst) throws SQLException{
516
	public void updateSortFirst(@JdbcConn(true) Connection con, String id, Integer sortFirst) throws SQLException {
497 517
		this.professorDao.updateSortFirst(con, id, sortFirst);
498 518
	}
499
	
519

500 520
	@Post
501 521
	@Path("/authentication")
502
	public void updateAuthentication(@JdbcConn(true) Connection con, String id, Integer authentication, 
503
			Integer authType, Integer authStatus) throws SQLException{
522
	public void updateAuthentication(@JdbcConn(true) Connection con, String id, Integer authentication, Integer authType, Integer authStatus)
523
			throws SQLException {
504 524
		this.professorDao.updateAuthentication(con, id, authentication, authType, authStatus);
505 525
	}
506
	
526

507 527
	@Post
508 528
	@Path("/authType")
509
	public void updateAuthType(@JdbcConn(true) Connection con,String id,Integer authType)throws SQLException{
529
	public void updateAuthType(@JdbcConn(true) Connection con, String id, Integer authType) throws SQLException {
510 530
		this.professorDao.updateAuthType(con, id, authType);
511 531
	}
512
	
532

513 533
	@Post
514 534
	@Path("/authen")
515
	public void updateAuthen(@JdbcConn(true) Connection con,String id,Integer authentication)throws SQLException{
535
	public void updateAuthen(@JdbcConn(true) Connection con, String id, Integer authentication) throws SQLException {
516 536
		this.professorDao.updateAuthentication(con, id, authentication);
517 537
	}
518
	
538

519 539
	@Post
520 540
	@Path("/authStatus")
521
	public void updateAuthStatus(@JdbcConn(true) Connection con, String id, Integer authStatus) throws SQLException{
541
	public void updateAuthStatus(@JdbcConn(true) Connection con, String id, Integer authStatus) throws SQLException {
522 542
		this.professorDao.updateAuthStatus(con, id, authStatus);
523 543
	}
524
	
544

525 545
	@Post
526 546
	@Path("/passOrgAuth")
527
	public void passOrgAuth(@JdbcConn(true) Connection con,String id)throws SQLException{
547
	public void passOrgAuth(@JdbcConn(true) Connection con, String id) throws SQLException {
528 548
		this.professorDao.updateOrgAuth(con, id, "1");
529
		//通过企业认证给用户增加积分
549
		// 通过企业认证给用户增加积分
530 550
		this.growthLogService.authOrg(con, id);
531 551
	}
532
	
552

533 553
	@Post
534 554
	@Path("/removeOrgAuth")
535
	public void removeOrgAuth(@JdbcConn(true) Connection con,String id)throws SQLException{
555
	public void removeOrgAuth(@JdbcConn(true) Connection con, String id) throws SQLException {
536 556
		this.professorDao.updateOrgAuth(con, id, "0");
537 557
	}
538
	
558

539 559
	@Post
540 560
	@Path("/starLevel")
541
	public void updateStarLevel(@JdbcConn(true) Connection con, String id, BigDecimal starLevel) throws SQLException{
561
	public void updateStarLevel(@JdbcConn(true) Connection con, String id, BigDecimal starLevel) throws SQLException {
542 562
		this.professorDao.updateStarLevel(con, id, starLevel);
543 563
	}
544
	
564

545 565
	@Post
546 566
	@Path("/subject")
547
	public void updateSubject(@JdbcConn(true) Connection con,String id,@Nullable String subject) throws SQLException{
567
	public void updateSubject(@JdbcConn(true) Connection con, String id, @Nullable String subject) throws SQLException {
548 568
		this.professorDao.updateSubject(con, id, subject);
569
		Professor p = this.professorDao.query(con, id);
570
		// String subject = p.getSubject();
571
		if (subject == null)
572
			subject = "";
573
		String industry = p.getIndustry();
574
		if (industry == null)
575
			industry = "";
576
		this.keyWordService.refreshProfessor(con, id, KeyWordService.splitKeyWord(subject + "," + industry));
549 577
	}
550
	
578

551 579
	@Post
552 580
	@Path("/industry")
553
	public void updateIndustry(@JdbcConn(true) Connection con,String id,@Nullable String industry) throws SQLException{
581
	public void updateIndustry(@JdbcConn(true) Connection con, String id, @Nullable String industry) throws SQLException {
554 582
		this.professorDao.updateIndustry(con, id, industry);
583
		Professor p = this.professorDao.query(con, id);
584
		String subject = p.getSubject();
585
		if (subject == null)
586
			subject = "";
587
		if (industry == null)
588
			industry = "";
589
		this.keyWordService.refreshProfessor(con, id, KeyWordService.splitKeyWord(subject + "," + industry));
555 590
	}
591

556 592
	@Post
557 593
	@Path("/address")
558
	public void updateAddress(@JdbcConn(true) Connection con, String id,
559
			@Nullable String province,@Nullable String address) throws SQLException{
594
	public void updateAddress(@JdbcConn(true) Connection con, String id, @Nullable String province, @Nullable String address) throws SQLException {
560 595
		this.professorDao.updateProvince(con, id, province);
561 596
		this.professorDao.updateAddress(con, id, address);
562 597
	}
598

563 599
	@Post
564 600
	@Path("/descp")
565
	public void updateDescp(@JdbcConn(true) Connection con,String id,@Nullable String descp) throws SQLException{
601
	public void updateDescp(@JdbcConn(true) Connection con, String id, @Nullable String descp) throws SQLException {
566 602
		this.professorDao.updateDescp(con, id, descp);
567 603
	}
568
	
569 604

570 605
	@Delete
571 606
	@Path("/{id}")
@ -583,20 +618,29 @@ public class ProfessorService {
583 618
		this.watchDao.deleteWatch(con, id);
584 619
		this.resourceDao.deletePro(con, id);
585 620
		this.articleDao.deletePro(con, id);
621
		this.keyWordService.refreshProfessor(con, id, null);
586 622
	}
587
	
623

588 624
	@Get
589 625
	@Path("/pqBaseInfo")
590
	PageQueryResult<EditProfessor> queryEditBaseInfo(@JdbcConn(false) Connection con,@Nullable String key,
591
			@Nullable String subject,@Nullable String industry,@Nullable String address,@DefaultValue("1") Integer authType, 
592
			@DefaultValue("10") int pageSize,@DefaultValue("1") int pageNo)throws SQLException{
593
		if(key!=null) {key="%"+key+"%";}
594
		if(subject!=null) {subject ="%"+subject+"%";}
595
		if(null!=industry) {industry="%"+industry+"%";}
596
		if(null!=address) {address="%"+address+"%";}
626
	PageQueryResult<EditProfessor> queryEditBaseInfo(@JdbcConn(false) Connection con, @Nullable String key, @Nullable String subject, @Nullable String industry,
627
			@Nullable String address, @DefaultValue("1") Integer authType, @DefaultValue("10") int pageSize, @DefaultValue("1") int pageNo)
628
			throws SQLException {
629
		if (key != null) {
630
			key = "%" + key + "%";
631
		}
632
		if (subject != null) {
633
			subject = "%" + subject + "%";
634
		}
635
		if (null != industry) {
636
			industry = "%" + industry + "%";
637
		}
638
		if (null != address) {
639
			address = "%" + address + "%";
640
		}
597 641
		PageQueryResult<EditProfessor> queryResult = this.professorDao.queryEditBaseInfo(con, key, subject, industry, address, authType, pageSize, pageNo);
598 642
		List<EditProfessor> editProfessors = queryResult.getData();
599
		if(!editProfessors.isEmpty()){
643
		if (!editProfessors.isEmpty()) {
600 644
			for (EditProfessor editProfessor : editProfessors) {
601 645
				editProfessor.setHasHeadImage(this.imageService.hasProfessorImage(editProfessor.getId()));
602 646
				editProfessor.setResearchAreas(this.researchAreaDao.query(con, editProfessor.getId()));
@ -605,39 +649,47 @@ public class ProfessorService {
605 649
		}
606 650
		return queryResult;
607 651
	}
608
	
652

609 653
	@Get
610 654
	@Path("/pqUserInfo")
611
	PageQueryResult<UserInfo> queryUserInfo(@JdbcConn(false) Connection con,@Nullable String key,
612
			@Nullable String address,@Nullable String orgName,@Nullable Integer activeState,@Nullable Integer authType, 
613
			@DefaultValue("20") int pageSize,@DefaultValue("1") int pageNo)throws SQLException{
614
		if(key!=null) {key="%"+key+"%";}
615
		if(null!=address) {address="%"+address+"%";}
616
		if(orgName!=null) {orgName ="%"+orgName+"%";}
655
	PageQueryResult<UserInfo> queryUserInfo(@JdbcConn(false) Connection con, @Nullable String key, @Nullable String address, @Nullable String orgName,
656
			@Nullable Integer activeState, @Nullable Integer authType, @DefaultValue("20") int pageSize, @DefaultValue("1") int pageNo) throws SQLException {
657
		if (key != null) {
658
			key = "%" + key + "%";
659
		}
660
		if (null != address) {
661
			address = "%" + address + "%";
662
		}
663
		if (orgName != null) {
664
			orgName = "%" + orgName + "%";
665
		}
617 666
		return this.professorDao.queryUserInfo(con, key, address, authType, orgName, activeState, pageSize, pageNo);
618 667
	}
619
	
668

620 669
	@Get
621 670
	@Path("/pq")
622
	PageQueryResult<Professor> query(@JdbcConn(false) Connection con,@Nullable String key,
623
			@Nullable String subject,@Nullable String industry,@Nullable String address, 
624
			@DefaultValue("10") int pageSize,@DefaultValue("1") int pageNo)throws SQLException{
625
	//	System.out.println("key==["+(key==null?"":key)+"]");
626
	//	System.out.println("subject==["+(subject==null?"":subject)+"]");
627
	//	System.out.println("industry==["+(industry==null?"":industry)+"]");
628
		if(key!=null) key="%"+key+"%";
629
		if(subject!=null) subject ="%"+subject+"%";
630
		if(null!=industry) industry="%"+industry+"%";
631
		if(null!=address) address="%"+address+"%";
671
	PageQueryResult<Professor> query(@JdbcConn(false) Connection con, @Nullable String key, @Nullable String subject, @Nullable String industry,
672
			@Nullable String address, @DefaultValue("10") int pageSize, @DefaultValue("1") int pageNo) throws SQLException {
673
		// System.out.println("key==["+(key==null?"":key)+"]");
674
		// System.out.println("subject==["+(subject==null?"":subject)+"]");
675
		// System.out.println("industry==["+(industry==null?"":industry)+"]");
676
		if (key != null)
677
			key = "%" + key + "%";
678
		if (subject != null)
679
			subject = "%" + subject + "%";
680
		if (null != industry)
681
			industry = "%" + industry + "%";
682
		if (null != address)
683
			address = "%" + address + "%";
632 684
		return this.professorDao.query(con, key, subject, industry, address, pageSize, pageNo);
633 685
	}
634
	
686

635 687
	@Get
636 688
	@Path("/info/{id}")
637
	public ProfessorInfo qinfo(@JdbcConn(false) Connection con,@PathVar String id) throws SQLException{
689
	public ProfessorInfo qinfo(@JdbcConn(false) Connection con, @PathVar String id) throws SQLException {
638 690
		ProfessorInfo info = this.professorDao.queryInfo(con, id);
639
		if(info!=null){
640
			if(info.getOrgId() != null){
691
		if (info != null) {
692
			if (info.getOrgId() != null) {
641 693
				info.setOrgName(this.orgDao.query(con, info.getOrgId()).getName());
642 694
			}
643 695
			info.setHasHeadImage(this.imageService.hasProfessorImage(id));
@ -648,7 +700,7 @@ public class ProfessorService {
648 700
			info.setPatents(this.patentDao.query(con, id));
649 701
			info.setProjects(this.projectDao.query(con, id));
650 702
			List<EditResearchAreaLog> logs = this.researchAreaLogDao.query(con, id);
651
			if(!logs.isEmpty()){
703
			if (!logs.isEmpty()) {
652 704
				for (EditResearchAreaLog log : logs) {
653 705
					log.setHasHeadImage(this.imageService.hasProfessorImage(log.getOpreteProfessorId()));
654 706
				}
@ -656,7 +708,7 @@ public class ProfessorService {
656 708
			info.setEditResearchAreaLogs(logs);
657 709
			info.setResearchAreas(this.researchAreaDao.query(con, id));
658 710
			List<Resource> resources = this.resourceDao.queryPro(con, id);
659
			if(!resources.isEmpty()){
711
			if (!resources.isEmpty()) {
660 712
				for (Resource resource : resources) {
661 713
					resource.setImages(this.imageDao.queryRes(con, resource.getResourceId()));
662 714
				}
@ -664,29 +716,45 @@ public class ProfessorService {
664 716
			info.setResources(resources);
665 717
		}
666 718
		return info;
667
		
719

668 720
	}
721

669 722
	@Get
670 723
	@Path("/byShareId")
671
	public Professor query(@JdbcConn Connection con,long id)throws SQLException{
672
		return this.professorDao.query(con,id);
673
	}
674
	
675
	public static void main(String[] args)throws Exception{
676
//		Connection con = DriverManager.getConnection("jdbc:postgresql://121.42.53.174:5432/ekexiu", "postgres",  "postgres");
677
//		try{
678
//		ProfessorService service = new ProfessorService();
679
//		ProfessorDao dao = new ProfessorDaoExtend();
680
//		service.setProfessorDao(dao);
681
//		PageQueryResult<Professor> result =service.query(con,"鏉?, "鏉愭枡", "閲戝睘", 10, 2);
682
//		System.out.println(result.getTotal());
683
//		for(Professor p:result.getData()){
684
//			System.out.println("======");
685
//			JsonService.toJson(p,System.out);
686
//		}
687
//		}finally{
688
//			con.close();
689
//		}
724
	public Professor query(@JdbcConn Connection con, long id) throws SQLException {
725
		return this.professorDao.query(con, id);
726
	}
727

728
	/**
729
	 * 增加用户浏览量
730
	 * @param con
731
	 * @param id
732
	 * @throws SQLException
733
	 */
734
	@Post
735
	@Path("/incPageViews")
736
	public void incPageViews(@JdbcConn(true) Connection con, String id) throws SQLException {
737
		this.professorDao.incPageViews(con, id);
738
	}
739

740
	public static void main(String[] args) throws Exception {
741
		// Connection con =
742
		// DriverManager.getConnection("jdbc:postgresql://121.42.53.174:5432/ekexiu",
743
		// "postgres", "postgres");
744
		// try{
745
		// ProfessorService service = new ProfessorService();
746
		// ProfessorDao dao = new ProfessorDaoExtend();
747
		// service.setProfessorDao(dao);
748
		// PageQueryResult<Professor> result =service.query(con,"鏉?, "鏉愭枡",
749
		// "閲戝睘", 10, 2);
750
		// System.out.println(result.getTotal());
751
		// for(Professor p:result.getData()){
752
		// System.out.println("======");
753
		// JsonService.toJson(p,System.out);
754
		// }
755
		// }finally{
756
		// con.close();
757
		// }
690 758
		System.out.println(URLEncoder.encode("输出中文", "UTF-8"));
691 759
	}
692 760
}

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

@ -69,6 +69,20 @@ public class ResourceService {
69 69
	private OrgDao orgDao;
70 70
	@Autowrie
71 71
	private ResourceTmpLogDao resourceTmpLogDao;
72
	
73
	
74
	@Autowrie
75
	private KeyWordService keyWordService;
76
	
77
	
78

79
	public KeyWordService getKeyWordService() {
80
		return keyWordService;
81
	}
82

83
	public void setKeyWordService(KeyWordService keyWordService) {
84
		this.keyWordService = keyWordService;
85
	}
72 86

73 87
	public String getTimeFormat() {
74 88
		return timeFormat;
@ -199,6 +213,7 @@ public class ResourceService {
199 213
		resource.setResourceId(resourceId);
200 214
		this.resourceDao.insert(con, resource);
201 215
		//this.growthLogService.addResource(con, resource.getProfessorId());
216
		this.keyWordService.refreshResource(con,resourceId, KeyWordService.splitKeyWord(resource.getSubject()));
202 217
		return resourceId;
203 218
	}
204 219
	
@ -223,6 +238,7 @@ public class ResourceService {
223 238
			throw new JfwBaseException(-1, "bad parameter:ownerId");
224 239
		}
225 240
		this.resourceDao.insert(con, resource);
241
		this.keyWordService.refreshResource(con,resourceId,KeyWordService.splitKeyWord(resource.getSubject()));
226 242
		this.resourceTmpLogDao.insert(con, log);
227 243
		if(imgSrc != null){
228 244
			Image image = new Image();
@ -260,6 +276,7 @@ public class ResourceService {
260 276
			resource.setPublishTime(this.publishTime());
261 277
			resource.setResourceType("1");
262 278
			this.resourceDao.insert(con, resource);
279
			this.keyWordService.refreshResource(con,resourceId,KeyWordService.splitKeyWord(resource.getSubject()));
263 280
			//this.growthLogService.addResource(con, resource.getProfessorId());
264 281
			return resourceId;
265 282
		}else if(resource.getResourceId().trim().length() == 32){
@ -285,12 +302,23 @@ public class ResourceService {
285 302
			}
286 303
			this.resourceDao.update(con, resource);
287 304
			this.resourceDao.updatePublishTime(con, resource.getResourceId(), "1", this.publishTime());
305
			this.keyWordService.refreshResource(con,resource.getResourceId(),KeyWordService.splitKeyWord(resource.getSubject()));
288 306
			return resource.getResourceId();
289 307
		}else{
290 308
			throw new JfwBaseException(-1, "bad parameter:resourceId");
291 309
		}
292 310
	}
293
	
311
	/**
312
	 * 保存划稿
313
	 * @param con
314
	 * @param resource
315
	 * @param fns
316
	 * @param imageIds
317
	 * @return
318
	 * @throws SQLException
319
	 * @throws IOException
320
	 * @throws JfwBaseException
321
	 */
294 322
	@Post
295 323
	@Path("/draft")
296 324
	public String draft(@JdbcConn(true) Connection con, Resource resource, @Nullable String[] fns, @Nullable String[] imageIds) 
@ -305,6 +333,7 @@ public class ResourceService {
305 333
			resource.setPageViews(0);
306 334
			resource.setResourceType("1");
307 335
			this.resourceDao.insert(con, resource);
336
			this.keyWordService.refreshResource(con,resourceId,null);
308 337
			return resourceId;
309 338
		}else if(resource.getResourceId().trim().length() == 32){
310 339
			int imageLength = 0;
@ -329,6 +358,7 @@ public class ResourceService {
329 358
			}
330 359
			this.resourceDao.update(con, resource);
331 360
			this.resourceDao.updateStatus(con, resource.getResourceId(), "0");
361
			this.keyWordService.refreshResource(con,resource.getResourceId(),null);
332 362
			return resource.getResourceId();
333 363
		}else{
334 364
			throw new JfwBaseException(-1, "bad parameter:resourceId");
@ -349,6 +379,7 @@ public class ResourceService {
349 379
			resource.setPageViews(0);
350 380
			resource.setResourceType("1");
351 381
			this.resourceDao.insert(con, resource);
382
			this.keyWordService.refreshResource(con,resourceId,null);
352 383
			return resourceId;
353 384
		}else if(resource.getResourceId().trim().length() == 32){
354 385
			int imageLength = 0;
@ -373,6 +404,7 @@ public class ResourceService {
373 404
			}
374 405
			this.resourceDao.update(con, resource);
375 406
			this.resourceDao.updatePublishTime(con, resource.getResourceId(), "2", resource.getPublishTime());
407
			this.keyWordService.refreshResource(con,resource.getResourceId(),null);
376 408
			return resource.getResourceId();
377 409
		}else{
378 410
			throw new JfwBaseException(-1, "bad parameter:resourceId");
@ -394,6 +426,7 @@ public class ResourceService {
394 426
			resource.setPublishTime(this.publishTime());
395 427
			resource.setResourceType("2");
396 428
			this.resourceDao.insert(con, resource);
429
			this.keyWordService.refreshResource(con,resourceId,KeyWordService.splitKeyWord(resource.getSubject()));
397 430
			if(professorIds != null){
398 431
				for (String professorId : professorIds) {
399 432
					OrgResStaff orgResStaff = new OrgResStaff();
@ -426,6 +459,7 @@ public class ResourceService {
426 459
			}
427 460
			this.resourceDao.update(con, resource);
428 461
			this.resourceDao.updatePublishTime(con, resource.getResourceId(), "1", this.publishTime());
462
			this.keyWordService.refreshResource(con,resource.getResourceId(),null);
429 463
			this.orgResStaffDao.delete(con, resource.getResourceId());
430 464
			if(professorIds != null){
431 465
				for (String professorId : professorIds) {
@ -455,6 +489,7 @@ public class ResourceService {
455 489
			resource.setPageViews(0);
456 490
			resource.setResourceType("2");
457 491
			this.resourceDao.insert(con, resource);
492
			this.keyWordService.refreshResource(con,resourceId,null);
458 493
			if(professorIds != null){
459 494
				for (String professorId : professorIds) {
460 495
					OrgResStaff orgResStaff = new OrgResStaff();
@ -487,6 +522,7 @@ public class ResourceService {
487 522
			}
488 523
			this.resourceDao.update(con, resource);
489 524
			this.resourceDao.updateStatus(con, resource.getResourceId(), "0");
525
			this.keyWordService.refreshResource(con,resource.getResourceId(),null);
490 526
			this.orgResStaffDao.delete(con, resource.getResourceId());
491 527
			if(professorIds != null){
492 528
				for (String professorId : professorIds) {
@ -507,6 +543,7 @@ public class ResourceService {
507 543
	public void deleteRes(@JdbcConn(true) Connection con, String resourceId) throws SQLException{
508 544
		//修改资源状态为删除
509 545
		this.resourceDao.updateStatus(con, resourceId, "3");
546
		this.keyWordService.refreshResource(con,resourceId,null);
510 547
	}
511 548
	
512 549
	@Post
@ -519,6 +556,7 @@ public class ResourceService {
519 556
		}
520 557
		resource.setResourceId(resourceId);
521 558
		this.resourceDao.insert(con, resource);
559
		this.keyWordService.refreshResource(con,resourceId,KeyWordService.splitKeyWord(resource.getSubject()));
522 560
		//this.growthLogService.addResource(con, resource.getProfessorId());
523 561
		return resourceId;
524 562
	}
@ -531,6 +569,7 @@ public class ResourceService {
531 569
			this.imagesService.insert(con, resource.getResourceId(), fn);
532 570
		}
533 571
		this.resourceDao.update(con, resource);
572
		this.keyWordService.refreshResource(con,resource.getResourceId(),KeyWordService.splitKeyWord(resource.getSubject()));
534 573
	}
535 574
	
536 575
	@Post

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

@ -1518,6 +1518,34 @@ ALTER TABLE  organization ADD COLUMN linkman text;
1518 1518
COMMENT ON COLUMN  organization.linkman IS '联系人';
1519 1519

1520 1520

1521
--begin v1.9.1
1522
ALTER TABLE professor ADD COLUMN page_views  int8 default 0 not null;
1523
COMMENT ON COLUMN professor.page_views IS '浏览量';
1524

1525
CREATE TABLE art_key_word (id char(32) NOT NULL,kw text not null);
1526
COMMENT ON TABLE art_key_word IS '文章关键字';
1527
COMMENT ON COLUMN art_key_word.id IS '文章ID';
1528
COMMENT ON COLUMN art_key_word.kw IS '关键字';
1529
CREATE TABLE res_key_word (id char(32) NOT NULL,kw text not null);
1530
COMMENT ON TABLE res_key_word IS '资源关键字';
1531
COMMENT ON COLUMN res_key_word.id IS '资源ID';
1532
COMMENT ON COLUMN res_key_word.kw IS '关键字';
1533
CREATE TABLE pro_key_word (id char(32) NOT NULL,kw text not null);
1534
COMMENT ON TABLE pro_key_word IS '用户关键字';
1535
COMMENT ON COLUMN pro_key_word.id IS '用户ID';
1536
COMMENT ON COLUMN pro_key_word.kw IS '关键字';
1537
CREATE TABLE org_key_word (id char(32) NOT NULL,kw text not null);
1538
COMMENT ON TABLE org_key_word IS '企业关键字';
1539
COMMENT ON COLUMN org_key_word.id IS '企业ID';
1540
COMMENT ON COLUMN org_key_word.kw IS '关键字';
1541
CREATE TABLE pap_key_word (id char(32) NOT NULL,kw text not null);
1542
COMMENT ON TABLE pap_key_word IS '论文关键字';
1543
COMMENT ON COLUMN pap_key_word.id IS '论文ID';
1544
COMMENT ON COLUMN pap_key_word.kw IS '关键字';
1545
CREATE TABLE pat_key_word (id char(32) NOT NULL,kw text not null);
1546
COMMENT ON TABLE pat_key_word IS '专利关键字';
1547
COMMENT ON COLUMN pat_key_word.id IS '专利ID';
1548
COMMENT ON COLUMN pat_key_word.kw IS '关键字';
1521 1549

1522 1550

1523 1551


+ 1 - 1
src/main/resources/project-test-dev.properties

@ -149,7 +149,7 @@ com_ekexiu_portal_service_ArticleService.tmpPath::java.io.File=/kexiu/www/html1/
149 149
com_ekexiu_portal_service_ArticleService.articlePath::java.io.File=/kexiu/webdata1/data/article
150 150
com_ekexiu_portal_service_ArticleService.dateFormat::java.lang.String=yyyyMMdd
151 151
#科研文章图片尺寸
152
com_ekexiu_portal_service_ArticleService.artMaxLen::int=640
152
com_ekexiu_portal_service_ArticleService.artMaxLen::int=70
153 153
#资源分享图片尺寸
154 154
com_ekexiu_portal_service_ImagesService.resImageMaxLen::int=240
155 155
#认证图片保存目录

+ 1 - 1
src/main/resources/project-test.properties

@ -149,7 +149,7 @@ com_ekexiu_portal_service_ArticleService.tmpPath::java.io.File=/kexiu/www/html/i
149 149
com_ekexiu_portal_service_ArticleService.articlePath::java.io.File=/kexiu/webdata/data/article
150 150
com_ekexiu_portal_service_ArticleService.dateFormat::java.lang.String=yyyyMMdd
151 151
#科研文章图片尺寸
152
com_ekexiu_portal_service_ArticleService.artMaxLen::int=640
152
com_ekexiu_portal_service_ArticleService.artMaxLen::int=70
153 153
#资源分享图片尺寸
154 154
com_ekexiu_portal_service_ImagesService.resImageMaxLen::int=240
155 155
#认证图片保存目录

+ 1 - 1
src/main/resources/project.properties

@ -149,7 +149,7 @@ com_ekexiu_portal_service_ArticleService.tmpPath::java.io.File=/kexiu/www/html/i
149 149
com_ekexiu_portal_service_ArticleService.articlePath::java.io.File=/kexiu/webdata/data/article
150 150
com_ekexiu_portal_service_ArticleService.dateFormat::java.lang.String=yyyyMMdd
151 151
#科研文章图片尺寸
152
com_ekexiu_portal_service_ArticleService.artMaxLen::int=640
152
com_ekexiu_portal_service_ArticleService.artMaxLen::int=70
153 153
#资源分享图片尺寸
154 154
com_ekexiu_portal_service_ImagesService.resImageMaxLen::int=240
155 155
#认证图片保存目录