XMTT 6 vuotta sitten
vanhempi
commit
5a9c7d9745

+ 4 - 4
src/main/java/com/ekexiu/portal/article/file/ArticleFileDao.java

1
package com.ekexiu.portal.article.file;
1
package com.ekexiu.portal.article.file;
2

2

3
import java.sql.Connection;
4
import java.sql.SQLException;
5
import java.util.List;
6

7
import org.jfw.apt.orm.annotation.dao.Batch;
3
import org.jfw.apt.orm.annotation.dao.Batch;
8
import org.jfw.apt.orm.annotation.dao.DAO;
4
import org.jfw.apt.orm.annotation.dao.DAO;
9
import org.jfw.apt.orm.annotation.dao.method.From;
5
import org.jfw.apt.orm.annotation.dao.method.From;
13
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
9
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
14
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
10
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
15

11

12
import java.sql.Connection;
13
import java.sql.SQLException;
14
import java.util.List;
15

16
@DAO
16
@DAO
17
public interface ArticleFileDao {
17
public interface ArticleFileDao {
18
	@Insert
18
	@Insert

+ 1 - 0
src/main/java/com/ekexiu/portal/dao/ArticleDao.java

782

782

783
	@LimitSelect
783
	@LimitSelect
784
	@OrderBy(" ORDER BY PAGE_VIEWS DESC")
784
	@OrderBy(" ORDER BY PAGE_VIEWS DESC")
785
	@Where("STATUS = '1' ")
785
	public abstract List<Article> queryByWareId(Connection con,
786
	public abstract List<Article> queryByWareId(Connection con,
786
			@SqlColumn(handlerClass = StringHandler.class, value = { "ARTICLE_ID IN (SELECT ID FROM ARTICLE_WARE WHERE WARE =?)" }) String ware, int rows)
787
			@SqlColumn(handlerClass = StringHandler.class, value = { "ARTICLE_ID IN (SELECT ID FROM ARTICLE_WARE WHERE WARE =?)" }) String ware, int rows)
787
			throws SQLException;
788
			throws SQLException;

+ 8 - 8
src/main/java/com/ekexiu/portal/dao/ArticleResDao.java

1
package com.ekexiu.portal.dao;
1
package com.ekexiu.portal.dao;
2

2

3
import java.sql.Connection;
4
import java.sql.PreparedStatement;
5
import java.sql.ResultSet;
6
import java.sql.SQLException;
7
import java.util.ArrayList;
8
import java.util.List;
9

3
import com.ekexiu.portal.po.ArticleRes;
10
import org.jfw.apt.orm.annotation.dao.DAO;
4
import org.jfw.apt.orm.annotation.dao.DAO;
11
import org.jfw.apt.orm.annotation.dao.method.From;
5
import org.jfw.apt.orm.annotation.dao.method.From;
12
import org.jfw.apt.orm.annotation.dao.method.Where;
6
import org.jfw.apt.orm.annotation.dao.method.Where;
14
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
8
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
15
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
9
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
16

10

17
import com.ekexiu.portal.po.ArticleRes;
11
import java.sql.Connection;
12
import java.sql.PreparedStatement;
13
import java.sql.ResultSet;
14
import java.sql.SQLException;
15
import java.util.ArrayList;
16
import java.util.List;
18

17

19
@DAO
18
@DAO
20
public abstract class ArticleResDao {
19
public abstract class ArticleResDao {
62

61

63
	
62
	
64
	@SelectList
63
	@SelectList
64
    @Where("ARTICLE_ID IN (SELECT ARTICLE_ID FROM ARTICLE WHERE STATUS = '1') ")
65
	public abstract List<ArticleRes> queryByResourceId(Connection con,String resourceId) throws SQLException;
65
	public abstract List<ArticleRes> queryByResourceId(Connection con,String resourceId) throws SQLException;
66
}
66
}

+ 6 - 2
src/main/java/com/ekexiu/portal/dao/DemandDao.java

105
	@PageSelect
105
	@PageSelect
106
	@OrderBy(" ORDER BY STATE ASC,CREATE_TIME DESC")
106
	@OrderBy(" ORDER BY STATE ASC,CREATE_TIME DESC")
107
	public abstract PageQueryResult<Demand> pageQuery(Connection con,@Nullable @In String[] state,@Nullable String creator,@Nullable String orgName,int pageSize,int pageNo) throws SQLException;
107
	public abstract PageQueryResult<Demand> pageQuery(Connection con,@Nullable @In String[] state,@Nullable String creator,@Nullable String orgName,int pageSize,int pageNo) throws SQLException;
108
	
109
	
108

109

110
	@PageSelect
111
	@OrderBy(" ORDER BY STATE ASC,CREATE_TIME DESC")
112
	public abstract PageQueryResult<Demand> pageQueryOrg(Connection con,@Nullable @In String[] state,@GroupSqlColumn(value={"ORG_NAME = ?","CREATOR IN (SELECT ID FROM PROFESSOR WHERE ORG_ID IN(SELECT ID FROM ORGANIZATION WHERE NAME = ?) AND ORG_AUTH = '1')"},handlerClass = StringHandler.class,isAnd = false,force = false) String orgName,int pageSize,int pageNo) throws SQLException;
113

110
	@PageSelect
114
	@PageSelect
111
	@OrderBy(" ORDER BY CREATE_TIME DESC")
115
	@OrderBy(" ORDER BY CREATE_TIME DESC")
112
	public abstract PageQueryResult<Demand> pageQuery(Connection con,@Nullable @In String[] state,@GroupSqlColumn(value={"TITLE LIKE ?","DESCP LIKE ?"},handlerClass=StringHandler.class,isAnd=false ,force =false)  @Nullable String key,int pageSize,int pageNo) throws SQLException;
116
	public abstract PageQueryResult<Demand> pageQuery(Connection con,@Nullable @In String[] state,@GroupSqlColumn(value={"TITLE LIKE ?","DESCP LIKE ?"},handlerClass=StringHandler.class,isAnd=false ,force =false)  @Nullable String key,int pageSize,int pageNo) throws SQLException;

+ 21 - 1
src/main/java/com/ekexiu/portal/dao/ProfessorDao.java

1
package com.ekexiu.portal.dao;
1
package com.ekexiu.portal.dao;
2

2

3
import com.ekexiu.portal.po.Demand;
3
import com.ekexiu.portal.po.Organization;
4
import com.ekexiu.portal.po.Organization;
4
import com.ekexiu.portal.po.Professor;
5
import com.ekexiu.portal.po.Professor;
5
import com.ekexiu.portal.pojo.EditProfessor;
6
import com.ekexiu.portal.pojo.EditProfessor;
6
import com.ekexiu.portal.pojo.ProfessorInfo;
7
import com.ekexiu.portal.pojo.ProfessorInfo;
7
import com.ekexiu.portal.pojo.SortedPro;
8
import com.ekexiu.portal.pojo.SortedPro;
8
import com.ekexiu.portal.pojo.UserInfo;
9
import com.ekexiu.portal.pojo.UserInfo;
9
import com.ekexiu.portal.ware.Ware;
10
import org.jfw.apt.annotation.DefaultValue;
10
import org.jfw.apt.annotation.DefaultValue;
11
import org.jfw.apt.annotation.Nullable;
11
import org.jfw.apt.annotation.Nullable;
12
import org.jfw.apt.orm.annotation.dao.Column;
12
import org.jfw.apt.orm.annotation.dao.Column;
13
import org.jfw.apt.orm.annotation.dao.DAO;
13
import org.jfw.apt.orm.annotation.dao.DAO;
14
import org.jfw.apt.orm.annotation.dao.method.From;
14
import org.jfw.apt.orm.annotation.dao.method.From;
15
import org.jfw.apt.orm.annotation.dao.method.LimitColumn;
15
import org.jfw.apt.orm.annotation.dao.method.Or;
16
import org.jfw.apt.orm.annotation.dao.method.Or;
16
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
17
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
17
import org.jfw.apt.orm.annotation.dao.method.Select;
18
import org.jfw.apt.orm.annotation.dao.method.Select;
18
import org.jfw.apt.orm.annotation.dao.method.SetSentence;
19
import org.jfw.apt.orm.annotation.dao.method.SetSentence;
20
import org.jfw.apt.orm.annotation.dao.method.Where;
19
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
21
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
20
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
22
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
21
import org.jfw.apt.orm.annotation.dao.method.operator.LimitQuery;
23
import org.jfw.apt.orm.annotation.dao.method.operator.LimitQuery;
24
import org.jfw.apt.orm.annotation.dao.method.operator.PageQuery;
22
import org.jfw.apt.orm.annotation.dao.method.operator.PageSelect;
25
import org.jfw.apt.orm.annotation.dao.method.operator.PageSelect;
23
import org.jfw.apt.orm.annotation.dao.method.operator.QueryList;
26
import org.jfw.apt.orm.annotation.dao.method.operator.QueryList;
24
import org.jfw.apt.orm.annotation.dao.method.operator.QueryOne;
27
import org.jfw.apt.orm.annotation.dao.method.operator.QueryOne;
931
		}
934
		}
