Ver Código Fonte

我的工作台最新咨询。

zzy.zhiyuan.foxmail 8 anos atrás
pai
commit
9e878ad9ce

+ 99 - 45
src/main/java/com/ekexiu/portal/dao/ConsultDao.java

148
        }
148
        }
149
	}
149
	}
150
	
150
	
151
	/**
152
	 * 我的工作台最新咨询
153
	 * @param con
154
	 * @param professorId 专家ID
155
	 * @return 返回最新未读咨询
156
	 * @throws SQLException
157
	 */
158
	public Consult queryNewConsult(Connection con, String professorId) throws SQLException {
159
		int m1 = 1;
160
		String sql = " SELECT CONSULT_ID,CONSULT_TYPE,CONSULT_TITLE,CONSULT_CONTANT,CONSULT.CREATE_TIME,"
161
				+ " CONSULT.PROFESSOR_ID,CONSULTANT_ID,READ_STATUS,PROFESSOR.NAME,PROFESSOR.OFFICE,"
162
				+ " PROFESSOR.DEPARTMENT,PROFESSOR.TITLE,PROFESSOR.ADDRESS,ORGANIZATION.NAME "
163
				+ " FROM CONSULT LEFT JOIN PROFESSOR ON CONSULTANT_ID = PROFESSOR.ID "
164
				+ " LEFT JOIN ORGANIZATION ON PROFESSOR.ORG_ID = ORGANIZATION.ID "
165
				+ " WHERE CONSULT.CREATE_TIME "
166
				+ " IN (SELECT MAX(CREATE_TIME) FROM CONSULT WHERE READ_STATUS = 0 AND PROFESSOR_ID = ?) ";
167
		PreparedStatement ps = con.prepareStatement(sql);
168
		try{
169
			ps.setString(m1++, professorId);
170
			ResultSet rs = ps.executeQuery();
171
			try{
172
				if(rs.next()){
173
					Consult consult = new Consult();
174
					consult.setConsultId(rs.getString(1));
175
					consult.setConsultType(rs.getString(2));
176
					consult.setConsultTitle(rs.getString(3));
177
					consult.setConsultContant(rs.getString(4));
178
					consult.setCreateTime(rs.getString(5));
179
					consult.setProfessorId(rs.getString(6));
180
					EditProfessor professor = new EditProfessor();
181
					professor.setId(rs.getString(7));
182
					consult.setReadStatus(rs.getInt(8));
183
					professor.setName(rs.getString(9));
184
					professor.setOffice(rs.getString(10));
185
					professor.setDepartment(rs.getString(11));
186
					professor.setTitle(rs.getString(12));
187
					professor.setAddress(rs.getString(13));
188
					professor.setOrgName(rs.getString(14));
189
					consult.setProfessor(professor);
190
					return consult;
191
				}else{
192
					return null;
193
				}
194
			}finally{
195
                try{rs.close();}catch(Exception _m_7){}
196
            }
197
        }finally{
198
            try{ps.close();}catch(Exception _m_8){}
199
        }
200
	}
201
	
