jiapeng 7 years ago
parent
commit
937f9d83ba

+ 51 - 0
pom.xml

@ -128,6 +128,57 @@
128 128
			<artifactId>freemarker</artifactId>
129 129
			<version>2.3.26-incubating</version>
130 130
		</dependency>
131
		<dependency>
132
			<groupId>com.itextpdf</groupId>
133
			<artifactId>barcodes</artifactId>
134
			<version>7.0.0</version>
135
			<!-- barcodes depends on kernel -->
136
		</dependency>
137
		<dependency>
138
			<groupId>com.itextpdf</groupId>
139
			<artifactId>font-asian</artifactId>
140
			<version>7.0.0</version>
141
		</dependency>
142
		<dependency>
143
			<groupId>com.itextpdf</groupId>
144
			<artifactId>forms</artifactId>
145
			<version>7.0.0</version>
146
			<!-- forms depends on kernel and layout -->
147
		</dependency>
148
		<dependency>
149
			<groupId>com.itextpdf</groupId>
150
			<artifactId>hyph</artifactId>
151
			<version>7.0.0</version>
152
		</dependency>
153
		<dependency>
154
			<groupId>com.itextpdf</groupId>
155
			<artifactId>io</artifactId>
156
			<version>7.0.0</version>
157
		</dependency>
158
		<dependency>
159
			<groupId>com.itextpdf</groupId>
160
			<artifactId>kernel</artifactId>
161
			<version>7.0.0</version>
162
			<!-- kernel depends on io -->
163
		</dependency>
164
		<dependency>
165
			<groupId>com.itextpdf</groupId>
166
			<artifactId>layout</artifactId>
167
			<version>7.0.0</version>
168
			<!-- layout depends on kernel -->
169
		</dependency>
170
		<dependency>
171
			<groupId>com.itextpdf</groupId>
172
			<artifactId>pdfa</artifactId>
173
			<version>7.0.0</version>
174
			<!-- pdfa depends on kernel -->
175
		</dependency>
176
		<dependency>
177
			<groupId>com.itextpdf</groupId>
178
			<artifactId>sign</artifactId>
179
			<version>7.0.0</version>
180
			<!-- sign depends on kernel, layout and forms -->
181
		</dependency>
131 182
	</dependencies>
132 183
	<build>
133 184
		<resources>

+ 27 - 6
src/main/java/com/ekexiu/portal/dao/ArticleDao.java