932
	}
935
	}
933

936

937
	@LimitQuery
938
	@OrderBy(cols = {@LimitColumn(value = "lid", column="id", handlerClass = StringHandler.class,asc=false)},value = "")
939
	@Select(Professor.class)
940
	@From(Professor.class)
941
	public abstract List<EditProfessor> orgAuth(Connection con,String orgId, @In(include= false) String[] id, String lid, int rows)throws SQLException;
942

943
	@PageQuery
944
	@Select(Professor.class)
945
	@From(Professor.class)
946
	public abstract PageQueryResult<EditProfessor> pqOrgAuth(Connection con, String orgId,@Nullable String orgAuth, int pageSize, int pageNo) throws SQLException;
947

934
	/**
948
	/**
935
	 * 查询所有专家的咨询星级和咨询完成次数
949
	 * 查询所有专家的咨询星级和咨询完成次数
936
	 * 
950
	 * 
2109
	@Select(Professor.class)
2123
	@Select(Professor.class)
2110
	@From(Professor.class)
2124
	@From(Professor.class)
2111
	public abstract List<EditProfessor> queryPro(Connection con, @In String[] id) throws SQLException;
2125
	public abstract List<EditProfessor> queryPro(Connection con, @In String[] id) throws SQLException;
2126

2127
	@UpdateWith
2128
	@Where("orgAuth ='1'")
2129
	@SetSentence("orgAuth='0'")
2130
	@From(Professor.class)
2131
	public abstract int cancelOrgAuth(Connection con,String id)throws SQLException;
2112
}
2132
}

+ 4 - 4
src/main/java/com/ekexiu/portal/org/OrgLinkManDao.java

1
package com.ekexiu.portal.org;
1
package com.ekexiu.portal.org;
2

2

3
import java.sql.Connection;
4
import java.sql.SQLException;
5
import java.util.List;
6

7
import org.jfw.apt.orm.annotation.dao.Batch;
3
import org.jfw.apt.orm.annotation.dao.Batch;
8
import org.jfw.apt.orm.annotation.dao.DAO;
4
import org.jfw.apt.orm.annotation.dao.DAO;
9
import org.jfw.apt.orm.annotation.dao.method.From;
5
import org.jfw.apt.orm.annotation.dao.method.From;
13
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
9
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
14
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
10
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
15

11

12
import java.sql.Connection;
13
import java.sql.SQLException;
14
import java.util.List;
15

16
@DAO
16
@DAO
17
public interface OrgLinkManDao {
17
public interface OrgLinkManDao {
18

18


+ 21 - 3
src/main/java/com/ekexiu/portal/service/ArticleService.java

1
package com.ekexiu.portal.service;
1
package com.ekexiu.portal.service;
2

2

3
import com.ekexiu.portal.article.file.ArticleFileService;
3
import com.ekexiu.portal.cms.ContentType;
4
import com.ekexiu.portal.cms.ContentType;
4
import com.ekexiu.portal.cms.TemplateService;
5
import com.ekexiu.portal.cms.TemplateService;
5
import com.ekexiu.portal.dao.ArticleAgreeDao;
6
import com.ekexiu.portal.dao.ArticleAgreeDao;
104
	@Autowrie
105
	@Autowrie
105
	private GrowthLogService growthLogService;
106
	private GrowthLogService growthLogService;
106

107

108
	@Autowrie
109
	private ArticleFileService articleFileService;
110

107
	public GrowthLogService getGrowthLogService() {
111
	public GrowthLogService getGrowthLogService() {
108
		return growthLogService;
112
		return growthLogService;
109
	}
113
	}
280
		this.articleResDao = articleResDao;
284
		this.articleResDao = articleResDao;
281
	}
285
	}
282

286

287
	public ArticleFileService getArticleFileService() {
288
		return articleFileService;
289
	}
290

291
	public void setArticleFileService(ArticleFileService articleFileService) {
292
		this.articleFileService = articleFileService;
293
	}
294

283
	private byte[] resImage(byte[] src, int maxLen) throws IOException {
295
	private byte[] resImage(byte[] src, int maxLen) throws IOException {
284
		ByteArrayInputStream in = new ByteArrayInputStream(src);
296
		ByteArrayInputStream in = new ByteArrayInputStream(src);
285
		ByteArrayOutputStream out = new ByteArrayOutputStream();
297
		ByteArrayOutputStream out = new ByteArrayOutputStream();
364

376

365
	@Post
377
	@Post
366
	@Path("/save")
378
	@Path("/save")
367
	public String saveArticle(@JdbcConn(false) Connection con, Article article, @Nullable String[] professors, @Nullable String[] resources,
379
	public String saveArticle(@JdbcConn(false) Connection con, Article article,@Nullable String[] files,@Nullable String[] professors, @Nullable String[] resources,
368
			@Nullable String[] orgs, @Nullable String[] wares) throws SQLException, IOException, JfwBaseException {
380
			@Nullable String[] orgs, @Nullable String[] wares) throws SQLException, IOException, JfwBaseException {
369
		String articleId = null;
381
		String articleId = null;
370
		try {
382
		try {
387
					throw new JfwBaseException(-2, "错误参数:文章类型");
399
					throw new JfwBaseException(-2, "错误参数:文章类型");
388
				}
400
				}
389
				this.articleDao.insert(con, article);
401
				this.articleDao.insert(con, article);
402
				this.articleFileService.update(con,articleId,files);
390
				this.keyWordService.refreshArticle(con, articleId, KeyWordService.splitKeyWord(article.getSubject()));
403
				this.keyWordService.refreshArticle(con, articleId, KeyWordService.splitKeyWord(article.getSubject()));
391
				if (professors != null) {
404
				if (professors != null) {
392
					for (String professor : professors) {
405
					for (String professor : professors) {
428
					article.setArticleImg(this.createDate() + "/" + article.getArticleId() + "." + JPG);
441
					article.setArticleImg(this.createDate() + "/" + article.getArticleId() + "." + JPG);
429
				}
442
				}
430
				this.articleDao.update(con, article);
443
				this.articleDao.update(con, article);
444
				this.articleFileService.update(con,articleId,files);
431
				this.articleDao.updatePublishTime(con, article.getArticleId(), "1", this.publishTime());
445
				this.articleDao.updatePublishTime(con, article.getArticleId(), "1", this.publishTime());
432
				this.keyWordService.refreshArticle(con, article.getArticleId(), KeyWordService.splitKeyWord(article.getSubject()));
446
				this.keyWordService.refreshArticle(con, article.getArticleId(), KeyWordService.splitKeyWord(article.getSubject()));
433
				this.articleProDao.delete(con, article.getArticleId());
447
				this.articleProDao.delete(con, article.getArticleId());
483

497

484
	@Post
498
	@Post
485
	@Path("/draft")
499
	@Path("/draft")
486
	public String draft(@JdbcConn(false) Connection con, Article article, @Nullable String[] professors, @Nullable String[] resources, @Nullable String[] orgs,
500
	public String draft(@JdbcConn(false) Connection con, Article article,@Nullable String[] files, @Nullable String[] professors, @Nullable String[] resources, @Nullable String[] orgs,
487
			@Nullable String[] wares) throws SQLException, IOException, JfwBaseException {
501
			@Nullable String[] wares) throws SQLException, IOException, JfwBaseException {
488

502

489
		String articleId = null;
503
		String articleId = null;
505
					throw new JfwBaseException(-2, "错误参数:文章类型");
519
					throw new JfwBaseException(-2, "错误参数:文章类型");
506
				}
520
				}
507
				this.articleDao.insert(con, article);
521
				this.articleDao.insert(con, article);
522
				this.articleFileService.update(con,articleId,files);
508
				this.keyWordService.refreshArticle(con, articleId, null);
523
				this.keyWordService.refreshArticle(con, articleId, null);
509
				if (professors != null) {
524
				if (professors != null) {
510
					for (String professor : professors) {
525
					for (String professor : professors) {
546
					article.setArticleImg(this.createDate() + "/" + article.getArticleId() + "." + JPG);
561
					article.setArticleImg(this.createDate() + "/" + article.getArticleId() + "." + JPG);
547
				}
562
				}
548
				this.articleDao.update(con, article);
563
				this.articleDao.update(con, article);
564
				this.articleFileService.update(con,articleId,files);
549
				this.articleDao.updateStatus(con, article.getArticleId(), "0");
565
				this.articleDao.updateStatus(con, article.getArticleId(), "0");
550
				this.keyWordService.refreshArticle(con, article.getArticleId(), null);
566
				this.keyWordService.refreshArticle(con, article.getArticleId(), null);
551
				this.articleProDao.delete(con, article.getArticleId());
567
				this.articleProDao.delete(con, article.getArticleId());
601

617

602
	@Post
618
	@Post
603
	@Path("/timing")
619
	@Path("/timing")
604
	public String timingPublish(@JdbcConn(false) Connection con, Article article, @Nullable String[] professors, @Nullable String[] resources,
620
	public String timingPublish(@JdbcConn(false) Connection con, Article article,@Nullable String[] files, @Nullable String[] professors, @Nullable String[] resources,
605
			@Nullable String[] orgs, @Nullable String[] wares) throws SQLException, IOException, JfwBaseException {
621
			@Nullable String[] orgs, @Nullable String[] wares) throws SQLException, IOException, JfwBaseException {
606
		String articleId = null;
622
		String articleId = null;
607
		try {
623
		try {
625
					throw new JfwBaseException(-2, "错误参数:文章类型");
641
					throw new JfwBaseException(-2, "错误参数:文章类型");
626
				}
642
				}
627
				this.articleDao.insert(con, article);
643
				this.articleDao.insert(con, article);
644
				this.articleFileService.update(con,articleId,files);
628
				if (professors != null) {
645
				if (professors != null) {
629
					for (String professor : professors) {
646
					for (String professor : professors) {
630
						ArticlePro articlePro = new ArticlePro();
647
						ArticlePro articlePro = new ArticlePro();
665
					article.setArticleImg(this.createDate() + "/" + article.getArticleId() + "." + JPG);
682
					article.setArticleImg(this.createDate() + "/" + article.getArticleId() + "." + JPG);
666
				}
683
				}
667
				this.articleDao.update(con, article);
684
				this.articleDao.update(con, article);
685
				this.articleFileService.update(con,articleId,files);
668
				this.articleDao.updatePublishTime(con, article.getArticleId(), "2", article.getPublishTime());
686
				this.articleDao.updatePublishTime(con, article.getArticleId(), "2", article.getPublishTime());
669
				this.keyWordService.refreshArticle(con, article.getArticleId(), null);
687
				this.keyWordService.refreshArticle(con, article.getArticleId(), null);
670
				this.articleResDao.delete(con, article.getArticleId());
688
				this.articleResDao.delete(con, article.getArticleId());

+ 47 - 11
src/main/java/com/ekexiu/portal/service/DemandService.java

1
package com.ekexiu.portal.service;
1
package com.ekexiu.portal.service;
2

2

3
import java.sql.Connection;
4
import java.sql.SQLException;
5
import java.util.Date;
6
import java.util.List;
7

3
import com.ekexiu.portal.dao.DemandDao;
4
import com.ekexiu.portal.dao.UserDao;
5
import com.ekexiu.portal.po.Demand;
6
import com.ekexiu.portal.po.Organization;
7
import com.ekexiu.portal.po.Professor;
8
import com.ekexiu.portal.po.User;
8
import org.jfw.apt.annotation.Autowrie;
9
import org.jfw.apt.annotation.Autowrie;
9
import org.jfw.apt.annotation.DefaultValue;
10
import org.jfw.apt.annotation.DefaultValue;
10
import org.jfw.apt.annotation.Nullable;
11
import org.jfw.apt.annotation.Nullable;
20
import org.jfw.util.jdbc.JdbcUtil;
21
import org.jfw.util.jdbc.JdbcUtil;
21
import org.jfw.util.state.StateCode;
22
import org.jfw.util.state.StateCode;
22

23

23
import com.ekexiu.portal.dao.DemandDao;
24
import com.ekexiu.portal.dao.UserDao;
25
import com.ekexiu.portal.po.Demand;
26
import com.ekexiu.portal.po.Organization;
27
import com.ekexiu.portal.po.Professor;
28
import com.ekexiu.portal.po.User;
24
import java.sql.Connection;
25
import java.sql.SQLException;
26
import java.util.Date;
27
import java.util.List;
29

28

30
@Path("/demand")
29
@Path("/demand")
31
public class DemandService {
30
public class DemandService {
224
		return this.demandDao.update(con, demand) > 0;
223
		return this.demandDao.update(con, demand) > 0;
225
	}
224
	}
226

225

226
	/**
227
	 * 企业修改需求
228
	 *
229
	 * @param con
230
	 * @param demand
231
	 * @throws SQLException
232
	 */
