Browse Source

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

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

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

24
	@Insert
24
	@Insert
25
	public abstract int insert(Connection con, Consult consult) throws SQLException;
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
	public int updateFinishTime(Connection con,String consultId,int consultStatus) throws SQLException{
39
	public int updateFinishTime(Connection con,String consultId,int consultStatus) throws SQLException{
28
        int _m_2 = 1;
40
        int _m_2 = 1;
29
        String sql ="UPDATE CONSULT SET FINISH_TIME= TO_CHAR(NOW(),'YYYYMMDDHH24MISS'),CONSULT_STATUS= ? WHERE CONSULT_ID = ?";
41
        String sql ="UPDATE CONSULT SET FINISH_TIME= TO_CHAR(NOW(),'YYYYMMDDHH24MISS'),CONSULT_STATUS= ? WHERE CONSULT_ID = ?";
100
	 * @throws SQLException
112
	 * @throws SQLException
101
	 */
113
	 */
102
	public int queryReadStatus(Connection con, String professorId) throws SQLException {
114
	public int queryReadStatus(Connection con, String professorId) throws SQLException {
115
		int _m_2 = 1;
103
		String sql = " SELECT COUNT(1) FROM CONSULT WHERE READ_STATUS = 0 AND PROFESSOR_ID = ? ";
116
		String sql = " SELECT COUNT(1) FROM CONSULT WHERE READ_STATUS = 0 AND PROFESSOR_ID = ? ";
104
		PreparedStatement ps = con.prepareStatement(sql);
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
	 * @throws SQLException
134
	 * @throws SQLException
118
	 */
135
	 */
119
	public int queryReceiveConsult(Connection con, String professorId) throws SQLException {
136
	public int queryReceiveConsult(Connection con, String professorId) throws SQLException {
137
		int _m_2 = 1;
120
		String sql = " SELECT COUNT(1) FROM CONSULT WHERE PROFESSOR_ID = ? ";
138
		String sql = " SELECT COUNT(1) FROM CONSULT WHERE PROFESSOR_ID = ? ";
121
		PreparedStatement ps = con.prepareStatement(sql);
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
	public Consult queryPro(Connection con,String consultId) throws SQLException{
151
	public Consult queryPro(Connection con,String consultId) throws SQLException{

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

16
	@Insert
16
	@Insert
17
	public abstract int insert(Connection con, Tidings tidings) throws SQLException;
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
	 * @param con
34
	 * @param con

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

68
		this.resourceName = resourceName;
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
	public String getSubject() {
72
	public String getSubject() {
73
		return subject;
73
		return subject;
74
	}
74
	}
76
		this.subject = subject;
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
	public String getIndustry() {
80
	public String getIndustry() {
81
		return industry;
81
		return industry;
82
	}
82
	}

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

36
		return consultId;
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
	@Post
45
	@Post
40
	@Path("/finishTime")
46
	@Path("/finishTime")
41
	public boolean updateFinishTime(@JdbcConn(true) Connection con, String consultId, int consultStatus) throws SQLException {
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
		String tidingsId = StringUtil.buildUUID();
42
		String tidingsId = StringUtil.buildUUID();
43
		tidings.setTidingsId(tidingsId);
43
		tidings.setTidingsId(tidingsId);
44
		this.tidingsDao.insert(con, tidings);
44
		this.tidingsDao.insert(con, tidings);
45
		this.tidingsDao.updateReadStatus(con, tidings.getSenderId(), tidings.getConsultId());
45
		String consultId = tidings.getConsultId();
46
		String consultId = tidings.getConsultId();
46
		this.consultDao.updateRevoveryTime(con, consultId);
47
		this.consultDao.updateRevoveryTime(con, consultId);
47
		return tidingsId;
48
		return tidingsId;