@ -24,6 +24,7 @@ import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
24 24
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
25 25
import org.jfw.apt.orm.annotation.dao.method.operator.Update;
26 26
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
27
import org.jfw.apt.orm.annotation.dao.param.GtEq;
27 28
import org.jfw.apt.orm.annotation.dao.param.In;
28 29
import org.jfw.apt.orm.annotation.dao.param.LessThan;
29 30
import org.jfw.apt.orm.annotation.dao.param.Like;
@ -140,7 +141,7 @@ public abstract class ArticleDao {
140 141
		int index = 1;
141 142
		boolean hasArticleId = null != articleId;
142 143
		StringBuilder sql = new StringBuilder();
143
		sql.append("SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,'',SUBJECT,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME,SHARE_ID FROM ARTICLE");
144
		sql.append("SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,'',SUBJECT,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME,SHARE_ID,COL_NUM FROM ARTICLE");
144 145
		sql.append(" WHERE STATUS = '1'");
145 146
		if(hasArticleId){
146 147
			sql.append(" AND ARTICLE_ID != ?");
@ -204,6 +205,7 @@ public abstract class ArticleDao {
204 205
                    article.setCreateTime(rs.getString(13));
205 206
                    article.setModifyTime(rs.getString(14));
206 207
                    article.setShareId(rs.getLong(15));
208
                    article.setColNum(rs.getInt(16));
207 209
					articles.add(article);
208 210
				}
209 211
				return articles;
@ -221,7 +223,7 @@ public abstract class ArticleDao {
221 223
		boolean hasOrgId = null != orgId;
222 224
		boolean hasArticleId = null != articleId;
223 225
		StringBuilder sql = new StringBuilder();
224
		sql.append("SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,'',SUBJECT,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME,SHARE_ID FROM ARTICLE");
226
		sql.append("SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,'',SUBJECT,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME,SHARE_ID,COL_NUM FROM ARTICLE");
225 227
		sql.append(" WHERE STATUS = '1'");
226 228
		if(hasProId){
227 229
			sql.append(" AND PROFESSOR_ID = ?");
@ -297,6 +299,7 @@ public abstract class ArticleDao {
297 299
                    article.setCreateTime(rs.getString(13));
298 300
                    article.setModifyTime(rs.getString(14));
299 301
                    article.setShareId(rs.getLong(15));
302
                    article.setColNum(rs.getInt(16));
300 303
					articles.add(article);
301 304
				}
302 305
				return articles;
@ -488,7 +491,7 @@ public abstract class ArticleDao {
488 491
        if(firstPage){
489 492
            queryResult.setPageNo(1);
490 493
            sql = new StringBuilder();
491
            sql.append("SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,'',SUBJECT,INDUSTRY,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME,SHARE_ID FROM ARTICLE");
494
            sql.append("SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,'',SUBJECT,INDUSTRY,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME,SHARE_ID,COL_NUM FROM ARTICLE");
492 495
            sql.append(whereSql);
493 496
            sql.append(" ORDER BY SORT_NUM DESC, PUBLISH_TIME DESC");
494 497
            sql.append(" LIMIT ").append(pageSize);
@ -504,7 +507,7 @@ public abstract class ArticleDao {
504 507
            --pageNo;
505 508
            int offset = (pageNo * pageSize);
506 509
            sql = new StringBuilder();
507
            sql.append("SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,'',SUBJECT,INDUSTRY,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME,SHARE_ID FROM ARTICLE");
510
            sql.append("SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,'',SUBJECT,INDUSTRY,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME,SHARE_ID,COL_NUM FROM ARTICLE");
508 511
            sql.append(whereSql);
509 512
            sql.append(" ORDER BY SORT_NUM DESC,PUBLISH_TIME DESC");
510 513
            sql.append(" LIMIT ").append(pageSize).append(" OFFSET ").append(offset);
@ -578,6 +581,7 @@ public abstract class ArticleDao {
578 581
                    article.setCreateTime(rs.getString(14));
579 582
                    article.setModifyTime(rs.getString(15));
580 583
                    article.setShareId(rs.getLong(16));
584
                    article.setColNum(rs.getInt(17));
581 585
                    articles.add(article);
582 586
                }
583 587
                return queryResult;
@ -640,7 +644,7 @@ public abstract class ArticleDao {
640 644
        if(firstPage){
641 645
        	queryResult.setPageNo(1);
642 646
        	sql = new StringBuilder();
643
        	sql.append("(SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,'',SUBJECT,INDUSTRY,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME,SHARE_ID FROM ARTICLE WHERE STATUS IN('0','2')");
647
        	sql.append("(SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,'',SUBJECT,INDUSTRY,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME,SHARE_ID,COL_NUM FROM ARTICLE WHERE STATUS IN('0','2')");
644 648
        	if(hasProfessorId){
645 649
            	sql.append(" AND PROFESSOR_ID = ?");
646 650
            }
@ -674,7 +678,7 @@ public abstract class ArticleDao {
674 678
            --pageNo;
675 679
            int offset = (pageNo * pageSize);
676 680
            sql = new StringBuilder();
677
            sql.append("(SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,'',SUBJECT,INDUSTRY,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME,SHARE_ID FROM ARTICLE WHERE STATUS IN('0','2')");
681
            sql.append("(SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,'',SUBJECT,INDUSTRY,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME,SHARE_ID,COL_NUM FROM ARTICLE WHERE STATUS IN('0','2')");
678 682
        	if(hasProfessorId){
679 683
            	sql.append(" AND PROFESSOR_ID = ?");
680 684
            }
@ -778,6 +782,7 @@ public abstract class ArticleDao {
778 782
                    article.setCreateTime(rs.getString(14));
779 783
                    article.setModifyTime(rs.getString(15));
780 784
                    article.setShareId(rs.getLong(16));
785
                    article.setColNum(rs.getInt(17));
781 786
                    articles.add(article);
782 787
                }
783 788
                return queryResult;
@ -965,4 +970,20 @@ public abstract class ArticleDao {
965 970
	@Nullable
966 971
	public abstract Article query(Connection con ,long shareId)throws SQLException;
967 972

973
	
974
	@PageSelect 
975
	@Exclude("articleContent")
976
	@OrderBy(" ORDER BY PUBLISH_TIME DESC,SHARE_ID ASC ")
977
	@Where("STATUS='1'")
978
	public abstract PageQueryResult<Article> queryFind(Connection con,Integer colNum,int pageSize,int pageNo)throws SQLException;
979

980
	
981
	@LimitSelect
982
	@Exclude("articleContent")
983
	@OrderBy(" ORDER BY PAGE_VIEWS DESC,SHARE_ID ASC ")
984
	@Where("STATUS='1'")
985
	public abstract List<Article> lasterByPublishTime(Connection con,@GtEq String publishTime ,int rows) throws SQLException;
986
	
987
	
988
	
968 989
}

+ 8 - 2
src/main/java/com/ekexiu/portal/po/Article.java

@ -34,6 +34,7 @@ public class Article implements CreateTimeSupported, ModifyTimeSupported {
34 34
	private EditProfessor professor;
35 35
	private Organization organization;
36 36
	private EditOrganization editOrganization;
37
	private int colNum;
37 38
	
38 39
	public EditProfessor getProfessor() {
39 40
		return professor;
@ -163,6 +164,11 @@ public class Article implements CreateTimeSupported, ModifyTimeSupported {
163 164
	public void setShareId(long shareId) {
164 165
		this.shareId = shareId;
165 166
	}
166
	
167

167
	@Column(DE.int_de)
168
	public int getColNum() {
169
		return colNum;
170
	}
171
	public void setColNum(int colNum) {
172
		this.colNum = colNum;
173
	}
168 174
}

+ 9 - 3
src/main/java/com/ekexiu/portal/po/Organization.java

@ -5,6 +5,7 @@ import org.jfw.apt.orm.annotation.entry.PrimaryKey;
5 5
import org.jfw.apt.orm.annotation.entry.Table;
6 6
import org.jfw.apt.orm.annotation.entry.Unique;
7 7
import org.jfw.apt.orm.annotation.entry.Uniques;
8
import org.jfw.apt.orm.core.defaultImpl.BooleanHandler;
8 9
import org.jfw.apt.orm.core.defaultImpl.FixLenStringHandler;
9 10
import org.jfw.apt.orm.core.defaultImpl.LongHandler;
10 11
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
@ -85,6 +86,7 @@ public class Organization extends BaseOrganization implements CreateTimeSupporte
85 86
	 */
86 87
	private long pageViews;
87 88
	private long shareId;
89
	private boolean colMgr;
88 90
	
89 91
90 92
	@Column(value=DE.String_de,dbType="VARCHAR(20)")
@ -238,7 +240,11 @@ public class Organization extends BaseOrganization implements CreateTimeSupporte
238 240
	public void setShareId(long shareId) {
239 241
		this.shareId = shareId;
240 242
	}
241
	
242
	
243
	
243
	@Column(handlerClass=BooleanHandler.class,dbType="CHAR(1)",fixSqlValueWithInsert="'0'",insertable=true,nullable=false,queryable=true,renewable = false)
244
	public boolean isColMgr() {
245
		return colMgr;
246
	}
247
	public void setColMgr(boolean colMgr) {
248
		this.colMgr = colMgr;
249
	}	
244 250
}

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

@ -21,6 +21,7 @@ import org.jfw.apt.web.annotation.Path;
21 21
import org.jfw.apt.web.annotation.operate.Get;
22 22
import org.jfw.apt.web.annotation.operate.Post;
23 23
import org.jfw.apt.web.annotation.param.JdbcConn;
24
import org.jfw.util.DateUtil;
24 25
import org.jfw.util.JpgUtil;
25 26
import org.jfw.util.PageQueryResult;
26 27
import org.jfw.util.StringUtil;
@ -834,32 +835,7 @@ public class ArticleService {
834 835
			return this.articleDao.query(con, ids);
835 836
		}
836 837
		return Collections.<Article> emptyList();
837
		// List<Article> articles = new ArrayList<Article>();
838
		// if(keys != null){
839
		// articles = this.articleDao.queryLimit(con, keys, articleId, rows);
840
		// }
841
		// if(articles.isEmpty()){
842
		// articles = this.articleDao.queryByAuthor(con, professorId, orgId,
843
		// articleId, rows);
844
		// if(articles.isEmpty()){
845
		// articles = this.articleDao.queryByPageViews(con, articleId, rows);
846
		// }
847
		// }
848
		// return articles;
849
	}
850

851
	// @Post
852
	// @Path("/delete")
853
	// public void delete(@JdbcConn(true) Connection con, String articleId)
854
	// throws SQLException{
855
	// this.articleDao.delete(con, articleId);
856
	// this.leaveWordDao.deleteArticle(con, articleId,LeaveWordService.ARTICLE);
857
	// this.articleAgreeDao.delete(con, articleId);
858
	// this.watchDao.deleteWatch(con, articleId);
859
	// this.articleOrgDao.delete(con, articleId);
860
	// this.articleProDao.delete(con, articleId);
861
	// this.articleProDao.delete(con, articleId);
862
	// }
838
	}
863 839

864 840
	@Get
865 841
	@Path("/byAssProfessor")
@ -919,5 +895,23 @@ public class ArticleService {
919 895
	public Article query(@JdbcConn Connection con, long id) throws SQLException {
920 896
		return this.articleDao.query(con, id);
921 897
	}
898
	
899
	
900
	@Path("/find")
901
	@Get
902
	public PageQueryResult<Article> find(@JdbcConn Connection con,@DefaultValue("0") int col,@DefaultValue("20") int pageSize,@DefaultValue("1") int pageNo) throws SQLException{
903
			return this.articleDao.queryFind(con,col>0?col:null, pageSize, pageNo);
904
	}
905
	@Path("/lastestPublished")
906
	@Get
907
	public List<Article> lastet(@JdbcConn Connection con,@Nullable String time,@DefaultValue("10") int rows) throws SQLException{
908
		if(time==null){
909
			time = DateUtil.formatDate(System.currentTimeMillis() - 7*24*60*60*1000)+"000000";
910
		}
911
		return this.articleDao.lasterByPublishTime(con,time,rows);		
912
	}
922 913

914
	public static void main(String[] args){
915
		System.out.println( DateUtil.formatDate(System.currentTimeMillis() - 7*24*60*60*1000));
916
	}
923 917
}

+ 881 - 0
src/main/java/com/ekexiu/portal/util/ProfessorPdfServlet.java

@ -0,0 +1,881 @@
1
package com.ekexiu.portal.util;
2

3
import java.io.IOException;
4
import java.io.OutputStream;
5
import java.net.URLEncoder;
6
import java.sql.Connection;
7
import java.sql.PreparedStatement;
8
import java.sql.ResultSet;
9
import java.sql.SQLException;
10

11
import javax.servlet.ServletException;
12
import javax.servlet.http.HttpServlet;
13
import javax.servlet.http.HttpServletRequest;
14
import javax.servlet.http.HttpServletResponse;
15
import javax.sql.DataSource;
16

17
import org.jfw.util.context.JfwAppContext;
18
import org.jfw.util.jdbc.JdbcUtil;
19
import org.jfw.util.jdbc.PreparedStatementConfig;
20
import org.jfw.util.jdbc.ResultSetExtractor;
21

22
import com.ekexiu.portal.po.Honor;
23
import com.ekexiu.portal.po.PartTimeJob;
24
import com.ekexiu.portal.po.Ppaper;
25
import com.ekexiu.portal.po.Ppatent;
26
import com.ekexiu.portal.po.ProfessorEduBg;
27
import com.ekexiu.portal.po.Project;
28
import com.itextpdf.io.source.ByteArrayOutputStream;
29
import com.itextpdf.kernel.color.Color;
30
import com.itextpdf.kernel.color.DeviceRgb;
31
import com.itextpdf.kernel.events.Event;
32
import com.itextpdf.kernel.events.IEventHandler;
33
import com.itextpdf.kernel.events.PdfDocumentEvent;
34
import com.itextpdf.kernel.font.PdfFont;
35
import com.itextpdf.kernel.font.PdfFontFactory;
36
import com.itextpdf.kernel.geom.PageSize;
37
import com.itextpdf.kernel.geom.Rectangle;
38
import com.itextpdf.kernel.pdf.PdfDocument;
39
import com.itextpdf.kernel.pdf.PdfPage;
40
import com.itextpdf.kernel.pdf.PdfWriter;
41
import com.itextpdf.kernel.pdf.canvas.PdfCanvas;
42
import com.itextpdf.layout.Document;
43
import com.itextpdf.layout.border.SolidBorder;
44
import com.itextpdf.layout.element.Div;
45
import com.itextpdf.layout.element.List;
46
import com.itextpdf.layout.element.ListItem;
47
import com.itextpdf.layout.element.Paragraph;
48
import com.itextpdf.layout.element.Text;
49

50

51
/**
52
 * Servlet implementation class ProfessorPdfServlet
53
 */
54
public class ProfessorPdfServlet extends HttpServlet {
55
	private static final long serialVersionUID = 1L;
56
	public static final Color RGB3 = new DeviceRgb(0x33, 0x33, 0x33);
57
	public static final Color RGB9 = new DeviceRgb(0x99, 0x99, 0x99);
58

59
	public static final float TITLE_FONT_SIZE = 12f;
60
	public static final float TEXT_FONT_SIZE = 10f;
61
	public static final float LINE_INTERVAL_L = 2.5f;
62
	public static final float LINE_INTERVAL_M = 2.15f;
63
	
64
	
65
	private DataSource dataSource;
66

67
	public ProfessorPdfServlet() {
68
		super();
69
	}
70

71
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
72
		String id = request.getParameter("id");
73
		boolean isDL = "1".equals(request.getParameter("_dl"));
74
		ViewBean vb = null;
75
		if (id != null && id.length() > 0) {
76
			try {
77
				vb = this.loadViewBean(id);
78
			} catch (SQLException e) {
79
				throw new ServletException(e);
80
			}
81
		}
82
		if (vb == null) {
83
			response.sendError(404);
84
			return;
85
		}
86
		byte[] obs = this.buildPdf(vb);
87
		response.setContentType("application/pdf");
88
		if (isDL) {
89
			String fn = URLEncoder.encode(vb.getName() + ".pdf", "UTF-8");
90
			response.addHeader("Content-Disposition", "attachment;filename=" + fn + ";filename*=utf-8\''" + fn);
91
		}
92
		response.setContentLength(obs.length);
93
		OutputStream out = response.getOutputStream();
94
		try {
95
			out.write(obs);
96
			out.flush();
97
		} finally {
98
			out.close();
99
		}
100

101
	}
102

103
	@Override
104
	public void init() throws ServletException {
105
		this.dataSource = JfwAppContext.getDataSource();
106

107
	}
108

109
	private byte[] buildPdf(ViewBean vb) throws IOException {
110
		ByteArrayOutputStream os = new ByteArrayOutputStream();
111
		PdfFont cnFont = null;
112
		PdfFont enFont = null;
113

114
		cnFont = PdfFontFactory.createFont("STSongStd-Light", "UniGB-UCS2-H", false);
115
		enFont = PdfFontFactory.createFont();
116

117
		Document doc = this.createDocument(os,cnFont,enFont);
118
		try {
119
			addName(doc, vb.getName(), vb.getTitle(),cnFont,enFont);
120
			addOrg(doc, vb.getOrgName(), vb.getDep(), vb.getOffice(),cnFont,enFont);
121
			addLinkData(doc,vb.getPhone(), vb.getEmail(), vb.getCity(), cnFont, enFont);
122
			addDescp(doc, vb.getDescp(),cnFont,enFont);
123
		
124
			addReseachArea(doc, vb.getReseachAreas(),cnFont,enFont);
125

126
			addProject(doc, vb.getProjects(),cnFont,enFont);
127

128
			addHonor(doc, vb.getHonors(),cnFont,enFont);
129

130
			addJob(doc, vb.getJobs(),cnFont,enFont);
131

132
			addEdu(doc, vb.getEds(),cnFont,enFont);
133

134
			addPatent(doc, vb.getPatents(),cnFont,enFont);
135
			addPaper(doc, vb.getPapers(),cnFont,enFont);
136
			doc.flush();
137

138
		} finally {
139
			doc.close();
140
		}
141

142
		os.flush();
143
		return os.toByteArray();
144
	}
145

146
	private void addName(Document doc, String name, String title,PdfFont cnFont,PdfFont enFont) {
147
		Paragraph pg = new Paragraph();
148
		addText(pg, name, 20f,cnFont,enFont);
149
		if (title != null && title.length() > 0) {
150
			addText(pg, " " + title, 12f,cnFont,enFont);
151
		}
152
		pg.setFontColor(RGB3);
153
		pg.setMargin(0f);
154
		pg.setMultipliedLeading(LINE_INTERVAL_L);
155
		doc.add(pg);
156
	}
157

158
	private void addOrg(Document doc, String org, String dep, String office,PdfFont cnFont,PdfFont enFont) {
159
		StringBuilder sb = new StringBuilder();
160
		sb.append(org);
161
		if (dep != null && dep.length() > 0) {
162
			sb.append(" , ").append(dep);
163
		}
164
		if (office != null && office.length() > 0) {
165
			sb.append(" · ").append(office);
166
		}
167
		Paragraph pg = new Paragraph();
168
		pg.setFontSize(TEXT_FONT_SIZE);
169
		pg.setFontColor(RGB3);
170
		pg.setMargin(0f);
171
		pg.setMultipliedLeading(LINE_INTERVAL_L);
172
		addText(pg, sb.toString(), null,cnFont,enFont);
173
		doc.add(pg);
174
	}
175
	private void addLinkData(Document doc,String phone,String email,String city,PdfFont cnFont,PdfFont enFont){
176
		StringBuilder sb = new StringBuilder();
177
		if(phone!=null && phone.trim().length()>0){
178
			sb.append(phone.trim());
179
		}
180
		if(email!=null && email.trim().length()>0){
181
			if(sb.length()>0){
182
				sb.append(" | ");
183
			}
184
			sb.append(email.trim());
185
		}
186
		if(city!=null && city.trim().length()>0){
187
			if(sb.length()>0){
188
				sb.append(" | ");
189
			}
190
			sb.append(city.trim());
191
		}
192
		if(sb.length()>0){
193
			Paragraph pg = new Paragraph();
194
			pg.setFontSize(TEXT_FONT_SIZE);
195
			pg.setFontColor(RGB9);
196
			pg.setMargin(0f);
197
			pg.setMultipliedLeading(LINE_INTERVAL_L);
198
			addText(pg, sb.toString(), null,cnFont,enFont);
199
			doc.add(pg);
200
		}
201
	}
202

203
	private void addTitle(Document doc, String title,PdfFont cnFont,PdfFont enFont) {
204
		Div div = new Div();
205
		div.setWidthPercent(100f);
206
		div.setBorderTop(new SolidBorder(RGB9, 1f));
207
		div.setHeight(1f);
208
		div.setMargins(10f, 0f, 10f, 0f);
209
		doc.add(div);
210
		Paragraph pg = createParagraph(TITLE_FONT_SIZE, RGB9);
211
		addText(pg, title, null,cnFont,enFont);
212
		doc.add(pg);
213
	}
214

215
	private void addDescp(Document doc, String descp,PdfFont cnFont,PdfFont enFont) {
216
		if (descp != null && descp.length() > 0) {
217
			addTitle(doc, "个人简介",cnFont,enFont);
218
			Paragraph pg = createParagraph(TEXT_FONT_SIZE, RGB3);
219
			addText(pg, descp, null,cnFont,enFont);
220
			doc.add(pg);
221
		}
222
	}
223

224
	private void addReseachArea(Document doc, java.util.List<String> ras,PdfFont cnFont,PdfFont enFont) {
225
		if (ras != null && ras.size() > 0) {
226
			addTitle(doc, "研究方向",cnFont,enFont);
227
			List list = new List().setSymbolIndent(10).setListSymbol("\u2022").setFont(enFont);
228
			for (String s : ras) {
229
				Paragraph pg = createParagraph(TEXT_FONT_SIZE, RGB3);
230
				addText(pg, s, null,cnFont,enFont);
231
				ListItem li = new ListItem();
232
				li.add(pg);
233
				list.add(li);
234
			}
235
			doc.add(list);
236
		}
237
	}
238

239
	private void addProject(Document doc, java.util.List<Project> projects,PdfFont cnFont,PdfFont enFont) {
240
		if (projects != null && projects.size() > 0) {
241
			addTitle(doc, "项目经历",cnFont,enFont);
242
			List list = new List().setSymbolIndent(10).setListSymbol("\u2022").setFont(enFont);
243
			for (Project p : projects) {
244
				ListItem li = new ListItem();
245
				Paragraph pg = createParagraph(TEXT_FONT_SIZE, RGB3);
246
				addText(pg, p.getName(), null,cnFont,enFont);
247
				li.add(pg);
248
				String bm = p.getStartMonth();
249
				String em = p.getStopMonth();
250
				if (bm != null) {
251
					StringBuilder sb = new StringBuilder();
252
					sb.append(bm.substring(0, 4)).append("年").append(bm.substring(4)).append("月").append(" – ");
253
					if (em != null) {
254
						sb.append(em.substring(0, 4)).append("年").append(em.substring(4)).append("月");
255
					} else {
256
						sb.append("至今");
257
					}
258
					pg = createParagraph(TEXT_FONT_SIZE, RGB9);
259
					addText(pg, sb.toString(), null,cnFont,enFont);
260
					li.add(pg);
261
				}
262
				String descp = p.getDescp();
263
				if (descp != null && descp.length() > 0) {
264
					pg = createParagraph(TEXT_FONT_SIZE, RGB9);
265
					addText(pg, descp, null,cnFont,enFont);
266
					li.add(pg);
267
				}
268
				list.add(li);
269
			}
270
			doc.add(list);
271
		}
272
	}
273

274
	private void addHonor(Document doc, java.util.List<Honor> honors,PdfFont cnFont,PdfFont enFont) {
275
		if (honors != null && honors.size() > 0) {
276
			addTitle(doc, "荣誉奖项",cnFont,enFont);
277
			List list = new List().setSymbolIndent(10).setListSymbol("\u2022").setFont(enFont);
278
			for (Honor h : honors) {
279
				ListItem li = new ListItem();
280
				Paragraph pg = createParagraph(TEXT_FONT_SIZE, RGB3);
281
				addText(pg, h.getName(), null,cnFont,enFont);
282
				li.add(pg);
283
				String year = h.getYear();
284
				if (year != null) {
285
					pg = createParagraph(TEXT_FONT_SIZE, RGB9);
286
					addText(pg, ("获得于" + year + "年 "), null,cnFont,enFont);
287
					li.add(pg);
288
				}
289
				String descp = h.getDescp();
290
				if (descp != null && descp.length() > 0) {
291
					pg = createParagraph(TEXT_FONT_SIZE, RGB9);
292
					addText(pg, descp, null,cnFont,enFont);
293
					li.add(pg);
294
				}
295
				list.add(li);
296
			}
297
			doc.add(list);
298
		}
299
	}
300

301
	private void addJob(Document doc, java.util.List<PartTimeJob> jobs,PdfFont cnFont,PdfFont enFont) {
302
		if (jobs != null && jobs.size() > 0) {
303
			addTitle(doc, "工作经历",cnFont,enFont);
304
			List list = new List().setSymbolIndent(10).setListSymbol("\u2022").setFont(enFont);
305
			for (PartTimeJob p : jobs) {
306
				StringBuilder sb = new StringBuilder();
307
				sb.append(p.getCompany());
308
				String dep = p.getDepartment();
309
				if (dep != null && dep.length() > 0) {
310
					sb.append(" , ").append(dep);
311
				}
312
				String office = p.getTitle();
313
				if (office != null && office.length() > 0) {
314
					sb.append(" · ").append(office);
315
				}
316

317
				ListItem li = new ListItem();
318
				Paragraph pg = createParagraph(TEXT_FONT_SIZE, RGB3);
319
				addText(pg, sb.toString(), null,cnFont,enFont);
320
				li.add(pg);
321

322
				String bm = p.getStartMonth();
323
				String em = p.getStopMonth();
324
				if (bm != null) {
325
					pg = createParagraph(TEXT_FONT_SIZE, RGB9);
326
					sb.delete(0, sb.length());
327
					sb.append(bm.substring(0, 4)).append("年").append(bm.substring(4)).append("月 – ");
328
					if (em != null) {
329
						sb.append(em.substring(0, 4)).append("年").append(em.substring(4)).append("月");
330
					} else {
331
						sb.append("至今");
332
					}
333
					addText(pg, sb.toString(), null,cnFont,enFont);
334
					li.add(pg);
335
				}
336
				list.add(li);
337
			}
338
			doc.add(list);
339
		}
340
	}
341

342
	private void addEdu(Document doc, java.util.List<ProfessorEduBg> edus,PdfFont cnFont,PdfFont enFont) {
343
		if (edus != null && edus.size() > 0) {
344
			addTitle(doc, "教育背景",cnFont,enFont);
345
			List list = new List().setSymbolIndent(10).setListSymbol("\u2022").setFont(enFont);
346
			for (ProfessorEduBg h : edus) {
347
				ListItem li = new ListItem();
348
				StringBuilder sb = new StringBuilder();
349
				sb.append(h.getSchool());
350
				String college = h.getCollege();
351
				if (college != null && college.length() > 0) {
352
					sb.append(" , ").append(college);
353
				}
354
				String major = h.getMajor();
355
				if (major != null && major.length() > 0) {
356
					sb.append(" , ").append(major);
357
				}
358
				String office = h.getDegree();
359
				if (office != null && office.length() > 0) {
360
					sb.append(" · ").append(office);
361
				}
362
				Paragraph pg = createParagraph(TEXT_FONT_SIZE, RGB3);
363
				addText(pg, sb.toString(), null,cnFont,enFont);
364
				li.add(pg);
365

366
				String year = h.getYear();
367
				if (year != null && year.length() == 0) {
368
					year = null;
369
				}
370
				pg = createParagraph(TEXT_FONT_SIZE, RGB9);
371
				addText(pg, (year == null ? "至今" : ("获得于" + year + "年 ")), null,cnFont,enFont);
372
				li.add(pg);
373
				list.add(li);
374
			}
375
			doc.add(list);
376
		}
377
	}
378

379
	private void addPatent(Document doc, java.util.List<Ppatent> pats,PdfFont cnFont,PdfFont enFont) {
380
		if (pats != null && pats.size() > 0) {
381
			addTitle(doc, "专利",cnFont,enFont);
382
			List list = new List().setSymbolIndent(10).setListSymbol("\u2022").setFont(enFont);
383
			for (Ppatent p : pats) {
384
				ListItem li = new ListItem();
385
				StringBuilder sb = new StringBuilder();
386
				sb.append(p.getAuthors().replaceAll(",", ";"));
387
				if (sb.charAt(sb.length() - 1) == ';') {
388
					sb.setCharAt(sb.length() - 1, '.');
389
				} else {
390
					sb.append('.');
391
				}
392
				sb.append(" ").append(p.getName()).append(" [P]. 中国专利: ").append(p.getCode()).append(", ").append(p.getPubDay().substring(0, 4)).append("-")
393
						.append(p.getPubDay().substring(4, 6)).append("-").append(p.getPubDay().substring(6)).append(".");
394
				Paragraph pg = createParagraph(TEXT_FONT_SIZE, RGB3);
395
				addText(pg, sb.toString(), null,cnFont,enFont);
396
				li.add(pg);
397
				list.add(li);
398
			}
399
			doc.add(list);
400
		}
401
	}
402

403
	private void addPaper(Document doc, java.util.List<Ppaper> paps,PdfFont cnFont,PdfFont enFont) {
404
		if (paps != null && paps.size() > 0) {
405
			addTitle(doc, "论文",cnFont,enFont);
406
			List list = new List().setSymbolIndent(10).setListSymbol("\u2022").setFont(enFont);
407
			for (Ppaper p : paps) {
408
				ListItem li = new ListItem();
409
				StringBuilder sb = new StringBuilder();
410
				sb.append(p.getName()).append(" [J]. ").append(p.getAuthors());
411
				if (sb.charAt(sb.length() - 1) == ',') {
412
					sb.delete(sb.length() - 1, sb.length());
413
				}
414
				String cn = p.getCn4periodical();
415
				String en = p.getEn4periodical();
416
				if (cn != null && cn.trim().length() > 0) {
417
					sb.append(". ").append(cn.trim());
418
				} else if (en != null && en.trim().length() > 0) {
419
					sb.append(". ").append(en.trim());
420
				}
421
				String pd = p.getPubDay();
422
				if (pd != null) {
423
					pd = pd.trim();
424
					if (pd.length() == 8) {
425
						sb.append(".").append(pd.substring(0, 4)).append("(").append(pd.substring(5, 7)).append(")");
426
					}
427
				}
428
				Paragraph pg = createParagraph(TEXT_FONT_SIZE, RGB3);
429
				addText(pg, sb.toString(), null,cnFont,enFont);
430
				li.add(pg);
431
				list.add(li);
432
			}
433
			doc.add(list);
434
		}
435

436
	}
437

438
	private Document createDocument(OutputStream out,PdfFont cnFont,PdfFont enFont) {
439
		PdfWriter writer = new PdfWriter(out);
440
		PdfDocument pdf = new PdfDocument(writer);
441
	   pdf.addEventHandler(PdfDocumentEvent.END_PAGE, new MyEventHandler(cnFont,enFont));
442
		Document doc = new Document(pdf, PageSize.A4);
443
		doc.setMargins(42.5f, 56.5f, 42.5f, 56.5f);
444
		return doc;
445
	}
446

447
	private Paragraph createParagraph(float fontSize, Color fontColor) {
448
		Paragraph pg = new Paragraph();
449
		pg.setFontSize(fontSize);
450
		pg.setFontColor(fontColor);
451
		pg.setMargin(0f);
452
		pg.setMultipliedLeading(LINE_INTERVAL_M);
453
		return pg;
454
	}
455

456
	private void addText(Paragraph p, String str, Float fontSize,PdfFont cnFont,PdfFont enFont) {
457
		int b = 0;
458
		char[] cs = str.toCharArray();
459
		PdfFont cur = cnFont;
460
		PdfFont oth = enFont;
461
		if (cs.length > 0) {
462
			for (int i = 0; i < cs.length; ++i) {
463
				char c = cs[i];
464
				if (c < 256) {
465
					if (cur == enFont) {
466
						continue;
467
					} else {
468
						if (i > b) {
469
							Text t = new Text(new String(cs, b, i - b)).setFont(cur);
470
							if (fontSize != null) {
471
								t.setFontSize(fontSize.floatValue());
472
							}
473
							p.add(t);
474
						}
475
						cur = enFont;
476
						oth = cnFont;
477
						b = i;
478
					}
479
				} else {
480
					if (!cur.containsGlyph(c)) {
481
						if (!oth.containsGlyph(c)) {
482
							cs[i] = ' ';
483
						} else {
484
							if (i > b) {
485
								Text t = new Text(new String(cs, b, i - b)).setFont(cur);
486
								if (fontSize != null) {
487
									t.setFontSize(fontSize.floatValue());
488
								}
489
								p.add(t);
490
							}
491
							b = i;
492
							if (cur == cnFont) {
493
								cur = enFont;
494
								oth = cnFont;
495
							} else {
496
								cur = cnFont;
497
								oth = enFont;
498
							}
499
						}
500
					}
501
				}
502
			}
503
			Text tt = new Text(new String(cs, b, cs.length - b)).setFont(cur);
504
			if (fontSize != null) {
505
				tt.setFontSize(fontSize.floatValue());
506
			}
507
			p.add(tt);
508
		}
509

510
	}
511

512
	private Connection getConnection() throws SQLException {
513
		 return this.dataSource.getConnection();
514
		//return DriverManager.getConnection("jdbc:postgresql://www.ekexiu.com:5432/ekexiu", "postgres", "postgres");
515
	}
516

517
	private ViewBean loadViewBean(final String id) throws SQLException {
518
		Connection con = this.getConnection();
519
		try {
520
			final ViewBean vb = JdbcUtil.query(con, "SELECT NAME,ORG_ID,TITLE,OFFICE,DEPARTMENT,DESCP,PHONE,EMAIL,ADDRESS FROM PROFESSOR WHERE ID=?",
521
					new ResultSetExtractor<ViewBean>() {
522

523
						@Override
524
						public ViewBean extractData(ResultSet rs) throws SQLException {
525
							if (!rs.next())
526
								return null;
527
							ViewBean v = new ViewBean();
528
							v.setName(rs.getString(1));
529
							v.setOrgId(rs.getString(2));
530
							v.setTitle(rs.getString(3));
531
							v.setOffice(rs.getString(4));
532
							v.setDep(rs.getString(5));
533
							v.setDescp(rs.getString(6));
534
							v.setPhone(rs.getString(7));
535
							v.setEmail(rs.getString(8));
536
							v.setCity(rs.getString(9));
537
							return v;
538
						}
539
					}, new PreparedStatementConfig() {
540

541
						@Override
542
						public void config(PreparedStatement ps) throws SQLException {
543
							ps.setString(1, id);
544

545
						}
546
					});
547
			if (vb == null) {
548
				return null;
549
			}
550
			JdbcUtil.query(con, "SELECT NAME FROM organization WHERE ID=?", new ResultSetExtractor<ViewBean>() {
551
				@Override
552
				public ViewBean extractData(ResultSet rs) throws SQLException {
553
					if (!rs.next())
554
						return null;
555
					vb.setOrgName(rs.getString(1));
556
					return vb;
557
				}
558
			}, new PreparedStatementConfig() {
559

560
				@Override
561
				public void config(PreparedStatement ps) throws SQLException {
562
					ps.setString(1, vb.getOrgId());
563

564
				}
565
			});
566
			vb.setReseachAreas(JdbcUtil.queryList(con, "SELECT CAPTION,SORT_NUM FROM research_area WHERE PROFESSOR_ID=? ORDER BY SORT_NUM DESC",
567
					new ResultSetExtractor<String>() {
568
						@Override
569
						public String extractData(ResultSet rs) throws SQLException {
570
							return rs.getString(1);
571
						}
572

573
					}, new PreparedStatementConfig() {
574
						@Override
575
						public void config(PreparedStatement ps) throws SQLException {
576
							ps.setString(1, id);
577
							;
578
						}
579
					}));
580
			vb.setProjects(
581
					JdbcUtil.queryList(con, "SELECT start_month,stop_month,name,descp FROM project WHERE PROFESSOR_ID=?", new ResultSetExtractor<Project>() {
582
						@Override
583
						public Project extractData(ResultSet rs) throws SQLException {
584
							Project p = new Project();
585
							p.setStartMonth(rs.getString(1));
586
							p.setStopMonth(rs.getString(2));
587
							p.setName(rs.getString(3));
588
							p.setDescp(rs.getString(4));
589
							return p;
590
						}
591

592
					}, new PreparedStatementConfig() {
593
						@Override
594
						public void config(PreparedStatement ps) throws SQLException {
595
							ps.setString(1, id);
596
							;
597
						}
598
					}));
599
			vb.setHonors(JdbcUtil.queryList(con, "SELECT year,name,descp FROM honor WHERE PROFESSOR_ID=?", new ResultSetExtractor<Honor>() {
600
				@Override
601
				public Honor extractData(ResultSet rs) throws SQLException {
602
					Honor p = new Honor();
603
					p.setYear(rs.getString(1));
604
					p.setName(rs.getString(2));
605
					p.setDescp(rs.getString(3));
606
					return p;
607
				}
608

609
			}, new PreparedStatementConfig() {
610
				@Override
611
				public void config(PreparedStatement ps) throws SQLException {
612
					ps.setString(1, id);
613
					;
614
				}
615
			}));
616
			vb.setJobs(JdbcUtil.queryList(con, "SELECT start_month,stop_month,company,title,department FROM part_time_job WHERE PROFESSOR_ID=?",
617
					new ResultSetExtractor<PartTimeJob>() {
618
						@Override
619
						public PartTimeJob extractData(ResultSet rs) throws SQLException {
620
							PartTimeJob p = new PartTimeJob();
621
							p.setStartMonth(rs.getString(1));
622
							p.setStopMonth(rs.getString(2));
623
							p.setCompany(rs.getString(3));
624
							p.setTitle(rs.getString(4));
625
							p.setDepartment(rs.getString(5));
626
							return p;
627
						}
628

629
					}, new PreparedStatementConfig() {
630
						@Override
631
						public void config(PreparedStatement ps) throws SQLException {
632
							ps.setString(1, id);
633
							;
634
						}
635
					}));
636

637
			vb.setEds(JdbcUtil.queryList(con, "SELECT 	year,school,college,major,degree FROM professor_edu_bg WHERE PROFESSOR_ID=?",
638
					new ResultSetExtractor<ProfessorEduBg>() {
639
						@Override
640
						public ProfessorEduBg extractData(ResultSet rs) throws SQLException {
641
							ProfessorEduBg p = new ProfessorEduBg();
642
							p.setYear(rs.getString(1));
643
							p.setSchool(rs.getString(2));
644
							p.setCollege(rs.getString(3));
645
							p.setMajor(rs.getString(4));
646
							p.setDegree(rs.getString(5));
647
							return p;
648
						}
649

650
					}, new PreparedStatementConfig() {
651
						@Override
652
						public void config(PreparedStatement ps) throws SQLException {
653
							ps.setString(1, id);
654
							;
655
						}
656
					}));
657
			vb.setPapers(JdbcUtil.queryList(con,
658
					"SELECT name,cn4periodical,en4periodical,pub_day,authors FROM ppaper WHERE ID IN (SELECT PAPER_ID FROM PAPER_AUTHOR WHERE PROFESSOR_ID=?)",
659
					new ResultSetExtractor<Ppaper>() {
660
						@Override
661
						public Ppaper extractData(ResultSet rs) throws SQLException {
662
							Ppaper p = new Ppaper();
663
							p.setName(rs.getString(1));
664
							p.setCn4periodical(rs.getString(2));
665
							p.setEn4periodical(rs.getString(3));
666
							p.setPubDay(rs.getString(4));
667
							p.setAuthors(rs.getString(5));
668
							return p;
669
						}
670

671
					}, new PreparedStatementConfig() {
672
						@Override
673
						public void config(PreparedStatement ps) throws SQLException {
674
							ps.setString(1, id);
675
							;
676
						}
677
					}));
678
			vb.setPatents(JdbcUtil.queryList(con,
679
					"SELECT name,code,pub_day,authors FROM ppatent WHERE ID IN (SELECT PATENT_ID FROM PATENT_AUTHOR WHERE PROFESSOR_ID=?)",
680
					new ResultSetExtractor<Ppatent>() {
681
						@Override
682
						public Ppatent extractData(ResultSet rs) throws SQLException {
683
							Ppatent p = new Ppatent();
684
							p.setName(rs.getString(1));
685
							p.setCode(rs.getString(2));
686
							p.setPubDay(rs.getString(3));
687
							p.setAuthors(rs.getString(4));
688
							return p;
689
						}
690

691
					}, new PreparedStatementConfig() {
692
						@Override
693
						public void config(PreparedStatement ps) throws SQLException {
694
							ps.setString(1, id);
695
							;
696
						}
697
					}));
698

699
			return vb;
700
		} finally {
701
			JdbcUtil.close(con);
702
		}
703
	}
704

705
	private static class ViewBean {
706
		private String name;
707
		private String orgId;
708
		private String orgName;
709
		private String title;
710
		private String dep;
711
		private String descp;
712
		private String office;
713
		private String phone;
714
		private String email;
715
		private String city;
716
		private java.util.List<String> reseachAreas;
717
		private java.util.List<Project> projects;
718
		private java.util.List<Honor> honors;
719
		private java.util.List<PartTimeJob> jobs;
720
		private java.util.List<ProfessorEduBg> eds;
721
		private java.util.List<Ppaper> papers;
722
		private java.util.List<Ppatent> patents;
723

724
		public String getPhone() {
725
			return phone;
726
		}
727

728
		public void setPhone(String phone) {
729
			this.phone = phone;
730
		}
731

732
		public String getEmail() {
733
			return email;
734
		}
735

736
		public void setEmail(String email) {
737
			this.email = email;
738
		}
739

740
		public String getCity() {
741
			return city;
742
		}
743

744
		public void setCity(String city) {
745
			this.city = city;
746
		}
747

748
		public String getName() {
749
			return name;
750
		}
751

752
		public void setName(String name) {
753
			this.name = name;
754
		}
755

756
		public String getDescp() {
757
			return descp;
758
		}
759

760
		public void setDescp(String descp) {
761
			this.descp = descp;
762
		}
763

764
		public String getOrgId() {
765
			return orgId;
766
		}
767

768
		public void setOrgId(String orgId) {
769
			this.orgId = orgId;
770
		}
771

772
		public String getOrgName() {
773
			return orgName;
774
		}
775

776
		public void setOrgName(String orgName) {
777
			this.orgName = orgName;
778
		}
779

780
		public String getTitle() {
781
			return title;
782
		}
783

784
		public void setTitle(String title) {
785
			this.title = title;
786
		}
787

788
		public String getDep() {
789
			return dep;
790
		}
791

792
		public void setDep(String dep) {
793
			this.dep = dep;
794
		}
795

796
		public String getOffice() {
797
			return office;
798
		}
799

800
		public void setOffice(String office) {
801
			this.office = office;
802
		}
803

804
		public java.util.List<String> getReseachAreas() {
805
			return reseachAreas;
806
		}
807

808
		public void setReseachAreas(java.util.List<String> reseachAreas) {
809
			this.reseachAreas = reseachAreas;
810
		}
811

812
		public java.util.List<Project> getProjects() {
813
			return projects;
814
		}
815

816
		public void setProjects(java.util.List<Project> projects) {
817
			this.projects = projects;
818
		}
819

820
		public java.util.List<Honor> getHonors() {
821
			return honors;
822
		}
823

824
		public void setHonors(java.util.List<Honor> honors) {
825
			this.honors = honors;
826
		}
827

828
		public java.util.List<PartTimeJob> getJobs() {
829
			return jobs;
830
		}
831

832
		public void setJobs(java.util.List<PartTimeJob> jobs) {
833
			this.jobs = jobs;
834
		}
835

836
		public java.util.List<ProfessorEduBg> getEds() {
837
			return eds;
838
		}
839

840
		public void setEds(java.util.List<ProfessorEduBg> eds) {
841
			this.eds = eds;
842
		}
843

844
		public java.util.List<Ppaper> getPapers() {
845
			return papers;
846
		}
847

848
		public void setPapers(java.util.List<Ppaper> papers) {
849
			this.papers = papers;
850
		}
851

852
		public java.util.List<Ppatent> getPatents() {
853
			return patents;
854
		}
855

856
		public void setPatents(java.util.List<Ppatent> patents) {
857
			this.patents = patents;
858
		}
859

860
	}
861
	 protected class MyEventHandler implements IEventHandler {
862
		 	private PdfFont cnFont;
863
		 	private PdfFont enFont;
864
		 	public MyEventHandler(PdfFont cnFont,PdfFont enFont) {
865
		 		this.cnFont = cnFont;
866
		 		this.enFont= enFont;
867
		 	}
868
	        public void handleEvent(Event event) {
869
	            PdfDocumentEvent docEvent = (PdfDocumentEvent) event;
870
	            PdfDocument pdfDoc = docEvent.getDocument();
871
	            PdfPage page = docEvent.getPage();
872
	            Rectangle pageSize = page.getPageSize();
873
	            PdfCanvas pdfCanvas = new PdfCanvas(page.newContentStreamBefore(), page.getResources(), pdfDoc);
874
	            pdfCanvas.beginText()
875
	                    .setFontAndSize(cnFont, 10).setColor(new DeviceRgb(0x99, 0x99, 0x99),true)
876
	                    .setTextMatrix(1, 0, 0.51256f, 1,pageSize.getWidth() / 2 - 72,pageSize.getBottom() + 20)
877
	                    .showText("简历来自科袖网 - www.ekexiu.com") .endText();
878
	            pdfCanvas.release();
879
	        }
880
	    }
881
}

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

@ -1985,6 +1985,15 @@ CREATE OR REPLACE VIEW  view_user_pictable AS
1985 1985
  GROUP BY dn.create_time, dn.cuser_id
1986 1986
  ORDER BY dn.create_time;;
1987 1987

1988
  
1989
  --- modify begin at version 1.9.2
1990
ALTER TABLE ARTICLE ADD COLUMN COL_NUM int4 not null default 0;
1991
COMMENT ON COLUMN article.col_num IS '栏目号  <=0:没有栏目号,1:个人自建 2:企业自发  其它:由业务定义';
1992
update article set col_num=1 where professor_id is not null;
1993
update article set col_num=2 where org_id is not null;
1994
ALTER TABLE organization ADD COLUMN col_mgr char(1) NOT NULL DEFAULT '0';
1995
COMMENT ON COLUMN organization.col_mgr IS '是否是管理者 0:不是  1:是';
1996

1988 1997

1989 1998

1990 1999


+ 35 - 26
src/main/webapp/WEB-INF/web.xml

@ -16,47 +16,52 @@
16 16
      <param-value>beanConfig.properties,${main.config}</param-value>
17 17
    </init-param>
18 18
    <init-param>
19
    	<param-name>afterBeanFactory</param-name>
20
    	<param-value>com.ekexiu.portal.job.SchJob,com.ekexiu.portal.job.TaskJob</param-value>
19
      <param-name>afterBeanFactory</param-name>
20
      <param-value>com.ekexiu.portal.job.SchJob,com.ekexiu.portal.job.TaskJob</param-value>
21 21
    </init-param>
22 22
    <load-on-startup>1</load-on-startup>
23 23
  </servlet>
24 24
  <servlet>
25
  	<servlet-name>cachedFileUploadServlet</servlet-name>
26
  	<servlet-class>org.jfw.web.servlet.fileupload.cached.CachedUploadServlet</servlet-class>
27
  	<load-on-startup>2</load-on-startup>
25
    <servlet-name>cachedFileUploadServlet</servlet-name>
26
    <servlet-class>org.jfw.web.servlet.fileupload.cached.CachedUploadServlet</servlet-class>
27
    <load-on-startup>2</load-on-startup>
28 28
  </servlet>
29 29
  <servlet>
30
  	<servlet-name>resFileUploadServlet</servlet-name>
31
  	<servlet-class>org.jfw.web.servlet.fileupload.cached.CachedUploadServlet</servlet-class>
32
  	<load-on-startup>3</load-on-startup>
30
    <servlet-name>resFileUploadServlet</servlet-name>
31
    <servlet-class>org.jfw.web.servlet.fileupload.cached.CachedUploadServlet</servlet-class>
32
    <load-on-startup>3</load-on-startup>
33 33
  </servlet>
34 34
  <servlet>
35
  	<servlet-name>serviceFileUploadServlet</servlet-name>
36
  	<servlet-class>org.jfw.web.servlet.fileupload.cached.CachedUploadServlet</servlet-class>
37
  	<load-on-startup>3</load-on-startup>
35
    <servlet-name>serviceFileUploadServlet</servlet-name>
36
    <servlet-class>org.jfw.web.servlet.fileupload.cached.CachedUploadServlet</servlet-class>
37
    <load-on-startup>3</load-on-startup>
38 38
  </servlet>
39 39
  <servlet>
40
  	<servlet-name>FileDownload</servlet-name>
41
  	<servlet-class>com.ekexiu.portal.util.FileDownload</servlet-class>
42
  	<!--设置FileDownloadServlet的初始化参数-->
43
	<init-param>
44
		<param-name>accessoryFolder</param-name>
45
		<param-value>${accessoryFolder}</param-value>
46
	</init-param>
47
  	<load-on-startup>4</load-on-startup>
40
    <servlet-name>FileDownload</servlet-name>
41
    <servlet-class>com.ekexiu.portal.util.FileDownload</servlet-class>
42
    <init-param>
43
      <param-name>accessoryFolder</param-name>
44
      <param-value>${accessoryFolder}</param-value>
45
    </init-param>
46
    <load-on-startup>4</load-on-startup>
48 47
  </servlet>
49 48
  <servlet>
50
  	<servlet-name>PictureVC</servlet-name>
51
  	<servlet-class>com.ekexiu.portal.util.PictureVC</servlet-class>
52
  	<load-on-startup>5</load-on-startup>
49
    <servlet-name>PictureVC</servlet-name>
50
    <servlet-class>com.ekexiu.portal.util.PictureVC</servlet-class>
51
    <load-on-startup>5</load-on-startup>
53 52
  </servlet>
54 53
  <servlet>
55
  	<servlet-name>CheckPictureVC</servlet-name>
56
  	<servlet-class>com.ekexiu.portal.util.CheckPictureVC</servlet-class>
57
  	<load-on-startup>6</load-on-startup>
54
    <servlet-name>CheckPictureVC</servlet-name>
55
    <servlet-class>com.ekexiu.portal.util.CheckPictureVC</servlet-class>
56
    <load-on-startup>6</load-on-startup>
57
  </servlet>
58
    <servlet>
59
    <description></description>
60
    <display-name>ProfessorPdfServlet</display-name>
61
    <servlet-name>ProfessorPdfServlet</servlet-name>
62
    <servlet-class>com.ekexiu.portal.util.ProfessorPdfServlet</servlet-class>
63
    <load-on-startup>7</load-on-startup>
58 64
  </servlet>
59
  
60 65
  <servlet-mapping>
61 66
    <servlet-name>ajax</servlet-name>
62 67
    <url-pattern>/ajax/*</url-pattern>
@ -85,4 +90,8 @@
85 90
    <servlet-name>CheckPictureVC</servlet-name>
86 91
    <url-pattern>/ajax/CheckPictureVC</url-pattern>
87 92
  </servlet-mapping>
93
  <servlet-mapping>
94
    <servlet-name>ProfessorPdfServlet</servlet-name>
95
    <url-pattern>/pdf/professor</url-pattern>
96
  </servlet-mapping>
88 97
</web-app>