Parcourir la Source

Merge branch 'dev' into test

XMTT 7 ans auparavant
Parent
commit
53df2fbfd6

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

@ -1,35 +1,5 @@
1 1
package com.ekexiu.portal.service;
2 2

3
import java.io.ByteArrayInputStream;
4
import java.io.ByteArrayOutputStream;
5
import java.io.File;
6
import java.io.FileInputStream;
7
import java.io.FileOutputStream;
8
import java.io.IOException;
9
import java.io.InputStream;
10
import java.sql.Connection;
11
import java.sql.SQLException;
12
import java.text.SimpleDateFormat;
13
import java.util.Collections;
14
import java.util.Date;
15
import java.util.List;
16

17
import org.jfw.apt.annotation.Autowrie;
18
import org.jfw.apt.annotation.DefaultValue;
19
import org.jfw.apt.annotation.Nullable;
20
import org.jfw.apt.web.annotation.Path;
21
import org.jfw.apt.web.annotation.operate.Get;
22
import org.jfw.apt.web.annotation.operate.Post;
23
import org.jfw.apt.web.annotation.param.AfterCommit;
24
import org.jfw.apt.web.annotation.param.JdbcConn;
25
import org.jfw.util.DateUtil;
26
import org.jfw.util.JpgUtil;
27
import org.jfw.util.PageQueryResult;
28
import org.jfw.util.StringUtil;
29
import org.jfw.util.codec.JfwInvalidCodecKeyException;
30
import org.jfw.util.exception.JfwBaseException;
31
import org.jfw.util.io.IoUtil;
32

33 3
import com.ekexiu.portal.cms.ContentType;
34 4
import com.ekexiu.portal.cms.TemplateService;
35 5
import com.ekexiu.portal.dao.ArticleAgreeDao;
@ -55,6 +25,34 @@ import com.ekexiu.portal.pojo.EditOrganization;
55 25
import com.ekexiu.portal.pojo.EditProfessor;
56 26
import com.ekexiu.portal.pojo.FindInfo;
57 27
import com.ekexiu.portal.pojo.SelfArticle;
28
import org.jfw.apt.annotation.Autowrie;
29
import org.jfw.apt.annotation.DefaultValue;
30
import org.jfw.apt.annotation.Nullable;
31
import org.jfw.apt.web.annotation.Path;
32
import org.jfw.apt.web.annotation.operate.Get;
33
import org.jfw.apt.web.annotation.operate.Post;
34
import org.jfw.apt.web.annotation.param.AfterCommit;
35
import org.jfw.apt.web.annotation.param.JdbcConn;
36
import org.jfw.util.DateUtil;
37
import org.jfw.util.JpgUtil;
38
import org.jfw.util.PageQueryResult;
39
import org.jfw.util.StringUtil;
40
import org.jfw.util.exception.JfwBaseException;
41
import org.jfw.util.io.IoUtil;
42

43
import java.io.ByteArrayInputStream;
44
import java.io.ByteArrayOutputStream;
45
import java.io.File;
46
import java.io.FileInputStream;
47
import java.io.FileOutputStream;
48
import java.io.IOException;
49
import java.io.InputStream;
50
import java.sql.Connection;
51
import java.sql.SQLException;
52
import java.text.SimpleDateFormat;
53
import java.util.Collections;
54
import java.util.Date;
55
import java.util.List;
58 56

