XMTT vor 7 Jahren
Ursprung
Commit
4fbc685eda

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

1
package com.ekexiu.portal.service;
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
import com.ekexiu.portal.cms.ContentType;
3
import com.ekexiu.portal.cms.ContentType;
34
import com.ekexiu.portal.cms.TemplateService;
4
import com.ekexiu.portal.cms.TemplateService;
35
import com.ekexiu.portal.dao.ArticleAgreeDao;
5
import com.ekexiu.portal.dao.ArticleAgreeDao;
55
import com.ekexiu.portal.pojo.EditProfessor;
25
import com.ekexiu.portal.pojo.EditProfessor;
56
import com.ekexiu.portal.pojo.FindInfo;
26
import com.ekexiu.portal.pojo.FindInfo;
57
import com.ekexiu.portal.pojo.SelfArticle;
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
@Path("/article")
57
@Path("/article")
60
public class ArticleService {
58
public class ArticleService {
763

761

764
	@Post
762
	@Post
765
	@Path("/agree")
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
		final Article article = this.articleDao.queryOne(con, articleId);
765
		final Article article = this.articleDao.queryOne(con, articleId);
768
		if(article==null){
766
		if(article==null){
769
			throw new IllegalArgumentException("not found article["+articleId+ "]");
767
			throw new IllegalArgumentException("not found article["+articleId+ "]");
773
			articleAgree.setOperateId(operateId);
771
			articleAgree.setOperateId(operateId);
774
			articleAgree.setArticleId(articleId);
772
			articleAgree.setArticleId(articleId);
775
			this.articleAgreeDao.insert(con, articleAgree);
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
package com.ekexiu.portal.service;
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
import org.jfw.apt.annotation.Autowrie;
12
import org.jfw.apt.annotation.Autowrie;
9
import org.jfw.apt.annotation.DefaultValue;
13
import org.jfw.apt.annotation.DefaultValue;
10
import org.jfw.apt.annotation.Nullable;
14
import org.jfw.apt.annotation.Nullable;
16
import org.jfw.util.PageQueryResult;
20
import org.jfw.util.PageQueryResult;
17
import org.jfw.util.exception.JfwBaseException;
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
@Path("/ppaper")
28
@Path("/ppaper")
30
public class PpaperService {
29
public class PpaperService {
197

196

198
	@Post
197
	@Post
199
	@Path("/agree")
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
		Ppaper p = this.ppaperDao.query(con, id);
200
		Ppaper p = this.ppaperDao.query(con, id);
202
		if (p == null) {
201
		if (p == null) {
203
			throw new JfwBaseException(50000, "paper[" + id + "] not found");
202
			throw new JfwBaseException(50000, "paper[" + id + "] not found");
207
		pa.setPaperId(id);
206
		pa.setPaperId(id);
208
		this.paperAgreeDao.insert(con, pa);
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
package com.ekexiu.portal.service;
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
import org.jfw.apt.annotation.Autowrie;
12
import org.jfw.apt.annotation.Autowrie;
9
import org.jfw.apt.annotation.DefaultValue;
13
import org.jfw.apt.annotation.DefaultValue;
10
import org.jfw.apt.annotation.Nullable;
14
import org.jfw.apt.annotation.Nullable;
16
import org.jfw.util.PageQueryResult;
20
import org.jfw.util.PageQueryResult;
17
import org.jfw.util.exception.JfwBaseException;
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
@Path("/ppatent")
28
@Path("/ppatent")
30
public class PpatentServcie {
29
public class PpatentServcie {
193
	
192
	
194
	@Post
193
	@Post
195
	@Path("/agree")
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
		Ppatent p = ppatentDao.query(con, id);
196
		Ppatent p = ppatentDao.query(con, id);
198
		if(p==null){
197
		if(p==null){
199
			throw new JfwBaseException(50000, "patent["+id+"] not found");
198
			throw new JfwBaseException(50000, "patent["+id+"] not found");
201
		PatentAgree pa = new PatentAgree();
200
		PatentAgree pa = new PatentAgree();
202
		pa.setOpId(uid);
201
		pa.setOpId(uid);
203
		pa.setPatentId(id);
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
package com.ekexiu.portal.service;
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
import org.jfw.apt.annotation.Autowrie;
9
import org.jfw.apt.annotation.Autowrie;
10
import org.jfw.apt.annotation.Nullable;
8
import org.jfw.apt.web.annotation.Path;
11
import org.jfw.apt.web.annotation.Path;
9
import org.jfw.apt.web.annotation.operate.Delete;
12
import org.jfw.apt.web.annotation.operate.Delete;
10
import org.jfw.apt.web.annotation.operate.Get;
13
import org.jfw.apt.web.annotation.operate.Get;
15
import org.jfw.apt.web.annotation.param.PathVar;
18
import org.jfw.apt.web.annotation.param.PathVar;
16
import org.jfw.apt.web.annotation.param.RequestBody;
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
@Path("/researchArea")
25
@Path("/researchArea")
26
public class ResearchAreaService {
26
public class ResearchAreaService {
65
65
66
	@Post
66
	@Post
67
	@Path("/agree")
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
			throws SQLException {
69
			throws SQLException {
70
70
71
		if (this.researchAreaDao.inc(con, targetId, targetCaption) > 0) {
71
		if (this.researchAreaDao.inc(con, targetId, targetCaption) > 0) {
74
			log.setOpreteProfessorId(opId);
74
			log.setOpreteProfessorId(opId);
75
			log.setProfessorId(targetId);
75
			log.setProfessorId(targetId);
76
			this.researchAreaLogDao.insert(con, log);
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
package com.ekexiu.portal.service;
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
import com.ekexiu.portal.dao.ArticleDao;
3
import com.ekexiu.portal.dao.ArticleDao;
17
import com.ekexiu.portal.dao.ImageDao;
4
import com.ekexiu.portal.dao.ImageDao;
18
import com.ekexiu.portal.dao.OrgDao;
5
import com.ekexiu.portal.dao.OrgDao;
26
import com.ekexiu.portal.po.Resource;
13
import com.ekexiu.portal.po.Resource;
27
import com.ekexiu.portal.po.Watch;
14
import com.ekexiu.portal.po.Watch;
28
import com.ekexiu.portal.pojo.EditProfessor;
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
@Path("/watch")
30
@Path("/watch")
31
public class WatchService {
31
public class WatchService {
124

124

125
	@Post
125
	@Post
126
	@Path
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
		return watch.getWatchObject();
136
		return watch.getWatchObject();
135
	}
137
	}