Browse Source

Merge branch 'dev' of http://www.ekexiu.com:3000/jiapeng/portal-web.git
into dev

Conflicts:
src/main/java/com/ekexiu/portal/service/AuthImageService.java

jiapeng 8 years ago
parent
commit
5904e3c94f

+ 1 - 3
src/main/java/com/ekexiu/portal/dao/AuthApplyDao.java

@ -17,8 +17,6 @@ import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
17 17
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
18 18
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
19 19
import org.jfw.apt.orm.annotation.dao.param.Set;
20
import org.jfw.apt.orm.annotation.dao.param.SqlColumn;
21
import org.jfw.apt.orm.core.defaultImpl.IntHandler;
22 20

23 21
import com.ekexiu.portal.po.AuthApply;
24 22
import com.ekexiu.portal.pojo.AuthApplyInfo;
@ -49,7 +47,7 @@ public abstract class AuthApplyDao {
49 47
                    AuthApply _result = new AuthApply();
50 48
                    _result.setAuthApplyId(rs.getString(1));
51 49
                    _result.setProfessorId(rs.getString(2));
52
                    _result.setApplyType(rs.getString(3));
50
                    _result.setApplyType(rs.getInt(3));
53 51
                    _result.setSolveStatus(rs.getInt(4));
54 52
                    return _result;
55 53
                }else{

+ 4 - 4
src/main/java/com/ekexiu/portal/po/AuthApply.java

@ -13,7 +13,7 @@ import com.ekexiu.portal.basepo.CreateTimeSupported;
13 13
public class AuthApply implements CreateTimeSupported {
14 14
	private String authApplyId;
15 15
	private String professorId;
16
	private String applyType;
16
	private Integer applyType;
17 17
	private Integer solveStatus;
18 18
	private String createTime;
19 19
	
@ -33,11 +33,11 @@ public class AuthApply implements CreateTimeSupported {
33 33
		this.professorId = professorId;
34 34
	}
35 35
	
36
	@Column(DE.string_de)
37
	public String getApplyType() {
36
	@Column(handlerClass=WIntHandler.class,dbType="INT",insertable=true,nullable=false,renewable=false,queryable=true)
37
	public Integer getApplyType() {
38 38
		return applyType;
39 39
	}
40
	public void setApplyType(String applyType) {
40
	public void setApplyType(Integer applyType) {
41 41
		this.applyType = applyType;
42 42
	}
43 43
	

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

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

26 26
import com.ekexiu.portal.dao.ArticleDao;
27 27
import com.ekexiu.portal.dao.ProfessorDao;
28
import com.ekexiu.portal.dao.ResearchAreaDao;
28 29
import com.ekexiu.portal.dao.ResourceDao;
29 30
import com.ekexiu.portal.po.Article;
30 31
import com.ekexiu.portal.pojo.EditProfessor;
@ -42,6 +43,10 @@ public class ArticleService {
42 43
	private ProfessorDao professorDao;
43 44
	@Autowrie
44 45
	private ResourceDao resourceDao;
46
	@Autowrie
47
	private ImageService imageService;
48
	@Autowrie
49
	private ResearchAreaDao researchAreaDao;
45 50

46 51
	public String getDateFormat() {
47 52
		return dateFormat;
@ -99,6 +104,22 @@ public class ArticleService {
99 104
		this.resourceDao = resourceDao;
100 105
	}
101 106

107
	public ImageService getImageService() {
108
		return imageService;
109
	}
110

111
	public void setImageService(ImageService imageService) {
112
		this.imageService = imageService;
113
	}
114

115
	public ResearchAreaDao getResearchAreaDao() {
116
		return researchAreaDao;
117
	}
118

119
	public void setResearchAreaDao(ResearchAreaDao researchAreaDao) {
120
		this.researchAreaDao = researchAreaDao;
121
	}
122

102 123
	private byte[] resImage(byte[] src, int maxLen) throws IOException {
103 124
		ByteArrayInputStream in = new ByteArrayInputStream(src);
104 125
		ByteArrayOutputStream out = new ByteArrayOutputStream();
@ -179,6 +200,8 @@ public class ArticleService {
179 200
		if(article != null){
180 201
			EditProfessor professor = this.professorDao.queryBaseInfo(con, article.getProfessorId());
181 202
			if(professor != null){
203
				professor.setHasHeadImage(this.imageService.hasProfessorImage(professor.getId()));
204
				professor.setResearchAreas(this.researchAreaDao.query(con, professor.getId()));
182 205
				professor.setResources(this.resourceDao.queryPro(con, professor.getId()));
183 206
			}
184 207
			article.setProfessor(professor);

+ 24 - 2
src/main/java/com/ekexiu/portal/service/AuthImageService.java

@ -6,8 +6,8 @@ import java.io.FileOutputStream;
6 6
import java.io.IOException;
7 7
import java.io.InputStream;
8 8
import java.sql.Connection;
9
import java.sql.SQLException;
10
import java.util.List;
9
import java.sql.SQLException;
10
import java.util.List;
11 11
import java.text.SimpleDateFormat;
12 12
import java.util.Date;
13 13

@ -73,6 +73,28 @@ public class AuthImageService {
73 73
	public void setAuthApplyDao(AuthApplyDao authApplyDao) {
74 74
		this.authApplyDao = authApplyDao;
75 75
	}
76
	
77
	public String insertImg(@JdbcConn(true) Connection con, String authApplyId, String fn) throws SQLException, IOException{
78
		String authImageId = StringUtil.buildUUID();
79
		SimpleDateFormat df = new SimpleDateFormat(this.dateFormat);
80
		String date = df.format(new Date());
81
		File dateFile = new File(this.authImgPath + "/" + date);
82
		if (!dateFile.exists()) {
83
			dateFile.mkdir();
84
		}
85
		InputStream in = new FileInputStream(new File(this.tmpPath, fn));
86
		try {
87
			IoUtil.copy(in, new FileOutputStream(new File(dateFile, authImageId + ".jpg")), false, true);
88
		} finally {
89
			in.close();
90
		}
91
		AuthImage authImage = new AuthImage();
92
		authImage.setAuthImageId(authImageId);
93
		authImage.setAuthApplyId(authApplyId);
94
		authImage.setAuthSrc(date + "/" + authImageId + ".jpg");
95
		this.authImageDao.insert(con, authImage);
96
		return authImageId;
97
	}
76 98

77 99
	@Post
78 100
	@Path