jiapeng 6 years ago
parent
commit
b7186fbbf8

+ 12 - 0
src/main/java/com/ekexiu/portal/dao/DemandDao.java

@ -114,6 +114,18 @@ public abstract class DemandDao {
114 114
	
115 115

116 116
	
117
	@PageSelect
118
	@OrderBy(" ORDER BY CREATE_TIME DESC")
119
	public abstract PageQueryResult<Demand> pageQueryOrderByCreateTimeDesc(Connection con,@Nullable String state, @Nullable String source,@Nullable String  cost, @Nullable String duration, 
120
			@GroupSqlColumn(value={"TITLE LIKE ?","DESCP LIKE ?","ORG_NAME LIKE ?","CREATOR IN (SELECT ID FROM PROFESSOR WHERE NAME LIKE ?)"},handlerClass=StringHandler.class,isAnd=false ,force =false)  @Nullable String key,int pageSize,int pageNo) throws SQLException;
121
	
122
	@PageSelect
123
	@OrderBy(" ORDER BY INVALID_DAY ASC")
124
	public abstract PageQueryResult<Demand> pageQueryOrderByInvalidDayAsc(Connection con,@Nullable String state, @Nullable String source,@Nullable String  cost, @Nullable String duration, 
125
			@GroupSqlColumn(value={"TITLE LIKE ?","DESCP LIKE ?","ORG_NAME LIKE ?","CREATOR IN (SELECT ID FROM PROFESSOR WHERE NAME LIKE ?)"},handlerClass=StringHandler.class,isAnd=false ,force =false)  @Nullable String key,int pageSize,int pageNo) throws SQLException;
126
	
127
    
128
	
117 129
	
118 130
	
119 131
//	

+ 8 - 0
src/main/java/com/ekexiu/portal/platform/PlatformDao.java

@ -146,6 +146,14 @@ public interface PlatformDao {
146 146
			@SqlColumn(handlerClass = StringHandler.class, value = { "R.PID=?" }) String pid,
147 147
			@Nullable @GroupSqlColumn(handlerClass = StringHandler.class, isAnd = false, value = { "O.NAME LIKE ?", "O.FOR_SHORT LIKE ?" }) String key,
148 148
			int rows) throws SQLException;
149
	
150
	
151
	@PageQuery
152
	@OrderBy(value = "ORDER BY R.CREATE_TIME DESC")
153
	@Exclude({ "descp" })
154
	PageQueryResult<ResidentOrgInfo> pqResientOrgInfo(Connection con,@SqlColumn(handlerClass = StringHandler.class, value = { "R.PID=?" }) String pid,
155
			@Nullable @GroupSqlColumn(handlerClass = StringHandler.class, isAnd = false, value = { "O.NAME LIKE ?", "O.FOR_SHORT LIKE ?" }) String key,
156
			int pageSize,int pageNo) throws SQLException;
149 157

150 158
	@LimitQuery
151 159
	@OrderBy(cols = { @LimitColumn(value = "time", column = "B.CREATE_TIME", handlerClass = StringHandler.class, asc = false),

+ 24 - 12
src/main/java/com/ekexiu/portal/platform/PlatformService.java

@ -109,8 +109,6 @@ public class PlatformService {
109 109
	public void setMailService(MailService mailService) {
110 110
		this.mailService = mailService;
111 111
	}
112
	
113
	
114 112

115 113
	public String getUrlWithRestPasswordWithEmail() {
116 114
		return urlWithRestPasswordWithEmail;
@ -177,7 +175,8 @@ public class PlatformService {
177 175
	}
178 176

179 177
	@SetCookie(checkResultNull = true, path = "/", value = { "plf_user=result.getId()", "plf_email=result.getEmail()",
180
			"plf_logo=result.getLogo()==null?\"\":result.getLogo()" , "plf_name=result.getName()==null?\"\":java.net.URLEncoder.encode(result.getName(),\"utf-8\")"})
178
			"plf_logo=result.getLogo()==null?\"\":result.getLogo()",
179
			"plf_name=result.getName()==null?\"\":java.net.URLEncoder.encode(result.getName(),\"utf-8\")" })
181 180
	@Post
182 181
	@Path("/login")
183 182
	public LoginUserInfo login(@JdbcConn Connection con, String email, String pw) throws JfwBaseException, SQLException {
@ -209,7 +208,7 @@ public class PlatformService {
209 208

210 209
	@Path("/reqResetPw")
211 210
	@Post
212
	public void requestResetPasswordWithEmail(@JdbcConn Connection con, String mail,String url) throws SQLException, JfwBaseException {
211
	public void requestResetPasswordWithEmail(@JdbcConn Connection con, String mail, String url) throws SQLException, JfwBaseException {
213 212
		PlatformUser pu = this.platformDao.queryUser(con, mail);
214 213
		if (pu == null)
215 214
			throw new JfwBaseException(-600001, "not found user");
@ -289,16 +288,16 @@ public class PlatformService {
289 288

290 289
	@Post
291 290
	@Path("/bindMail")
292
	public void bindMail(@JdbcConn(true) Connection con, String code,String pw) throws SQLException, JfwBaseException {
291
	public void bindMail(@JdbcConn(true) Connection con, String code, String pw) throws SQLException, JfwBaseException {
293 292
		@SuppressWarnings("unchecked")
294 293
		StateCode<String, String> sc = (StateCode<String, String>) JfwAppContext.getCachedObject(code);
295 294
		if (sc == null) {
296 295
			throw new JfwBaseException(-600001, " code expire");
297 296
		}
298 297
		JfwAppContext.removeCachedObject(code);
299
		
300
		if(!StringUtil.md5(pw).equals(sc.getValue())){
301
			throw new JfwBaseException(-600003, "invalid passwd"); 
298

299
		if (!StringUtil.md5(pw).equals(sc.getValue())) {
300
			throw new JfwBaseException(-600003, "invalid passwd");
302 301
		}
303 302

304 303
		if (this.platformDao.updateMail(con, sc.getCode(), sc.getKey(), sc.getValue(), sc.getDescp()) == 0) {
@ -324,7 +323,6 @@ public class PlatformService {
324 323
		return this.platformDao.queryInfo(con, id);
325 324
	}
326 325

327

328 326
	@Post
329 327
	@Path("/resident")
330 328
	public int resident(@JdbcConn(true) Connection con, @RequestParam(fields = { @FieldParam(value = "pid", valueClass = String.class),
@ -393,6 +391,17 @@ public class PlatformService {
393 391
		return ret;
394 392
	}
395 393

394
	@Get
395
	@Path("/info/pqResidentOrgs")
396
	public PageQueryResult<ResidentOrgInfo> queryResidentOrginfos(@JdbcConn Connection con, String pid, @Nullable String key, int pageSize, int pageNo)
397
			throws SQLException {
398
		PageQueryResult<ResidentOrgInfo> ret = this.platformDao.pqResientOrgInfo(con, pid, key == null ? null : ("%" + key + "%"), pageSize, pageNo);
399
		for (ResidentOrgInfo roi : ret.getData()) {
400
			roi.setHasOrgLogo(this.imageService.hasOrgLogo(roi.getId()));
401
		}
402
		return ret;
403
	}
404

396 405
	@Get
397 406
	@Path("/info/buttedOrgs")
398 407
	public List<ButtedOrgInfo> queryButtedOrginfos(@JdbcConn Connection con, @DefaultValue("\"z\"") String time, @DefaultValue("\"z\"") String oid, String pid,
@ -427,15 +436,18 @@ public class PlatformService {
427 436
		}
428 437
		return ret;
429 438
	}
430
	
439

431 440
	@Get
432 441
	@Path("/info/wares")
433
	public List<PlatformWare> queryWares(@JdbcConn Connection con,@Nullable String key,@DefaultValue("\"z\"") String time, @DefaultValue("Long.MAX_VALUE") long shareId,String pid,int rows)throws SQLException{
442
	public List<PlatformWare> queryWares(@JdbcConn Connection con, @Nullable String key, @DefaultValue("\"z\"") String time,
443
			@DefaultValue("Long.MAX_VALUE") long shareId, String pid, int rows) throws SQLException {
434 444
		return platformDao.queryWare(con, key, pid, time, shareId, rows);
435 445
	}
446

436 447
	@Get
437 448
	@Path("/info/resources")
438
	public List<PlatformResource> queryResources(@JdbcConn Connection con,@Nullable String key,@DefaultValue("\"z\"") String time, @DefaultValue("Long.MAX_VALUE") long shareId,String pid,int rows)throws SQLException{
449
	public List<PlatformResource> queryResources(@JdbcConn Connection con, @Nullable String key, @DefaultValue("\"z\"") String time,
450
			@DefaultValue("Long.MAX_VALUE") long shareId, String pid, int rows) throws SQLException {
439 451
		return platformDao.queryResource(con, key, pid, time, shareId, rows);
440 452
	}
441 453


+ 12 - 0
src/main/java/com/ekexiu/portal/service/DemandService.java

@ -388,4 +388,16 @@ public class DemandService {
388 388
			@DefaultValue("5") int pageSize) throws SQLException {
389 389
		return this.demandDao.pageQuery(con, state, key == null ? key : ("%" + key + "%"), pageSize, pageNo);
390 390
	}
391
	
392
	
393
	@Get
394
	@Path("/search/platform")
395
	public PageQueryResult<Demand> query(@JdbcConn Connection con, @Nullable String state, @Nullable String source,@Nullable String  cost, @Nullable String duration, boolean byCreateTime, @Nullable String key, @DefaultValue("1") int pageNo,
396
			@DefaultValue("5") int pageSize) throws SQLException {
397
		if(byCreateTime){
398
			return this.demandDao.pageQueryOrderByCreateTimeDesc(con, state, source, cost, duration, key, pageSize, pageNo);
399
		}else{
400
			return this.demandDao.pageQueryOrderByInvalidDayAsc(con, state, source, cost, duration, key, pageSize, pageNo);
401
		}
402
	}
391 403
}

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

@ -1,7 +1,7 @@
1 1
package com.ekexiu.portal.service;
2 2

3 3
import com.ekexiu.portal.dao.ArticleDao;
4
import com.ekexiu.portal.dao.DemandDao;
4
//import com.ekexiu.portal.dao.DemandDao;
5 5
import com.ekexiu.portal.dao.HonorDao;
6 6
import com.ekexiu.portal.dao.ImageDao;
7 7
import com.ekexiu.portal.dao.OrgDao;
@ -111,16 +111,16 @@ public class ProfessorService {
111 111
	@Autowrie
112 112
	private KeyWordService keyWordService;
113 113

114
	@Autowrie
115
	private DemandDao demandDao;
116

117
	public DemandDao getDemandDao() {
118
		return demandDao;
119
	}
120

121
	public void setDemandDao(DemandDao demandDao) {
122
		this.demandDao = demandDao;
123
	}
114
//	@Autowrie
115
//	private DemandDao demandDao;
116
//
117
//	public DemandDao getDemandDao() {
118
//		return demandDao;
119
//	}
120
//
121
//	public void setDemandDao(DemandDao demandDao) {
122
//		this.demandDao = demandDao;
123
//	}
124 124

125 125
	public PatentAuthorDao getPatentAuthorDao() {
126 126
		return patentAuthorDao;
@ -364,7 +364,7 @@ public class ProfessorService {
364 364
				this.professorDao.updateOrg(con, oid, id);
365 365
				if (old != null) {
366 366
					this.professorDao.updateOrgAuth(con, id, "0");
367
					this.demandDao.closeByCreator(con, id, id);
367
//					this.demandDao.closeByCreator(con, id, id);
368 368
					this.orgResStaffDao.deletePro(con, id);
369 369
					JdbcUtil.execute(con,"DELETE FROM WARE_PRO WHERE PROFESSOR=?",new PreparedStatementConfig() {
370 370
						@Override
@ -400,7 +400,7 @@ public class ProfessorService {
400 400
			}
401 401
			if (old_oid != null && (!old_oid.equals(new_oid))) {
402 402
				this.professorDao.updateOrgAuth(con, op.getId(), "0");
403
				this.demandDao.closeByCreator(con, op.getId(), op.getId());
403
//				this.demandDao.closeByCreator(con, op.getId(), op.getId());
404 404
				this.orgResStaffDao.deletePro(con, op.getId());
405 405
				JdbcUtil.execute(con,"DELETE FROM WARE_PRO WHERE PROFESSOR=?",new PreparedStatementConfig() {
406 406
					@Override
@ -433,7 +433,7 @@ public class ProfessorService {
433 433
			}
434 434
			if (old_oid != null && (!old_oid.equals(new_oid))) {
435 435
				this.professorDao.updateOrgAuth(con, op.getId(), "0");
436
				this.demandDao.closeByCreator(con, op.getId(), op.getId());
436
//				this.demandDao.closeByCreator(con, op.getId(), op.getId());
437 437
				this.orgResStaffDao.deletePro(con, op.getId());
438 438
			}
439 439
		}