233
	@Post
234
	@Path("/modify/org")
235
	public boolean orgUpdate(@JdbcConn(true) Connection con,
236
						  @RequestParam(excludeFields = { "state", "createTime", "modifyTime", "title","source", "descp",  "pageViews", "shareId" }) Demand demand)
237
			throws SQLException {
238
		if (demand.getCost() == null) {
239
			demand.setCost("0");
240
		}
241
		if (demand.getDuration() == null) {
242
			demand.setDuration("0");
243
		}
244
		demand.setState("1");
245
		return this.demandDao.update(con, demand) > 0;
246
	}
247

227
	/**
248
	/**
228
	 * 完成需求
249
	 * 完成需求
229
	 * 
250
	 * 
403
			return this.demandDao.pageQueryOrderByInvalidDayAsc(con, state, source, cost, duration, key == null ? null : ("%" + key + "%"), pageSize, pageNo);
424
			return this.demandDao.pageQueryOrderByInvalidDayAsc(con, state, source, cost, duration, key == null ? null : ("%" + key + "%"), pageSize, pageNo);
404
		}
425
		}
405
	}
426
	}
427

428
	/**
429
	 * 分页查询企业需求(按状态及发布时间排序)
430
	 *
431
	 * @param con
432
	 * @param state
433
	 * @return
434
	 * @throws SQLException
435
	 */