59 57
@Path("/article")
60 58
public class ArticleService {
@ -763,7 +761,7 @@ public class ArticleService {
763 761

764 762
	@Post
765 763
	@Path("/agree")
766
	public void agree(@JdbcConn(true) Connection con, String operateId, String articleId,String uname,@AfterCommit List<Runnable> runs) throws SQLException {
764
	public void agree(@JdbcConn(true) Connection con, String operateId, String articleId,@Nullable String uname,@AfterCommit List<Runnable> runs) throws SQLException {
767 765
		final Article article = this.articleDao.queryOne(con, articleId);
768 766
		if(article==null){
769 767
			throw new IllegalArgumentException("not found article["+articleId+ "]");
@ -773,8 +771,10 @@ public class ArticleService {
773 771
			articleAgree.setOperateId(operateId);
774 772
			articleAgree.setArticleId(articleId);
775 773
			this.articleAgreeDao.insert(con, articleAgree);
776
			if(article.getArticleType().equals("1")  && (!operateId.equals(article.getProfessorId()))){
777
				this.notifyService.notify(con, article.getProfessorId(), operateId, uname, articleId, article.getArticleTitle(), NotifyType.AGREE_ARTICLE, runs);
774
			if (uname != null) {
775
				if (article.getArticleType().equals("1") && (!operateId.equals(article.getProfessorId()))) {
776
					this.notifyService.notify(con, article.getProfessorId(), operateId, uname, articleId, article.getArticleTitle(), NotifyType.AGREE_ARTICLE, runs);
777
				}
778 778
			}
779 779
		}
780 780
	}

+ 20 - 19
src/main/java/com/ekexiu/portal/service/PpaperService.java

@ -1,10 +1,14 @@
1 1
package com.ekexiu.portal.service;
2 2

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

3
import com.ekexiu.portal.dao.PaperAgreeDao;
4
import com.ekexiu.portal.dao.PaperAuthorDao;
5
import com.ekexiu.portal.dao.PpaperDao;
6
import com.ekexiu.portal.notify.NotifyService;
7
import com.ekexiu.portal.notify.NotifyType;
8
import com.ekexiu.portal.po.PaperAgree;
9
import com.ekexiu.portal.po.PaperAuthor;
10
import com.ekexiu.portal.po.Ppaper;
11
import com.ekexiu.portal.pojo.AssedPaper;
8 12
import org.jfw.apt.annotation.Autowrie;
9 13
import org.jfw.apt.annotation.DefaultValue;
10 14
import org.jfw.apt.annotation.Nullable;
@ -16,15 +20,10 @@ import org.jfw.apt.web.annotation.param.JdbcConn;
16 20
import org.jfw.util.PageQueryResult;
17 21
import org.jfw.util.exception.JfwBaseException;
18 22

19
import com.ekexiu.portal.dao.PaperAgreeDao;
20
import com.ekexiu.portal.dao.PaperAuthorDao;
21
import com.ekexiu.portal.dao.PpaperDao;
22
import com.ekexiu.portal.notify.NotifyService;
23
import com.ekexiu.portal.notify.NotifyType;
24
import com.ekexiu.portal.po.PaperAgree;
25
import com.ekexiu.portal.po.PaperAuthor;
26
import com.ekexiu.portal.po.Ppaper;
27
import com.ekexiu.portal.pojo.AssedPaper;
23
import java.sql.Connection;
24
import java.sql.SQLException;
25
import java.util.Collections;
26
import java.util.List;
28 27

29 28
@Path("/ppaper")
30 29
public class PpaperService {
@ -197,7 +196,7 @@ public class PpaperService {
197 196

198 197
	@Post
199 198
	@Path("/agree")
200
	public void agree(@JdbcConn(true) Connection con, String id, String uid, String uname, @AfterCommit List<Runnable> runs) throws SQLException, JfwBaseException {
199
	public void agree(@JdbcConn(true) Connection con, String id, String uid,@Nullable String uname, @AfterCommit List<Runnable> runs) throws SQLException, JfwBaseException {
201 200
		Ppaper p = this.ppaperDao.query(con, id);
202 201
		if (p == null) {
203 202
			throw new JfwBaseException(50000, "paper[" + id + "] not found");
@ -207,10 +206,12 @@ public class PpaperService {
207 206
		pa.setPaperId(id);
208 207
		this.paperAgreeDao.insert(con, pa);
209 208

210
		List<PaperAuthor> pas = this.paperAuthorDao.query(con, id);
211
		for (PaperAuthor au : pas) {
212
			if (!au.getProfessorId().startsWith("#")  && (!uid.equals(au.getProfessorId()))) {
213
				this.notifyService.notify(con, au.getProfessorId(), uid, uname, id, p.getName(), NotifyType.AGREE_PAPER, runs);
209
		if (uname != null) {
210
			List<PaperAuthor> pas = this.paperAuthorDao.query(con, id);
211
			for (PaperAuthor au : pas) {
212
				if (!au.getProfessorId().startsWith("#") && (!uid.equals(au.getProfessorId()))) {
213
					this.notifyService.notify(con, au.getProfessorId(), uid, uname, id, p.getName(), NotifyType.AGREE_PAPER, runs);
214
				}
214 215
			}
215 216
		}
216 217
	}

+ 21 - 20
src/main/java/com/ekexiu/portal/service/PpatentServcie.java

@ -1,10 +1,14 @@
1 1
package com.ekexiu.portal.service;
2 2

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

3
import com.ekexiu.portal.dao.PatentAgreeDao;
4
import com.ekexiu.portal.dao.PatentAuthorDao;
5
import com.ekexiu.portal.dao.PpatentDao;
6
import com.ekexiu.portal.notify.NotifyService;
7
import com.ekexiu.portal.notify.NotifyType;
8
import com.ekexiu.portal.po.PatentAgree;
9
import com.ekexiu.portal.po.PatentAuthor;
10
import com.ekexiu.portal.po.Ppatent;
11
import com.ekexiu.portal.pojo.AssedPatent;
8 12
import org.jfw.apt.annotation.Autowrie;
9 13
import org.jfw.apt.annotation.DefaultValue;
10 14
import org.jfw.apt.annotation.Nullable;
@ -16,15 +20,10 @@ import org.jfw.apt.web.annotation.param.JdbcConn;
16 20
import org.jfw.util.PageQueryResult;
17 21
import org.jfw.util.exception.JfwBaseException;
18 22

19
import com.ekexiu.portal.dao.PatentAgreeDao;
20
import com.ekexiu.portal.dao.PatentAuthorDao;
21
import com.ekexiu.portal.dao.PpatentDao;
22
import com.ekexiu.portal.notify.NotifyService;
23
import com.ekexiu.portal.notify.NotifyType;
24
import com.ekexiu.portal.po.PatentAgree;
25
import com.ekexiu.portal.po.PatentAuthor;
26
import com.ekexiu.portal.po.Ppatent;
27
import com.ekexiu.portal.pojo.AssedPatent;
23
import java.sql.Connection;
24
import java.sql.SQLException;
25
import java.util.Collections;
26
import java.util.List;
28 27

29 28
@Path("/ppatent")
30 29
public class PpatentServcie {
@ -193,7 +192,7 @@ public class PpatentServcie {
193 192
	
194 193
	@Post
195 194
	@Path("/agree")
196
	public void agree(@JdbcConn(true) Connection con,String id,String uid,String uname,@AfterCommit List<Runnable> runs)throws SQLException, JfwBaseException{
195
	public void agree(@JdbcConn(true) Connection con,String id,String uid,@Nullable String uname,@AfterCommit List<Runnable> runs)throws SQLException, JfwBaseException{
197 196
		Ppatent p = ppatentDao.query(con, id);
198 197
		if(p==null){
199 198
			throw new JfwBaseException(50000, "patent["+id+"] not found");
@ -201,11 +200,13 @@ public class PpatentServcie {
201 200
		PatentAgree pa = new PatentAgree();
202 201
		pa.setOpId(uid);
203 202
		pa.setPatentId(id);
204
		this.patentAgreeDao.insert(con, pa);		
205
		List<PatentAuthor> authors = this.patentAuthorDao.query(con,id);
206
		for(PatentAuthor pau:authors){
207
			if(!pau.getProfessorId().startsWith("#") &&(!uid.equals(pau.getProfessorId()))){
208
				this.notifyService.notify(con,pau.getProfessorId(), uid, uname, id,p.getName(), NotifyType.AGREE_PATENT, runs);
203
		this.patentAgreeDao.insert(con, pa);
204
		if (uname != null) {
205
			List<PatentAuthor> authors = this.patentAuthorDao.query(con, id);
206
			for (PatentAuthor pau : authors) {
207
				if (!pau.getProfessorId().startsWith("#") && (!uid.equals(pau.getProfessorId()))) {
208
					this.notifyService.notify(con, pau.getProfessorId(), uid, uname, id, p.getName(), NotifyType.AGREE_PATENT, runs);
209
				}
209 210
			}
210 211
		}
211 212
	}

+ 15 - 13
src/main/java/com/ekexiu/portal/service/ResearchAreaService.java

@ -1,10 +1,13 @@
1 1
package com.ekexiu.portal.service;
2 2
3
import java.sql.Connection;
4
import java.sql.SQLException;
5
import java.util.List;
6
3
import com.ekexiu.portal.dao.ResearchAreaDao;
4
import com.ekexiu.portal.dao.ResearchAreaLogDao;
5
import com.ekexiu.portal.notify.NotifyService;
6
import com.ekexiu.portal.notify.NotifyType;
7
import com.ekexiu.portal.po.ResearchArea;
8
import com.ekexiu.portal.po.ResearchAreaLog;
7 9
import org.jfw.apt.annotation.Autowrie;
10
import org.jfw.apt.annotation.Nullable;
8 11
import org.jfw.apt.web.annotation.Path;
9 12
import org.jfw.apt.web.annotation.operate.Delete;
10 13
import org.jfw.apt.web.annotation.operate.Get;
@ -15,12 +18,9 @@ import org.jfw.apt.web.annotation.param.JdbcConn;
15 18
import org.jfw.apt.web.annotation.param.PathVar;
16 19
import org.jfw.apt.web.annotation.param.RequestBody;
17 20
18
import com.ekexiu.portal.dao.ResearchAreaDao;
19
import com.ekexiu.portal.dao.ResearchAreaLogDao;
20
import com.ekexiu.portal.notify.NotifyService;
21
import com.ekexiu.portal.notify.NotifyType;
22
import com.ekexiu.portal.po.ResearchArea;
23
import com.ekexiu.portal.po.ResearchAreaLog;
21
import java.sql.Connection;
22
import java.sql.SQLException;
23
import java.util.List;
24 24
25 25
@Path("/researchArea")
26 26
public class ResearchAreaService {
@ -65,7 +65,7 @@ public class ResearchAreaService {
65 65
66 66
	@Post
67 67
	@Path("/agree")
68
	public void agree(@JdbcConn(true) Connection con, String targetId, String targetCaption, String opId, String uname, @AfterCommit List<Runnable> runs)
68
	public void agree(@JdbcConn(true) Connection con, String targetId, String targetCaption, String opId, @Nullable String uname, @AfterCommit List<Runnable> runs)
69 69
			throws SQLException {
70 70
71 71
		if (this.researchAreaDao.inc(con, targetId, targetCaption) > 0) {
@ -74,8 +74,10 @@ public class ResearchAreaService {
74 74
			log.setOpreteProfessorId(opId);
75 75
			log.setProfessorId(targetId);
76 76
			this.researchAreaLogDao.insert(con, log);
77
			if (!targetId .equals(opId)) {
78
				this.notifyService.notify(con, targetId, opId, uname, targetId, targetCaption, NotifyType.AGREE_RESEARCH_AREA, runs);
77
			if (uname != null) {
78
				if (!targetId.equals(opId)) {
79
					this.notifyService.notify(con, targetId, opId, uname, targetId, targetCaption, NotifyType.AGREE_RESEARCH_AREA, runs);
80
				}
79 81
			}
80 82
		}
81 83
	}

+ 21 - 19
src/main/java/com/ekexiu/portal/service/WatchService.java

@ -1,18 +1,5 @@
1 1
package com.ekexiu.portal.service;
2 2

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

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

16 3
import com.ekexiu.portal.dao.ArticleDao;
17 4
import com.ekexiu.portal.dao.ImageDao;
18 5
import com.ekexiu.portal.dao.OrgDao;
@ -26,6 +13,19 @@ import com.ekexiu.portal.po.Article;
26 13
import com.ekexiu.portal.po.Resource;
27 14
import com.ekexiu.portal.po.Watch;
28 15
import com.ekexiu.portal.pojo.EditProfessor;
16
import org.jfw.apt.annotation.Autowrie;
17
import org.jfw.apt.annotation.DefaultValue;
18
import org.jfw.apt.annotation.Nullable;
19
import org.jfw.apt.web.annotation.Path;
20
import org.jfw.apt.web.annotation.operate.Get;
21
import org.jfw.apt.web.annotation.operate.Post;
22
import org.jfw.apt.web.annotation.param.AfterCommit;
23
import org.jfw.apt.web.annotation.param.JdbcConn;
24
import org.jfw.util.PageQueryResult;
25

26
import java.sql.Connection;
27
import java.sql.SQLException;
28
import java.util.List;
29 29

30 30
@Path("/watch")
31 31
public class WatchService {
@ -124,12 +124,14 @@ public class WatchService {
124 124

125 125
	@Post
126 126
	@Path
127
	public String insert(@JdbcConn(true) Connection con, Watch watch, final String uname, @AfterCommit List<Runnable> runs) throws SQLException {
128
		this.watchDao.insert(con, watch);
129
		if (watch.getWatchType() == 1 && (!watch.getWatchObject().equals(watch.getProfessorId()))) {
130
			this.notifyService.notify(con, watch.getWatchObject(), watch.getProfessorId(), uname, watch.getWatchObject(), watch.getWatchObject(),
131
					NotifyType.WATCH_USER, runs);
132
		}
127
    public String insert(@JdbcConn(true) Connection con, Watch watch, @Nullable final String uname, @AfterCommit List<Runnable> runs) throws SQLException {
128
        this.watchDao.insert(con, watch);
129
        if (uname != null) {
130
            if (watch.getWatchType() == 1 && (!watch.getWatchObject().equals(watch.getProfessorId()))) {
131
                this.notifyService.notify(con, watch.getWatchObject(), watch.getProfessorId(), uname, watch.getWatchObject(), watch.getWatchObject(),
132
                        NotifyType.WATCH_USER, runs);
133
            }
134
        }
133 135

134 136
		return watch.getWatchObject();
135 137
	}