151
	public Consult queryPro(Connection con,String consultId) throws SQLException{
202
	public Consult queryPro(Connection con,String consultId) throws SQLException{
152
        int _m_1 = 1;
203
        int _m_1 = 1;
153
        String sql = "SELECT CONSULT_ID,CONSULT_TYPE,CONSULT_TITLE,CONSULT_CONTANT,PROFESSOR_ID,CONSULTANT_ID,CONSULT_STATUS,FINISH_TIME,ASSESS_STATUS,ASSESS_STAR,ASSESS_CONTANT,ASSESS_TIME,THANKS_STATUS,THANKS_MONEY,THANKS_TIME,REVOVERY_TIME,CONSULT.READ_STATUS,CONSULT.CREATE_TIME,PROFESSOR.NAME FROM CONSULT LEFT JOIN PROFESSOR ON CONSULT.CONSULTANT_ID = PROFESSOR.ID WHERE CONSULT_ID = ?";
204
        String sql = "SELECT CONSULT_ID,CONSULT_TYPE,CONSULT_TITLE,CONSULT_CONTANT,PROFESSOR_ID,CONSULTANT_ID,"
205
        		+ " CONSULT_STATUS,FINISH_TIME,ASSESS_STATUS,ASSESS_STAR,ASSESS_CONTANT,ASSESS_TIME,THANKS_STATUS,"
206
        		+ " THANKS_MONEY,THANKS_TIME,REVOVERY_TIME,CONSULT.READ_STATUS,CONSULT.CREATE_TIME,PROFESSOR.NAME "
207
        		+ " FROM CONSULT LEFT JOIN PROFESSOR ON CONSULT.CONSULTANT_ID = PROFESSOR.ID WHERE CONSULT_ID = ?";
154
        PreparedStatement ps = con.prepareStatement(sql);
208
        PreparedStatement ps = con.prepareStatement(sql);
155
        try{
209
        try{
156
            ps.setString(_m_1++,consultId);
210
            ps.setString(_m_1++,consultId);
213
	
267
	
214
	public Consult queryCon(Connection con,String consultId) throws SQLException{
268
	public Consult queryCon(Connection con,String consultId) throws SQLException{
215
        int _m_1 = 1;
269
        int _m_1 = 1;
216
        String sql = "SELECT CONSULT_ID,CONSULT_TYPE,CONSULT_TITLE,CONSULT_CONTANT,PROFESSOR_ID,CONSULTANT_ID,CONSULT_STATUS,FINISH_TIME,ASSESS_STATUS,ASSESS_STAR,ASSESS_CONTANT,ASSESS_TIME,THANKS_STATUS,THANKS_MONEY,THANKS_TIME,REVOVERY_TIME,CONSULT.READ_STATUS,CONSULT.CREATE_TIME,PROFESSOR.NAME FROM CONSULT LEFT JOIN PROFESSOR ON CONSULT.PROFESSOR_ID = PROFESSOR.ID WHERE CONSULT_ID = ?";
270
        String sql = "SELECT CONSULT_ID,CONSULT_TYPE,CONSULT_TITLE,CONSULT_CONTANT,PROFESSOR_ID,CONSULTANT_ID,"
271
        		+ " CONSULT_STATUS,FINISH_TIME,ASSESS_STATUS,ASSESS_STAR,ASSESS_CONTANT,ASSESS_TIME,THANKS_STATUS,"
272
        		+ " THANKS_MONEY,THANKS_TIME,REVOVERY_TIME,CONSULT.READ_STATUS,CONSULT.CREATE_TIME,PROFESSOR.NAME "
273
        		+ " FROM CONSULT LEFT JOIN PROFESSOR ON CONSULT.PROFESSOR_ID = PROFESSOR.ID WHERE CONSULT_ID = ?";
217
        PreparedStatement ps = con.prepareStatement(sql);
274
        PreparedStatement ps = con.prepareStatement(sql);
218
        try{
275
        try{
219
            ps.setString(_m_1++,consultId);
276
            ps.setString(_m_1++,consultId);
325
		if (1 == pageNo) {
382
		if (1 == pageNo) {
326
			queryResult.setPageNo(1);
383
			queryResult.setPageNo(1);
327
			sql = new StringBuilder();
384
			sql = new StringBuilder();
328
			sql.append(" SELECT CONSULT_ID,CONSULT_TYPE,CONSULT_TITLE,CONSULT_CONTANT,CONSULT.PROFESSOR_ID,CONSULTANT_ID,CONSULT_STATUS,FINISH_TIME,ASSESS_STATUS,ASSESS_STAR,ASSESS_CONTANT,ASSESS_TIME,THANKS_STATUS,THANKS_MONEY,THANKS_TIME,REVOVERY_TIME,CONSULT.READ_STATUS,CONSULT.CREATE_TIME,PROFESSOR.NAME,PROFESSOR.DEPARTMENT,PROFESSOR.TITLE,PROFESSOR.ADDRESS,ORGANIZATION.NAME FROM CONSULT LEFT JOIN PROFESSOR ON CONSULT.CONSULTANT_ID = PROFESSOR.ID LEFT JOIN ORGANIZATION ON PROFESSOR.ORG_ID = ORGANIZATION.ID ");
385
			sql.append(" SELECT CONSULT_ID,CONSULT_TYPE,CONSULT_TITLE,CONSULT_CONTANT,CONSULT.PROFESSOR_ID,"
386
					+ " CONSULTANT_ID,CONSULT_STATUS,FINISH_TIME,ASSESS_STATUS,ASSESS_STAR,ASSESS_CONTANT,ASSESS_TIME,"
387
					+ " THANKS_STATUS,THANKS_MONEY,THANKS_TIME,REVOVERY_TIME,CONSULT.READ_STATUS,CONSULT.CREATE_TIME,"
388
					+ " PROFESSOR.NAME,PROFESSOR.DEPARTMENT,PROFESSOR.TITLE,PROFESSOR.ADDRESS,PROFESSOR.OFFICE,ORGANIZATION.NAME "
389
					+ " FROM CONSULT LEFT JOIN PROFESSOR ON CONSULT.CONSULTANT_ID = PROFESSOR.ID "
390
					+ " LEFT JOIN ORGANIZATION ON PROFESSOR.ORG_ID = ORGANIZATION.ID ");
329
			if (whereSql.length() > 0) {
391
			if (whereSql.length() > 0) {
330
				sql.append(whereSql);
392
				sql.append(whereSql);
331
			}
393
			}
332
			if(0 == timeType) {
394
			if(0 == timeType) {
333
				sql.append(" ORDER BY CONSULT.CREATE_TIME ");
395
				sql.append(" ORDER BY CONSULT.CREATE_TIME ");
334
				if(0 == sortType) {
335
					sql.append(" DESC ");
336
				}
337
			}else if(1 == timeType) {
396
			}else if(1 == timeType) {
338
				sql.append(" ORDER BY REVOVERY_TIME ");
397
				sql.append(" ORDER BY REVOVERY_TIME ");
339
				if(0 == sortType) {
340
					sql.append(" DESC ");
341
				}
342
			}else if(2 == timeType) {
398
			}else if(2 == timeType) {
343
				sql.append(" ORDER BY FINISH_TIME ");
399
				sql.append(" ORDER BY FINISH_TIME ");
344
				if(0 == sortType) {
345
					sql.append(" DESC ");
346
				}
400
			}
401
			if(0 == sortType) {
402
				sql.append(" DESC ");
347
			}
403
			}
348
			sql.append(" LIMIT ").append(pageSize);
404
			sql.append(" LIMIT ").append(pageSize);
349
		} else {
405
		} else {
358
			--pageNo;
414
			--pageNo;
359
			int _m_10 = (pageNo * pageSize);
415
			int _m_10 = (pageNo * pageSize);
360
			sql = new StringBuilder();
416
			sql = new StringBuilder();
361
			sql.append(" SELECT CONSULT_ID,CONSULT_TYPE,CONSULT_TITLE,CONSULT_CONTANT,CONSULT.PROFESSOR_ID,CONSULTANT_ID,CONSULT_STATUS,FINISH_TIME,ASSESS_STATUS,ASSESS_STAR,ASSESS_CONTANT,ASSESS_TIME,THANKS_STATUS,THANKS_MONEY,THANKS_TIME,REVOVERY_TIME,CONSULT.READ_STATUS,CONSULT.CREATE_TIME,PROFESSOR.NAME,PROFESSOR.DEPARTMENT,PROFESSOR.TITLE,PROFESSOR.ADDRESS,ORGANIZATION.NAME FROM CONSULT LEFT JOIN PROFESSOR ON CONSULT.CONSULTANT_ID = PROFESSOR.ID LEFT JOIN ORGANIZATION ON PROFESSOR.ORG_ID = ORGANIZATION.ID ");
417
			sql.append(" SELECT CONSULT_ID,CONSULT_TYPE,CONSULT_TITLE,CONSULT_CONTANT,CONSULT.PROFESSOR_ID,"
418
					+ " CONSULTANT_ID,CONSULT_STATUS,FINISH_TIME,ASSESS_STATUS,ASSESS_STAR,ASSESS_CONTANT,ASSESS_TIME,"
419
					+ " THANKS_STATUS,THANKS_MONEY,THANKS_TIME,REVOVERY_TIME,CONSULT.READ_STATUS,CONSULT.CREATE_TIME,"
420
					+ " PROFESSOR.NAME,PROFESSOR.DEPARTMENT,PROFESSOR.TITLE,PROFESSOR.ADDRESS,PROFESSOR.OFFICE,ORGANIZATION.NAME "
421
					+ " FROM CONSULT LEFT JOIN PROFESSOR ON CONSULT.CONSULTANT_ID = PROFESSOR.ID "
422
					+ " LEFT JOIN ORGANIZATION ON PROFESSOR.ORG_ID = ORGANIZATION.ID ");
362
			if (whereSql.length() > 0) {
423
			if (whereSql.length() > 0) {
363
				sql.append(whereSql);
424
				sql.append(whereSql);
364
			}
425
			}
365
			if(0 == timeType) {
426
			if(0 == timeType) {
366
				sql.append(" ORDER BY CONSULT.CREATE_TIME ");
427
				sql.append(" ORDER BY CONSULT.CREATE_TIME ");
367
				if(0 == sortType) {
368
					sql.append(" DESC ");
369
				}
370
			}else if(1 == timeType) {
428
			}else if(1 == timeType) {
371
				sql.append(" ORDER BY REVOVERY_TIME ");
429
				sql.append(" ORDER BY REVOVERY_TIME ");
372
				if(0 == sortType) {
373
					sql.append(" DESC ");
374
				}
375
			}else if(2 == timeType) {
430
			}else if(2 == timeType) {
376
				sql.append(" ORDER BY FINISH_TIME ");
431
				sql.append(" ORDER BY FINISH_TIME ");
377
				if(0 == sortType) {
378
					sql.append(" DESC ");
379
				}
432
			}
433
			if(0 == sortType) {
434
				sql.append(" DESC ");
380
			}
435
			}
381
			sql.append(" LIMIT ").append(pageSize).append(" OFFSET ").append(_m_10);
436
			sql.append(" LIMIT ").append(pageSize).append(" OFFSET ").append(_m_10);
382
		}
437
		}
413
					consult.setAssessStatus(m3);
468
					consult.setAssessStatus(m3);
414
//					Integer m4 = rs.getInt(10);
469
//					Integer m4 = rs.getInt(10);
415
//					if (rs.wasNull()) {
470
//					if (rs.wasNull()) {
416
//						System.out.println("1");
417
//						m4 = null;
471
//						m4 = null;
418
//					}
472
//					}
419
//					consult.setAssessStar(m4);
473
//					consult.setAssessStar(m4);
454
						m10 = null;
508
						m10 = null;
455
					}
509
					}
456
					professor.setAddress(m10);
510
					professor.setAddress(m10);
457
					professor.setOrgName(rs.getString(23));
511
					professor.setOffice(rs.getString(23));
512
					professor.setOrgName(rs.getString(24));
458
					consult.setProfessor(professor);
513
					consult.setProfessor(professor);
459
					_m_11.add(consult);
514
					_m_11.add(consult);
460
				}
515
				}
523
		if (1 == pageNo) {
578
		if (1 == pageNo) {
524
			queryResult.setPageNo(1);
579
			queryResult.setPageNo(1);
525
			sql = new StringBuilder();
580
			sql = new StringBuilder();
526
			sql.append(" SELECT CONSULT_ID,CONSULT_TYPE,CONSULT_TITLE,CONSULT_CONTANT,CONSULT.PROFESSOR_ID,CONSULTANT_ID,CONSULT_STATUS,FINISH_TIME,ASSESS_STATUS,ASSESS_STAR,ASSESS_CONTANT,ASSESS_TIME,THANKS_STATUS,THANKS_MONEY,THANKS_TIME,REVOVERY_TIME,CONSULT.READ_STATUS,CONSULT.CREATE_TIME,PROFESSOR.NAME,PROFESSOR.DEPARTMENT,PROFESSOR.TITLE,PROFESSOR.ADDRESS,ORGANIZATION.NAME FROM CONSULT LEFT JOIN PROFESSOR ON CONSULT.PROFESSOR_ID = PROFESSOR.ID LEFT JOIN ORGANIZATION ON PROFESSOR.ORG_ID = ORGANIZATION.ID ");
581
			sql.append(" SELECT CONSULT_ID,CONSULT_TYPE,CONSULT_TITLE,CONSULT_CONTANT,CONSULT.PROFESSOR_ID,"
582
					+ " CONSULTANT_ID,CONSULT_STATUS,FINISH_TIME,ASSESS_STATUS,ASSESS_STAR,ASSESS_CONTANT,ASSESS_TIME,"
583
					+ " THANKS_STATUS,THANKS_MONEY,THANKS_TIME,REVOVERY_TIME,CONSULT.READ_STATUS,CONSULT.CREATE_TIME,"
584
					+ " PROFESSOR.NAME,PROFESSOR.DEPARTMENT,PROFESSOR.TITLE,PROFESSOR.ADDRESS,PROFESSOR.OFFICE,ORGANIZATION.NAME "
585
					+ " FROM CONSULT LEFT JOIN PROFESSOR ON CONSULT.PROFESSOR_ID = PROFESSOR.ID "
586
					+ " LEFT JOIN ORGANIZATION ON PROFESSOR.ORG_ID = ORGANIZATION.ID ");
527
			if (whereSql.length() > 0) {
587
			if (whereSql.length() > 0) {
528
				sql.append(whereSql);
588
				sql.append(whereSql);
529
			}
589
			}
530
			if(0 == timeType) {
590
			if(0 == timeType) {
531
				sql.append(" ORDER BY CONSULT.CREATE_TIME ");
591
				sql.append(" ORDER BY CONSULT.CREATE_TIME ");
532
				if(0 == sortType) {
533
					sql.append(" DESC ");
534
				}
535
			}else if(1 == timeType) {
592
			}else if(1 == timeType) {
536
				sql.append(" ORDER BY REVOVERY_TIME ");
593
				sql.append(" ORDER BY REVOVERY_TIME ");
537
				if(0 == sortType) {
538
					sql.append(" DESC ");
539
				}
540
			}else if(2 == timeType) {
594
			}else if(2 == timeType) {
541
				sql.append(" ORDER BY FINISH_TIME ");
595
				sql.append(" ORDER BY FINISH_TIME ");
542
				if(0 == sortType) {
543
					sql.append(" DESC ");
544
				}
596
			}
597
			if(0 == sortType) {
598
				sql.append(" DESC ");
545
			}
599
			}
546
			sql.append(" LIMIT ").append(pageSize);
600
			sql.append(" LIMIT ").append(pageSize);
547
		} else {
601
		} else {
556
			--pageNo;
610
			--pageNo;
557
			int _m_10 = (pageNo * pageSize);
611
			int _m_10 = (pageNo * pageSize);
558
			sql = new StringBuilder();
612
			sql = new StringBuilder();
559
			sql.append(" SELECT CONSULT_ID,CONSULT_TYPE,CONSULT_TITLE,CONSULT_CONTANT,CONSULT.PROFESSOR_ID,CONSULTANT_ID,CONSULT_STATUS,FINISH_TIME,ASSESS_STATUS,ASSESS_STAR,ASSESS_CONTANT,ASSESS_TIME,THANKS_STATUS,THANKS_MONEY,THANKS_TIME,REVOVERY_TIME,CONSULT.READ_STATUS,CONSULT.CREATE_TIME,PROFESSOR.NAME,PROFESSOR.DEPARTMENT,PROFESSOR.TITLE,PROFESSOR.ADDRESS,ORGANIZATION.NAME FROM CONSULT LEFT JOIN PROFESSOR ON CONSULT.PROFESSOR_ID = PROFESSOR.ID LEFT JOIN ORGANIZATION ON PROFESSOR.ORG_ID = ORGANIZATION.ID ");
613
			sql.append(" SELECT CONSULT_ID,CONSULT_TYPE,CONSULT_TITLE,CONSULT_CONTANT,CONSULT.PROFESSOR_ID,"
614
					+ " CONSULTANT_ID,CONSULT_STATUS,FINISH_TIME,ASSESS_STATUS,ASSESS_STAR,ASSESS_CONTANT,ASSESS_TIME,"
615
					+ " THANKS_STATUS,THANKS_MONEY,THANKS_TIME,REVOVERY_TIME,CONSULT.READ_STATUS,CONSULT.CREATE_TIME,"
616
					+ " PROFESSOR.NAME,PROFESSOR.DEPARTMENT,PROFESSOR.TITLE,PROFESSOR.ADDRESS,PROFESSOR.OFFICE,ORGANIZATION.NAME"
617
					+ " FROM CONSULT LEFT JOIN PROFESSOR ON CONSULT.PROFESSOR_ID = PROFESSOR.ID "
618
					+ " LEFT JOIN ORGANIZATION ON PROFESSOR.ORG_ID = ORGANIZATION.ID ");
560
			if (whereSql.length() > 0) {
619
			if (whereSql.length() > 0) {
561
				sql.append(whereSql);
620
				sql.append(whereSql);
562
			}
621
			}
563
			if(0 == timeType) {
622
			if(0 == timeType) {
564
				sql.append(" ORDER BY CONSULT.CREATE_TIME ");
623
				sql.append(" ORDER BY CONSULT.CREATE_TIME ");
565
				if(0 == sortType) {
566
					sql.append(" DESC ");
567
				}
568
			}else if(1 == timeType) {
624
			}else if(1 == timeType) {
569
				sql.append(" ORDER BY REVOVERY_TIME ");
625
				sql.append(" ORDER BY REVOVERY_TIME ");
570
				if(0 == sortType) {
571
					sql.append(" DESC ");
572
				}
573
			}else if(2 == timeType) {
626
			}else if(2 == timeType) {
574
				sql.append(" ORDER BY FINISH_TIME ");
627
				sql.append(" ORDER BY FINISH_TIME ");
575
				if(0 == sortType) {
576
					sql.append(" DESC ");
577
				}
628
			}
629
			if(0 == sortType) {
630
				sql.append(" DESC ");
578
			}
631
			}
579
			sql.append(" LIMIT ").append(pageSize).append(" OFFSET ").append(_m_10);
632
			sql.append(" LIMIT ").append(pageSize).append(" OFFSET ").append(_m_10);
580
		}
633
		}
646
						m10 = null;
699
						m10 = null;
647
					}
700
					}
648
					professor.setAddress(m10);
701
					professor.setAddress(m10);
649
					professor.setOrgName(rs.getString(23));
702
					professor.setOffice(rs.getString(23));
703
					professor.setOrgName(rs.getString(24));
650
					consult.setProfessor(professor);
704
					consult.setProfessor(professor);
651
					_m_11.add(consult);
705
					_m_11.add(consult);
652
				}
706
				}

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

87
		return this.consultDao.queryReceiveConsult(con, professorId);
87
		return this.consultDao.queryReceiveConsult(con, professorId);
88
	}
88
	}
89
	
89
	
90
	@Get
91
	@Path("/qaNewConsult")
92
	public Consult queryNewConsult(@JdbcConn Connection con, String professorId) throws SQLException {
93
		return this.consultDao.queryNewConsult(con, professorId);
94
	}
95
	
90
	@Get
96
	@Get
91
	@Path("/qapro")
97
	@Path("/qapro")
92
	public Consult queryPro(@JdbcConn Connection con, String consultId) throws SQLException {
98
	public Consult queryPro(@JdbcConn Connection con, String consultId) throws SQLException {