436
	@Get
437
	@Path("/pq/org")
438
	public PageQueryResult<Demand> orgDemand(@JdbcConn Connection con, @Nullable String[] state, @Nullable String oname,
439
										 @DefaultValue("1") int pageNo, @DefaultValue("5") int pageSize) throws SQLException {
440
		return this.demandDao.pageQueryOrg(con, state, oname, pageSize, pageNo);
441
	}
406
}
442
}

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

29
import com.ekexiu.portal.pojo.SortedPro;
29
import com.ekexiu.portal.pojo.SortedPro;
30
import com.ekexiu.portal.pojo.UserInfo;
30
import com.ekexiu.portal.pojo.UserInfo;
31
import com.ekexiu.portal.util.Calculate;
31
import com.ekexiu.portal.util.Calculate;
32
import com.ekexiu.portal.ware.WareDao;
32
import org.jfw.apt.annotation.Autowrie;
33
import org.jfw.apt.annotation.Autowrie;
33
import org.jfw.apt.annotation.DefaultValue;
34
import org.jfw.apt.annotation.DefaultValue;
34
import org.jfw.apt.annotation.Nullable;
35
import org.jfw.apt.annotation.Nullable;
111
	@Autowrie
112
	@Autowrie
112
	private KeyWordService keyWordService;
