Browse Source

更新咨询和咨询消息查看状态的接口,修改资源发布和更新对应用行业和学术领域的操作。

zzy.zhiyuan.foxmail 8 years ago
parent
commit
7544fd3e7a

+ 32 - 10
src/main/java/com/ekexiu/portal/dao/ConsultDao.java

@ -24,6 +24,18 @@ public abstract class ConsultDao {
24 24
	@Insert
25 25
	public abstract int insert(Connection con, Consult consult) throws SQLException;
26 26
	
27
	public int updateReadStatus(Connection con,String consultId) throws SQLException{
28
        int _m_1 = 1;
29
        String sql ="UPDATE CONSULT SET READ_STATUS = 1 WHERE CONSULT_ID = ? ";
30
        PreparedStatement ps = con.prepareStatement(sql);
31
        try{
32
            ps.setString(_m_1++,consultId);
33
            return ps.executeUpdate();
34
        }finally{
35
            try{ps.close();}catch(Exception _m_2){}
36
        }
37
    }
38
	
27 39
	public int updateFinishTime(Connection con,String consultId,int consultStatus) throws SQLException{
28 40
        int _m_2 = 1;
29 41
        String sql ="UPDATE CONSULT SET FINISH_TIME= TO_CHAR(NOW(),'YYYYMMDDHH24MISS'),CONSULT_STATUS= ? WHERE CONSULT_ID = ?";
@ -100,13 +112,18 @@ public abstract class ConsultDao {
100 112
	 * @throws SQLException
101 113
	 */
102 114
	public int queryReadStatus(Connection con, String professorId) throws SQLException {
115
		int _m_2 = 1;
103 116
		String sql = " SELECT COUNT(1) FROM CONSULT WHERE READ_STATUS = 0 AND PROFESSOR_ID = ? ";
104 117
		PreparedStatement ps = con.prepareStatement(sql);
105
		ps.setString(1, professorId);
106
		ResultSet rs = ps.executeQuery();
107
		rs.next();
108
		int count = rs.getInt(1);
109
		return count;
118
		try {
119
			ps.setString(_m_2++, professorId);
120
			ResultSet rs = ps.executeQuery();
121
			rs.next();
122
			int count = rs.getInt(1);
123
			return count;
124
		} finally{
125
            try{ps.close();}catch(Exception _m_3){}
126
        }
110 127
	}
111 128
	
112 129
	/**
@ -117,13 +134,18 @@ public abstract class ConsultDao {
117 134
	 * @throws SQLException
118 135
	 */
119 136
	public int queryReceiveConsult(Connection con, String professorId) throws SQLException {
137
		int _m_2 = 1;
120 138
		String sql = " SELECT COUNT(1) FROM CONSULT WHERE PROFESSOR_ID = ? ";
121 139
		PreparedStatement ps = con.prepareStatement(sql);
122
		ps.setString(1, professorId);
123
		ResultSet rs = ps.executeQuery();
124
		rs.next();
125
		int count = rs.getInt(1);
126
		return count;
140
		try {
141
			ps.setString(_m_2++, professorId);
142
			ResultSet rs = ps.executeQuery();
143
			rs.next();
144
			int count = rs.getInt(1);
145
			return count;
146
		} finally{
147
            try{ps.close();}catch(Exception _m_3){}
148
        }
127 149
	}
128 150
	
129 151
	public Consult queryPro(Connection con,String consultId) throws SQLException{

+ 13 - 0
src/main/java/com/ekexiu/portal/dao/TidingsDao.java

@ -16,6 +16,19 @@ public abstract class TidingsDao {
16 16
	@Insert
17 17
	public abstract int insert(Connection con, Tidings tidings) throws SQLException;
18 18
	
19
	public int updateReadStatus(Connection con,String senderId,String consultId) throws SQLException{
20
        int _m_1 = 1;
21
        String sql ="UPDATE TIDINGS SET READ_STATUS = 1 WHERE READ_STATUS = 0 AND CONSULT_ID = ? AND SENDER_ID != ? ";
22
        PreparedStatement ps = con.prepareStatement(sql);
23
        try{
24
            ps.setString(_m_1++,consultId);
25
            ps.setString(_m_1++,senderId);
26
            return ps.executeUpdate();
27
        }finally{
28
            try{ps.close();}catch(Exception _m_2){}
29
        }
30
    }
31
	
19 32
	/**
20 33
	 * 查询未查看信息条数的接口 
21 34
	 * @param con

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

@ -68,7 +68,7 @@ public class Resource implements CreateTimeSupported, ModifyTimeSupported{
68 68
		this.resourceName = resourceName;
69 69
	}
70 70
	
71
	@Column(handlerClass=StringHandler.class,dbType="TEXT",insertable=true,nullable=true,renewable=false,queryable=true)
71
	@Column(handlerClass=StringHandler.class,dbType="TEXT",insertable=true,nullable=true,renewable=true,queryable=true)
72 72
	public String getSubject() {
73 73
		return subject;
74 74
	}
@ -76,7 +76,7 @@ public class Resource implements CreateTimeSupported, ModifyTimeSupported{
76 76
		this.subject = subject;
77 77
	}
78 78
	
79
	@Column(handlerClass=StringHandler.class,dbType="TEXT",insertable=true,nullable=true,renewable=false,queryable=true)
79
	@Column(handlerClass=StringHandler.class,dbType="TEXT",insertable=true,nullable=true,renewable=true,queryable=true)
80 80
	public String getIndustry() {
81 81
		return industry;
82 82
	}

+ 6 - 0
src/main/java/com/ekexiu/portal/service/ConsultService.java

@ -36,6 +36,12 @@ public class ConsultService {
36 36
		return consultId;
37 37
	}
38 38
	
39
	@Post
40
	@Path("/readStatus")
41
	public void updateReadStatus(@JdbcConn(true) Connection con, String consultId) throws SQLException {
42
		this.consultDao.updateReadStatus(con, consultId);
43
	}
44
	
39 45
	@Post
40 46
	@Path("/finishTime")
41 47
	public boolean updateFinishTime(@JdbcConn(true) Connection con, String consultId, int consultStatus) throws SQLException {

+ 1 - 0
src/main/java/com/ekexiu/portal/service/TidingsService.java

@ -42,6 +42,7 @@ public class TidingsService {
42 42
		String tidingsId = StringUtil.buildUUID();
43 43
		tidings.setTidingsId(tidingsId);
44 44
		this.tidingsDao.insert(con, tidings);
45
		this.tidingsDao.updateReadStatus(con, tidings.getSenderId(), tidings.getConsultId());
45 46
		String consultId = tidings.getConsultId();
46 47
		this.consultDao.updateRevoveryTime(con, consultId);
47 48
		return tidingsId;