jiapeng 6 vuotta sitten
vanhempi
commit
b7186fbbf8

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

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
			@SqlColumn(handlerClass = StringHandler.class, value = { "R.PID=?" }) String pid,
146
			@SqlColumn(handlerClass = StringHandler.class, value = { "R.PID=?" }) String pid,
147
			@Nullable @GroupSqlColumn(handlerClass = StringHandler.class, isAnd = false, value = { "O.NAME LIKE ?", "O.FOR_SHORT LIKE ?" }) String key,
147
			@Nullable @GroupSqlColumn(handlerClass = StringHandler.class, isAnd = false, value = { "O.NAME LIKE ?", "O.FOR_SHORT LIKE ?" }) String key,
148
			int rows) throws SQLException;
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
	@LimitQuery
158
	@LimitQuery
151
	@OrderBy(cols = { @LimitColumn(value = "time", column = "B.CREATE_TIME", handlerClass = StringHandler.class, asc = false),
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
	public void setMailService(MailService mailService) {
109
	public void setMailService(MailService mailService) {
110
		this.mailService = mailService;
110
		this.mailService = mailService;
111
	}
111
	}
112
	
113
	
114

112

115
	public String getUrlWithRestPasswordWithEmail() {
113
	public String getUrlWithRestPasswordWithEmail() {
116
		return urlWithRestPasswordWithEmail;
114
		return urlWithRestPasswordWithEmail;
177
	}
175
	}
178

176

179
	@SetCookie(checkResultNull = true, path = "/", value = { "plf_user=result.getId()", "plf_email=result.getEmail()",
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
	@Post
180
	@Post
182
	@Path("/login")
181
	@Path("/login")
183
	public LoginUserInfo login(@JdbcConn Connection con, String email, String pw) throws JfwBaseException, SQLException {
182
	public LoginUserInfo login(@JdbcConn Connection con, String email, String pw) throws JfwBaseException, SQLException {
209

208

210
	@Path("/reqResetPw")
209
	@Path("/reqResetPw")
211
	@Post
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
		PlatformUser pu = this.platformDao.queryUser(con, mail);
212
		PlatformUser pu = this.platformDao.queryUser(con, mail);
214
		if (pu == null)
213
		if (pu == null)
215
			throw new JfwBaseException(-600001, "not found user");
214
			throw new JfwBaseException(-600001, "not found user");
289

288

290
	@Post
289
	@Post
291
	@Path("/bindMail")
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
		@SuppressWarnings("unchecked")
292
		@SuppressWarnings("unchecked")
294
		StateCode<String, String> sc = (StateCode<String, String>) JfwAppContext.getCachedObject(code);
293
		StateCode<String, String> sc = (StateCode<String, String>) JfwAppContext.getCachedObject(code);
295
		if (sc == null) {
294
		if (sc == null) {
296
			throw new JfwBaseException(-600001, " code expire");
295
			throw new JfwBaseException(-600001, " code expire");
297
		}
296
		}
298
		JfwAppContext.removeCachedObject(code);
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
		if (this.platformDao.updateMail(con, sc.getCode(), sc.getKey(), sc.getValue(), sc.getDescp()) == 0) {
303
		if (this.platformDao.updateMail(con, sc.getCode(), sc.getKey(), sc.getValue(), sc.getDescp()) == 0) {
324
		return this.platformDao.queryInfo(con, id);
323
		return this.platformDao.queryInfo(con, id);
325
	}
324
	}
326

325

327

328
	@Post
326
	@Post
329
	@Path("/resident")
327
	@Path("/resident")
330
	public int resident(@JdbcConn(true) Connection con, @RequestParam(fields = { @FieldParam(value = "pid", valueClass = String.class),
328
	public int resident(@JdbcConn(true) Connection con, @RequestParam(fields = { @FieldParam(value = "pid", valueClass = String.class),
393
		return ret;
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
	@Get
405
	@Get
397
	@Path("/info/buttedOrgs")
406
	@Path("/info/buttedOrgs")
398
	public List<ButtedOrgInfo> queryButtedOrginfos(@JdbcConn Connection con, @DefaultValue("\"z\"") String time, @DefaultValue("\"z\"") String oid, String pid,
407
	public List<ButtedOrgInfo> queryButtedOrginfos(@JdbcConn Connection con, @DefaultValue("\"z\"") String time, @DefaultValue("\"z\"") String oid, String pid,
427
		}
436
		}
428
		return ret;
437
		return ret;
429
	}
438
	}
430
	
439

431
	@Get
440
	@Get
432
	@Path("/info/wares")
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
		return platformDao.queryWare(con, key, pid, time, shareId, rows);
444
		return platformDao.queryWare(con, key, pid, time, shareId, rows);
435
	}
445
	}
446

436
	@Get
447
	@Get
437
	@Path("/info/resources")
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
		return platformDao.queryResource(con, key, pid, time, shareId, rows);
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
			@DefaultValue("5") int pageSize) throws SQLException {
388
			@DefaultValue("5") int pageSize) throws SQLException {
389
		return this.demandDao.pageQuery(con, state, key == null ? key : ("%" + key + "%"), pageSize, pageNo);
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
package com.ekexiu.portal.service;
1
package com.ekexiu.portal.service;
2

2

3
import com.ekexiu.portal.dao.ArticleDao;
3
import com.ekexiu.portal.dao.ArticleDao;
4
import com.ekexiu.portal.dao.DemandDao;
4
//import com.ekexiu.portal.dao.DemandDao;
5
import com.ekexiu.portal.dao.HonorDao;
5
import com.ekexiu.portal.dao.HonorDao;
6
import com.ekexiu.portal.dao.ImageDao;
6
import com.ekexiu.portal.dao.ImageDao;
7
import com.ekexiu.portal.dao.OrgDao;
7
import com.ekexiu.portal.dao.OrgDao;
111
	@Autowrie
111
	@Autowrie
112
	private KeyWordService keyWordService;
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
	public PatentAuthorDao getPatentAuthorDao() {
125
	public PatentAuthorDao getPatentAuthorDao() {
126
		return patentAuthorDao;
126
		return patentAuthorDao;
364
				this.professorDao.updateOrg(con, oid, id);
364
				this.professorDao.updateOrg(con, oid, id);
365
				if (old != null) {
365
				if (old != null) {
366
					this.professorDao.updateOrgAuth(con, id, "0");
366
					this.professorDao.updateOrgAuth(con, id, "0");
367
					this.demandDao.closeByCreator(con, id, id);
367
//					this.demandDao.closeByCreator(con, id, id);
368
					this.orgResStaffDao.deletePro(con, id);
368
					this.orgResStaffDao.deletePro(con, id);
369
					JdbcUtil.execute(con,"DELETE FROM WARE_PRO WHERE PROFESSOR=?",new PreparedStatementConfig() {
369
					JdbcUtil.execute(con,"DELETE FROM WARE_PRO WHERE PROFESSOR=?",new PreparedStatementConfig() {
370
						@Override
370
						@Override
400
			}
400
			}
401
			if (old_oid != null && (!old_oid.equals(new_oid))) {
401
			if (old_oid != null && (!old_oid.equals(new_oid))) {
402
				this.professorDao.updateOrgAuth(con, op.getId(), "0");
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
				this.orgResStaffDao.deletePro(con, op.getId());
404
				this.orgResStaffDao.deletePro(con, op.getId());
405
				JdbcUtil.execute(con,"DELETE FROM WARE_PRO WHERE PROFESSOR=?",new PreparedStatementConfig() {
405
				JdbcUtil.execute(con,"DELETE FROM WARE_PRO WHERE PROFESSOR=?",new PreparedStatementConfig() {
406
					@Override
406
					@Override
433
			}
433
			}
434
			if (old_oid != null && (!old_oid.equals(new_oid))) {
434
			if (old_oid != null && (!old_oid.equals(new_oid))) {
435
				this.professorDao.updateOrgAuth(con, op.getId(), "0");
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
				this.orgResStaffDao.deletePro(con, op.getId());
437
				this.orgResStaffDao.deletePro(con, op.getId());
438
			}
438
			}
439
		}
439
		}