113
	private KeyWordService keyWordService;
113

114

115
	@Autowrie
116
	private WareDao wareDao;
117

114
//	@Autowrie
118
//	@Autowrie
115
//	private DemandDao demandDao;
119
//	private DemandDao demandDao;
116
//
120
//
314
		this.orgResStaffDao = orgResStaffDao;
318
		this.orgResStaffDao = orgResStaffDao;
315
	}
319
	}
316

320

321
	public WareDao getWareDao() {
322
		return wareDao;
323
	}
324

325
	public void setWareDao(WareDao wareDao) {
326
		this.wareDao = wareDao;
327
	}
328

317
	@Post
329
	@Post
318
	@Path
330
	@Path
319
	public String insert(@JdbcConn(true) Connection con, Professor professor, @Nullable String orgName) throws SQLException, IOException {
331
	public String insert(@JdbcConn(true) Connection con, Professor professor, @Nullable String orgName) throws SQLException, IOException {
538
		return hiddenPrivacyInfo(professors);
550
		return hiddenPrivacyInfo(professors);
539
	}
551
	}
540

552

553
	/**
554
	 * 企业联系人
555
	 *
556
	 * @param con
557
	 * @param orgId  企业ID
558
	 * @param ids  企业默认联系人
559
	 * @param lid limit查询最后一条的id 首次不传
560
	 * @param rows limit查询最后一条的最大返回条数
561
	 * @return
562
	 * @throws SQLException
563
	 */
