Browse Source

专家认证信息返回字段添加认证中的状态。

zzy.zhiyuan.foxmail 8 years ago
parent
commit
676f53f94e

+ 29 - 0
src/main/java/com/ekexiu/portal/dao/AuthApplyDao.java

@ -1,6 +1,8 @@
1 1
package com.ekexiu.portal.dao;
2 2

3 3
import java.sql.Connection;
4
import java.sql.PreparedStatement;
5
import java.sql.ResultSet;
4 6
import java.sql.SQLException;
5 7
import java.util.List;
6 8

@ -28,6 +30,33 @@ public abstract class AuthApplyDao {
28 30
	@SelectOne
29 31
	public abstract AuthApply queryOne(Connection con, String authApplyId) throws SQLException;
30 32
	
33
	public AuthApply queryPro(Connection con, String professorId) throws SQLException{
34
		int _m_1 = 1;
35
        String sql = "SELECT AUTH_APPLY_ID,PROFESSOR_ID,APPLY_TYPE,SOLVE_STATUS FROM AUTH_APPLY "
36
        		+ " WHERE PROFESSOR_ID = ? AND SOLVE_STATUS = 1 ORDER BY CREATE_TIME DESC LIMIT 1";
37
        PreparedStatement ps = con.prepareStatement(sql);
38
        try{
39
            ps.setString(_m_1++,professorId);
40
            ResultSet rs = ps.executeQuery();
41
            try{
42
                if(rs.next()){
43
                    AuthApply _result = new AuthApply();
44
                    _result.setAuthApplyId(rs.getString(1));
45
                    _result.setProfessorId(rs.getString(2));
46
                    _result.setApplyType(rs.getString(3));
47
                    _result.setSolveStatus(rs.getInt(4));
48
                    return _result;
49
                }else{
50
                    return null;
51
                }
52
            }finally{
53
                try{rs.close();}catch(Exception e1){}
54
            }
55
        }finally{
56
            try{ps.close();}catch(Exception e2){}
57
        }
58
	}
59
	
31 60
	@SelectList
32 61
	public abstract List<AuthApply> query(Connection con) throws SQLException;
33 62
}

+ 11 - 0
src/main/java/com/ekexiu/portal/service/AuthApplyService.java

@ -10,6 +10,7 @@ import org.jfw.apt.web.annotation.param.JdbcConn;
10 10
import org.jfw.util.StringUtil;
11 11

12 12
import com.ekexiu.portal.dao.AuthApplyDao;
13
import com.ekexiu.portal.dao.ProfessorDao;
13 14
import com.ekexiu.portal.po.AuthApply;
14 15

15 16
@Path("/authApply")
@ -18,6 +19,8 @@ public class AuthApplyService {
18 19
	private AuthApplyDao authApplyDao;
19 20
	@Autowrie
20 21
	private AuthImageService authImageService;
22
	@Autowrie
23
	private ProfessorDao professorDao;
21 24

22 25
	public AuthApplyDao getAuthApplyDao() {
23 26
		return authApplyDao;
@ -35,6 +38,14 @@ public class AuthApplyService {
35 38
		this.authImageService = authImageService;
36 39
	}
37 40

41
	public ProfessorDao getProfessorDao() {
42
		return professorDao;
43
	}
44

45
	public void setProfessorDao(ProfessorDao professorDao) {
46
		this.professorDao = professorDao;
47
	}
48

38 49
	@Post
39 50
	@Path
40 51
	public String insert(@JdbcConn(true) Connection con, AuthApply authApply) throws SQLException{

+ 18 - 1
src/main/java/com/ekexiu/portal/service/ProfessorService.java

@ -21,6 +21,7 @@ import org.jfw.apt.web.annotation.param.RequestBody;
21 21
import org.jfw.util.PageQueryResult;
22 22
import org.jfw.util.StringUtil;
23 23

24
import com.ekexiu.portal.dao.AuthApplyDao;
24 25
import com.ekexiu.portal.dao.HonorDao;
25 26
import com.ekexiu.portal.dao.OrgDao;
26 27
import com.ekexiu.portal.dao.PaperDao;
@ -34,6 +35,7 @@ import com.ekexiu.portal.dao.ResearchAreaLogDao;
34 35
import com.ekexiu.portal.dao.ResourceDao;
35 36
import com.ekexiu.portal.dao.UserDao;
36 37
import com.ekexiu.portal.dao.WatchDao;
38
import com.ekexiu.portal.po.AuthApply;
37 39
import com.ekexiu.portal.po.Professor;
38 40
import com.ekexiu.portal.po.User;
39 41
import com.ekexiu.portal.pojo.EditProfessor;
@ -43,6 +45,8 @@ import com.ekexiu.portal.util.Calculate;
43 45

44 46
@Path("/professor")
45 47
public class ProfessorService {
48
	@Autowrie
49
	private AuthApplyDao authApplyDao;
46 50
	@Autowrie
47 51
	private UserDao userDao;
48 52
	@Autowrie
@ -77,6 +81,14 @@ public class ProfessorService {
77 81
	private ProjectDao projectDao;
78 82

79 83
	
84
	public AuthApplyDao getAuthApplyDao() {
85
		return authApplyDao;
86
	}
87

88
	public void setAuthApplyDao(AuthApplyDao authApplyDao) {
89
		this.authApplyDao = authApplyDao;
90
	}
91

80 92
	public UserDao getUserDao() {
81 93
		return userDao;
82 94
	}
@ -246,7 +258,12 @@ public class ProfessorService {
246 258
	@Get
247 259
	@Path("/auth")
248 260
	public Professor queryAuth(@JdbcConn Connection con, String id) throws SQLException{
249
		return this.professorDao.queryAuth(con, id);
261
		Professor professor =  this.professorDao.queryAuth(con, id);
262
		AuthApply apply = this.authApplyDao.queryPro(con, id);
263
		if(apply != null) {
264
			professor.setAuthStatus(2);
265
		}
266
		return professor;
250 267
	}
251 268
	
252 269
	@Get