564
	@Get
565
	@Path("/orgAuth/nonDef")
566
	public List<EditProfessor> orgAuth(@JdbcConn Connection con,String[] ids,String orgId,String lid,int rows)throws SQLException {
567
		List<EditProfessor> professors = this.professorDao.orgAuth(con,orgId,ids,lid,rows);
568
		for (EditProfessor professor : professors) {
569
			professor.setHasHeadImage(this.imageService.hasProfessorImage(professor.getId()));
570
			professor.setResearchAreas(this.researchAreaDao.query(con, professor.getId()));
571
		}
572
		return hiddenPrivacyInfo(professors);
573
	}
574

575
	@Get
576
	@Path("/pqOrgAuth")
577
	public PageQueryResult<EditProfessor> pqOrgAuth(@JdbcConn Connection con,String orgId,@Nullable String orgAuth,int pageSize,int pageNo)throws SQLException {
578
		PageQueryResult<EditProfessor> professors = this.professorDao.pqOrgAuth(con, orgId,orgAuth, pageSize, pageNo);
579
		for (EditProfessor professor : professors.getData()) {
580
			professor.setHasHeadImage(this.imageService.hasProfessorImage(professor.getId()));
581
			professor.setResearchAreas(this.researchAreaDao.query(con, professor.getId()));
582
			hiddenPrivacyInfo(professor);
583
		}
584
		return professors;
585
	}
586

541
	public void updateStarAvg(Connection con) throws SQLException {
587
	public void updateStarAvg(Connection con) throws SQLException {
542
		try {
588
		try {
543
			List<Professor> professors = this.professorDao.queryStar(con);
589
			List<Professor> professors = this.professorDao.queryStar(con);
671
	@Path("/removeOrgAuth")
717
	@Path("/removeOrgAuth")
672
	public void removeOrgAuth(@JdbcConn(true) Connection con, String id) throws SQLException {
718
	public void removeOrgAuth(@JdbcConn(true) Connection con, String id) throws SQLException {
673
		this.professorDao.updateOrgAuth(con, id, "0");
719
		this.professorDao.updateOrgAuth(con, id, "0");
720
		this.wareDao.deletePro(con, id);
721
		this.orgResStaffDao.deletePro(con, id);
674
	}
722
	}
675

723

676
	@Post
724
	@Post

+ 10 - 4
src/main/java/com/ekexiu/portal/ware/WareDao.java

1
package com.ekexiu.portal.ware;
1
package com.ekexiu.portal.ware;
2

2

3
import java.sql.Connection;
4
import java.sql.SQLException;
5
import java.util.List;
6

7
import org.jfw.apt.annotation.DefaultValue;
3
import org.jfw.apt.annotation.DefaultValue;
8
import org.jfw.apt.annotation.Nullable;
4
import org.jfw.apt.annotation.Nullable;
9
import org.jfw.apt.orm.annotation.dao.Column;
5
import org.jfw.apt.orm.annotation.dao.Column;
34
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
30
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
35
import org.jfw.util.PageQueryResult;
31
import org.jfw.util.PageQueryResult;
36

32

33
import java.sql.Connection;
34
import java.sql.SQLException;
35
import java.util.List;
36

37
@DAO
37
@DAO
38
public abstract class WareDao {
38
public abstract class WareDao {
39

39

62
	@From(WarePro.class)
62
	@From(WarePro.class)
63
	public abstract int deleteWithPro(Connection con, String id, String professor) throws SQLException;
63
	public abstract int deleteWithPro(Connection con, String id, String professor) throws SQLException;
64

64

65
	@DeleteWith
66
	@From(WarePro.class)
67
	public abstract int deletePro(Connection con, String professor) throws SQLException;
68

65
	@Update
69
	@Update
66
	public abstract int update(Connection con, Ware ware) throws SQLException;
70
	public abstract int update(Connection con, Ware ware) throws SQLException;
67

71

81
	public abstract List<WarePro> queryPro(Connection con, String id) throws SQLException;
85
	public abstract List<WarePro> queryPro(Connection con, String id) throws SQLException;
82

86

83
	@SelectList
87
	@SelectList
88
	@Where(" RESOURCE IN (SELECT ID FORM RESOURCE WHERE STATUS = '1') ")
84
	public abstract List<WareRes> queryRes(Connection con, String id) throws SQLException;
89
	public abstract List<WareRes> queryRes(Connection con, String id) throws SQLException;
85

90

86
	@DefaultValue("0")
91
	@DefaultValue("0")
127
	@QueryList
132
	@QueryList
128
	@Select(Ware.class)
133
	@Select(Ware.class)
129
	@Where("(STATE='1' OR STATE ='2') AND CATEGORY='2'")
134
	@Where("(STATE='1' OR STATE ='2') AND CATEGORY='2'")
135
	@OrderBy("ORDER By STATE DESC,MODIFY_TIME DESC")
130
	@From(Ware.class)
136
	@From(Ware.class)
131
	public abstract List<CountWare> queryByOwner(Connection con,
137
	public abstract List<CountWare> queryByOwner(Connection con,
132
			@Nullable @GroupSqlColumn(handlerClass = StringHandler.class, value = { "NAME LIKE ?", "CNT LIKE ?", "KEYWORDS LIKE ?" }, isAnd = false) String key,
138
			@Nullable @GroupSqlColumn(handlerClass = StringHandler.class, value = { "NAME LIKE ?", "CNT LIKE ?", "KEYWORDS LIKE ?" }, isAnd = false) String key,