|
@ -54,7 +54,7 @@ public class ArticleService {
|
54
|
54
|
private File articlePath;
|
55
|
55
|
private String dateFormat = "yyyyMMdd";
|
56
|
56
|
private String timeFormat = "yyyyMMddHHmmss";
|
57
|
|
private int artMaxLen=70;
|
|
57
|
private int artMaxLen = 70;
|
58
|
58
|
private static final String JPG = "jpg";
|
59
|
59
|
public static final String MAX_MODIFYTIME = "9";
|
60
|
60
|
@Autowrie
|
|
@ -81,14 +81,12 @@ public class ArticleService {
|
81
|
81
|
private ArticleProDao articleProDao;
|
82
|
82
|
@Autowrie
|
83
|
83
|
private ArticleResDao articleResDao;
|
84
|
|
|
|
84
|
|
85
|
85
|
@Autowrie
|
86
|
86
|
private ArticleOrgDao articleOrgDao;
|
87
|
|
|
|
87
|
|
88
|
88
|
@Autowrie
|
89
|
89
|
private KeyWordService keyWordService;
|
90
|
|
|
91
|
|
|
92
|
90
|
|
93
|
91
|
public KeyWordService getKeyWordService() {
|
94
|
92
|
return keyWordService;
|
|
@ -153,7 +151,7 @@ public class ArticleService {
|
153
|
151
|
public void setArticleDao(ArticleDao articleDao) {
|
154
|
152
|
this.articleDao = articleDao;
|
155
|
153
|
}
|
156
|
|
|
|
154
|
|
157
|
155
|
public ArticleAgreeDao getArticleAgreeDao() {
|
158
|
156
|
return articleAgreeDao;
|
159
|
157
|
}
|
|
@ -249,7 +247,7 @@ public class ArticleService {
|
249
|
247
|
out.flush();
|
250
|
248
|
return out.toByteArray();
|
251
|
249
|
}
|
252
|
|
|
|
250
|
|
253
|
251
|
private byte[] readTmpFile(String fn) throws JfwBaseException {
|
254
|
252
|
File file = new File(this.tmpPath, fn);
|
255
|
253
|
if (!file.exists())
|
|
@ -263,8 +261,8 @@ public class ArticleService {
|
263
|
261
|
throw new JfwBaseException(91, "read temp resource image error", e);
|
264
|
262
|
}
|
265
|
263
|
}
|
266
|
|
|
267
|
|
private void saveArtImg(String fn, String id) throws JfwBaseException, IOException{
|
|
264
|
|
|
265
|
private void saveArtImg(String fn, String id) throws JfwBaseException, IOException {
|
268
|
266
|
byte[] src = this.readTmpFile(fn);
|
269
|
267
|
src = JpgUtil.read(src);
|
270
|
268
|
byte[] shareResImage = this.resImage(src, this.artMaxLen);
|
|
@ -277,69 +275,68 @@ public class ArticleService {
|
277
|
275
|
IoUtil.saveStream(new FileOutputStream(new File(dateFile, id + "." + JPG)), src, true);
|
278
|
276
|
IoUtil.saveStream(new FileOutputStream(new File(dateFile, id + "_s." + JPG)), shareResImage, true);
|
279
|
277
|
}
|
280
|
|
|
281
|
|
private String createDate(){
|
|
278
|
|
|
279
|
private String createDate() {
|
282
|
280
|
SimpleDateFormat df = new SimpleDateFormat(this.dateFormat);
|
283
|
281
|
String date = df.format(new Date());
|
284
|
282
|
return date;
|
285
|
283
|
}
|
286
|
|
|
287
|
|
private String publishTime(){
|
|
284
|
|
|
285
|
private String publishTime() {
|
288
|
286
|
SimpleDateFormat df = new SimpleDateFormat(this.timeFormat);
|
289
|
287
|
String publishTime = df.format(new Date());
|
290
|
288
|
return publishTime;
|
291
|
289
|
}
|
292
|
|
|
|
290
|
|
293
|
291
|
@Post
|
294
|
292
|
@Path
|
295
|
|
public String insert(@JdbcConn(true) Connection con, Article article)
|
296
|
|
throws SQLException, IOException, JfwBaseException{
|
|
293
|
public String insert(@JdbcConn(true) Connection con, Article article) throws SQLException, IOException, JfwBaseException {
|
297
|
294
|
String articleId = StringUtil.buildUUID();
|
298
|
|
if(article.getArticleImg() != null){
|
|
295
|
if (article.getArticleImg() != null) {
|
299
|
296
|
this.saveArtImg(article.getArticleImg(), articleId);
|
300
|
|
article.setArticleImg(this.createDate()+"/"+articleId+"."+JPG);
|
|
297
|
article.setArticleImg(this.createDate() + "/" + articleId + "." + JPG);
|
301
|
298
|
}
|
302
|
299
|
article.setArticleId(articleId);
|
303
|
300
|
article.setArticleAgree(0);
|
304
|
301
|
article.setPageViews(0);
|
305
|
302
|
article.setStatus("1");
|
306
|
303
|
article.setPublishTime(this.publishTime());
|
307
|
|
if(article.getProfessorId() != null && article.getOrgId() == null){
|
|
304
|
if (article.getProfessorId() != null && article.getOrgId() == null) {
|
308
|
305
|
article.setArticleType("1");
|
309
|
|
}else if(article.getProfessorId() == null && article.getOrgId() != null){
|
|
306
|
} else if (article.getProfessorId() == null && article.getOrgId() != null) {
|
310
|
307
|
article.setArticleType("2");
|
311
|
|
}else{
|
|
308
|
} else {
|
312
|
309
|
throw new JfwBaseException(-1, "错误参数:文章发布者ID");
|
313
|
310
|
}
|
314
|
311
|
this.articleDao.insert(con, article);
|
315
|
312
|
return articleId;
|
316
|
313
|
}
|
317
|
|
|
|
314
|
|
318
|
315
|
@Post
|
319
|
316
|
@Path("/save")
|
320
|
|
public String saveArticle(@JdbcConn(true) Connection con,Article article,@Nullable String[] professors,
|
321
|
|
@Nullable String[] resources,@Nullable String[] orgs) throws SQLException, IOException, JfwBaseException{
|
322
|
|
if(article.getArticleId() == null){
|
|
317
|
public String saveArticle(@JdbcConn(true) Connection con, Article article, @Nullable String[] professors, @Nullable String[] resources,
|
|
318
|
@Nullable String[] orgs) throws SQLException, IOException, JfwBaseException {
|
|
319
|
if (article.getArticleId() == null) {
|
323
|
320
|
String articleId = StringUtil.buildUUID();
|
324
|
|
if(article.getArticleImg() != null){
|
|
321
|
if (article.getArticleImg() != null) {
|
325
|
322
|
this.saveArtImg(article.getArticleImg(), articleId);
|
326
|
|
article.setArticleImg(this.createDate()+"/"+articleId+"."+JPG);
|
|
323
|
article.setArticleImg(this.createDate() + "/" + articleId + "." + JPG);
|
327
|
324
|
}
|
328
|
325
|
article.setArticleId(articleId);
|
329
|
326
|
article.setArticleAgree(0);
|
330
|
327
|
article.setPageViews(0);
|
331
|
328
|
article.setStatus("1");
|
332
|
329
|
article.setPublishTime(this.publishTime());
|
333
|
|
if(article.getProfessorId() != null && article.getOrgId() == null){
|
|
330
|
if (article.getProfessorId() != null && article.getOrgId() == null) {
|
334
|
331
|
article.setArticleType("1");
|
335
|
|
}else if(article.getProfessorId() == null && article.getOrgId() != null){
|
|
332
|
} else if (article.getProfessorId() == null && article.getOrgId() != null) {
|
336
|
333
|
article.setArticleType("2");
|
337
|
|
}else{
|
|
334
|
} else {
|
338
|
335
|
throw new JfwBaseException(-1, "错误参数:文章发布者ID");
|
339
|
336
|
}
|
340
|
337
|
this.articleDao.insert(con, article);
|
341
|
|
this.keyWordService.refreshArticle(con,articleId, KeyWordService.splitKeyWord(article.getSubject()));
|
342
|
|
if(professors != null){
|
|
338
|
this.keyWordService.refreshArticle(con, articleId, KeyWordService.splitKeyWord(article.getSubject()));
|
|
339
|
if (professors != null) {
|
343
|
340
|
for (String professor : professors) {
|
344
|
341
|
ArticlePro articlePro = new ArticlePro();
|
345
|
342
|
articlePro.setArticleId(articleId);
|
|
@ -347,7 +344,7 @@ public class ArticleService {
|
347
|
344
|
this.articleProDao.insert(con, articlePro);
|
348
|
345
|
}
|
349
|
346
|
}
|
350
|
|
if(resources != null){
|
|
347
|
if (resources != null) {
|
351
|
348
|
for (String resource : resources) {
|
352
|
349
|
ArticleRes articleRes = new ArticleRes();
|
353
|
350
|
articleRes.setArticleId(articleId);
|
|
@ -355,8 +352,8 @@ public class ArticleService {
|
355
|
352
|
this.articleResDao.insert(con, articleRes);
|
356
|
353
|
}
|
357
|
354
|
}
|
358
|
|
if(orgs!=null && orgs.length>0){
|
359
|
|
for(String org:orgs){
|
|
355
|
if (orgs != null && orgs.length > 0) {
|
|
356
|
for (String org : orgs) {
|
360
|
357
|
ArticleOrg articleOrg = new ArticleOrg();
|
361
|
358
|
articleOrg.setArticleId(articleId);
|
362
|
359
|
articleOrg.setOrgId(org);
|
|
@ -364,18 +361,18 @@ public class ArticleService {
|
364
|
361
|
}
|
365
|
362
|
}
|
366
|
363
|
return articleId;
|
367
|
|
}else if(article.getArticleId().trim().length() == 32){
|
368
|
|
if(article.getArticleImg() != null){
|
|
364
|
} else if (article.getArticleId().trim().length() == 32) {
|
|
365
|
if (article.getArticleImg() != null) {
|
369
|
366
|
this.saveArtImg(article.getArticleImg(), article.getArticleId());
|
370
|
|
article.setArticleImg(this.createDate()+"/"+article.getArticleId()+"."+JPG);
|
|
367
|
article.setArticleImg(this.createDate() + "/" + article.getArticleId() + "." + JPG);
|
371
|
368
|
}
|
372
|
369
|
this.articleDao.update(con, article);
|
373
|
370
|
this.articleDao.updatePublishTime(con, article.getArticleId(), "1", this.publishTime());
|
374
|
|
this.keyWordService.refreshArticle(con,article.getArticleId(), KeyWordService.splitKeyWord(article.getSubject()));
|
|
371
|
this.keyWordService.refreshArticle(con, article.getArticleId(), KeyWordService.splitKeyWord(article.getSubject()));
|
375
|
372
|
this.articleProDao.delete(con, article.getArticleId());
|
376
|
373
|
this.articleResDao.delete(con, article.getArticleId());
|
377
|
374
|
this.articleOrgDao.delete(con, article.getArticleId());
|
378
|
|
if(professors != null){
|
|
375
|
if (professors != null) {
|
379
|
376
|
for (String professor : professors) {
|
380
|
377
|
ArticlePro articlePro = new ArticlePro();
|
381
|
378
|
articlePro.setArticleId(article.getArticleId());
|
|
@ -383,7 +380,7 @@ public class ArticleService {
|
383
|
380
|
this.articleProDao.insert(con, articlePro);
|
384
|
381
|
}
|
385
|
382
|
}
|
386
|
|
if(resources != null){
|
|
383
|
if (resources != null) {
|
387
|
384
|
for (String resource : resources) {
|
388
|
385
|
ArticleRes articleRes = new ArticleRes();
|
389
|
386
|
articleRes.setArticleId(article.getArticleId());
|
|
@ -391,8 +388,8 @@ public class ArticleService {
|
391
|
388
|
this.articleResDao.insert(con, articleRes);
|
392
|
389
|
}
|
393
|
390
|
}
|
394
|
|
if(orgs!=null && orgs.length>0){
|
395
|
|
for(String org:orgs){
|
|
391
|
if (orgs != null && orgs.length > 0) {
|
|
392
|
for (String org : orgs) {
|
396
|
393
|
ArticleOrg articleOrg = new ArticleOrg();
|
397
|
394
|
articleOrg.setArticleId(article.getArticleId());
|
398
|
395
|
articleOrg.setOrgId(org);
|
|
@ -400,35 +397,35 @@ public class ArticleService {
|
400
|
397
|
}
|
401
|
398
|
}
|
402
|
399
|
return article.getArticleId();
|
403
|
|
}else{
|
|
400
|
} else {
|
404
|
401
|
throw new JfwBaseException(-2, "bad parameter:articleId");
|
405
|
402
|
}
|
406
|
403
|
}
|
407
|
|
|
|
404
|
|
408
|
405
|
@Post
|
409
|
406
|
@Path("/draft")
|
410
|
|
public String draft(@JdbcConn(true) Connection con,Article article,@Nullable String[] professors,
|
411
|
|
@Nullable String[] resources,@Nullable String[] orgs) throws SQLException, IOException, JfwBaseException{
|
412
|
|
if(article.getArticleId() == null){
|
|
407
|
public String draft(@JdbcConn(true) Connection con, Article article, @Nullable String[] professors, @Nullable String[] resources, @Nullable String[] orgs)
|
|
408
|
throws SQLException, IOException, JfwBaseException {
|
|
409
|
if (article.getArticleId() == null) {
|
413
|
410
|
String articleId = StringUtil.buildUUID();
|
414
|
|
if(article.getArticleImg() != null){
|
|
411
|
if (article.getArticleImg() != null) {
|
415
|
412
|
this.saveArtImg(article.getArticleImg(), articleId);
|
416
|
|
article.setArticleImg(this.createDate()+"/"+articleId+"."+JPG);
|
|
413
|
article.setArticleImg(this.createDate() + "/" + articleId + "." + JPG);
|
417
|
414
|
}
|
418
|
415
|
article.setArticleId(articleId);
|
419
|
416
|
article.setArticleAgree(0);
|
420
|
417
|
article.setPageViews(0);
|
421
|
418
|
article.setStatus("0");
|
422
|
|
if(article.getProfessorId() != null && article.getOrgId() == null){
|
|
419
|
if (article.getProfessorId() != null && article.getOrgId() == null) {
|
423
|
420
|
article.setArticleType("1");
|
424
|
|
}else if(article.getProfessorId() == null && article.getOrgId() != null){
|
|
421
|
} else if (article.getProfessorId() == null && article.getOrgId() != null) {
|
425
|
422
|
article.setArticleType("2");
|
426
|
|
}else{
|
|
423
|
} else {
|
427
|
424
|
throw new JfwBaseException(-1, "错误参数:文章发布者ID");
|
428
|
425
|
}
|
429
|
426
|
this.articleDao.insert(con, article);
|
430
|
|
this.keyWordService.refreshArticle(con,articleId, null);
|
431
|
|
if(professors != null){
|
|
427
|
this.keyWordService.refreshArticle(con, articleId, null);
|
|
428
|
if (professors != null) {
|
432
|
429
|
for (String professor : professors) {
|
433
|
430
|
ArticlePro articlePro = new ArticlePro();
|
434
|
431
|
articlePro.setArticleId(articleId);
|
|
@ -436,7 +433,7 @@ public class ArticleService {
|
436
|
433
|
this.articleProDao.insert(con, articlePro);
|
437
|
434
|
}
|
438
|
435
|
}
|
439
|
|
if(resources != null){
|
|
436
|
if (resources != null) {
|
440
|
437
|
for (String resource : resources) {
|
441
|
438
|
ArticleRes articleRes = new ArticleRes();
|
442
|
439
|
articleRes.setArticleId(articleId);
|
|
@ -444,8 +441,8 @@ public class ArticleService {
|
444
|
441
|
this.articleResDao.insert(con, articleRes);
|
445
|
442
|
}
|
446
|
443
|
}
|
447
|
|
if(orgs!=null && orgs.length>0){
|
448
|
|
for(String org:orgs){
|
|
444
|
if (orgs != null && orgs.length > 0) {
|
|
445
|
for (String org : orgs) {
|
449
|
446
|
ArticleOrg articleOrg = new ArticleOrg();
|
450
|
447
|
articleOrg.setArticleId(articleId);
|
451
|
448
|
articleOrg.setOrgId(org);
|
|
@ -453,10 +450,10 @@ public class ArticleService {
|
453
|
450
|
}
|
454
|
451
|
}
|
455
|
452
|
return articleId;
|
456
|
|
}else if(article.getArticleId().trim().length() == 32){
|
457
|
|
if(article.getArticleImg() != null){
|
|
453
|
} else if (article.getArticleId().trim().length() == 32) {
|
|
454
|
if (article.getArticleImg() != null) {
|
458
|
455
|
this.saveArtImg(article.getArticleImg(), article.getArticleId());
|
459
|
|
article.setArticleImg(this.createDate()+"/"+article.getArticleId()+"."+JPG);
|
|
456
|
article.setArticleImg(this.createDate() + "/" + article.getArticleId() + "." + JPG);
|
460
|
457
|
}
|
461
|
458
|
this.articleDao.update(con, article);
|
462
|
459
|
this.articleDao.updateStatus(con, article.getArticleId(), "0");
|
|
@ -464,7 +461,7 @@ public class ArticleService {
|
464
|
461
|
this.articleProDao.delete(con, article.getArticleId());
|
465
|
462
|
this.articleResDao.delete(con, article.getArticleId());
|
466
|
463
|
this.articleOrgDao.delete(con, article.getArticleId());
|
467
|
|
if(professors != null){
|
|
464
|
if (professors != null) {
|
468
|
465
|
for (String professor : professors) {
|
469
|
466
|
ArticlePro articlePro = new ArticlePro();
|
470
|
467
|
articlePro.setArticleId(article.getArticleId());
|
|
@ -472,7 +469,7 @@ public class ArticleService {
|
472
|
469
|
this.articleProDao.insert(con, articlePro);
|
473
|
470
|
}
|
474
|
471
|
}
|
475
|
|
if(resources != null){
|
|
472
|
if (resources != null) {
|
476
|
473
|
for (String resource : resources) {
|
477
|
474
|
ArticleRes articleRes = new ArticleRes();
|
478
|
475
|
articleRes.setArticleId(article.getArticleId());
|
|
@ -480,8 +477,8 @@ public class ArticleService {
|
480
|
477
|
this.articleResDao.insert(con, articleRes);
|
481
|
478
|
}
|
482
|
479
|
}
|
483
|
|
if(orgs!=null && orgs.length>0){
|
484
|
|
for(String org:orgs){
|
|
480
|
if (orgs != null && orgs.length > 0) {
|
|
481
|
for (String org : orgs) {
|
485
|
482
|
ArticleOrg articleOrg = new ArticleOrg();
|
486
|
483
|
articleOrg.setArticleId(article.getArticleId());
|
487
|
484
|
articleOrg.setOrgId(org);
|
|
@ -489,37 +486,37 @@ public class ArticleService {
|
489
|
486
|
}
|
490
|
487
|
}
|
491
|
488
|
return article.getArticleId();
|
492
|
|
}else{
|
|
489
|
} else {
|
493
|
490
|
throw new JfwBaseException(-2, "bad parameter:articleId");
|
494
|
491
|
}
|
495
|
492
|
}
|
496
|
|
|
|
493
|
|
497
|
494
|
@Post
|
498
|
495
|
@Path("/timing")
|
499
|
|
public String timingPublish(@JdbcConn(true) Connection con,Article article,@Nullable String[] professors,
|
500
|
|
@Nullable String[] resources,@Nullable String[] orgs) throws SQLException, IOException, JfwBaseException{
|
501
|
|
if(article.getPublishTime() == null){
|
|
496
|
public String timingPublish(@JdbcConn(true) Connection con, Article article, @Nullable String[] professors, @Nullable String[] resources,
|
|
497
|
@Nullable String[] orgs) throws SQLException, IOException, JfwBaseException {
|
|
498
|
if (article.getPublishTime() == null) {
|
502
|
499
|
throw new JfwBaseException(-3, "no parameter found:publishTime");
|
503
|
500
|
}
|
504
|
|
if(article.getArticleId() == null){
|
|
501
|
if (article.getArticleId() == null) {
|
505
|
502
|
String articleId = StringUtil.buildUUID();
|
506
|
|
if(article.getArticleImg() != null){
|
|
503
|
if (article.getArticleImg() != null) {
|
507
|
504
|
this.saveArtImg(article.getArticleImg(), articleId);
|
508
|
|
article.setArticleImg(this.createDate()+"/"+articleId+"."+JPG);
|
|
505
|
article.setArticleImg(this.createDate() + "/" + articleId + "." + JPG);
|
509
|
506
|
}
|
510
|
507
|
article.setArticleId(articleId);
|
511
|
508
|
article.setArticleAgree(0);
|
512
|
509
|
article.setPageViews(0);
|
513
|
510
|
article.setStatus("2");
|
514
|
|
if(article.getProfessorId() != null && article.getOrgId() == null){
|
|
511
|
if (article.getProfessorId() != null && article.getOrgId() == null) {
|
515
|
512
|
article.setArticleType("1");
|
516
|
|
}else if(article.getProfessorId() == null && article.getOrgId() != null){
|
|
513
|
} else if (article.getProfessorId() == null && article.getOrgId() != null) {
|
517
|
514
|
article.setArticleType("2");
|
518
|
|
}else{
|
|
515
|
} else {
|
519
|
516
|
throw new JfwBaseException(-1, "错误参数:文章发布者ID");
|
520
|
517
|
}
|
521
|
518
|
this.articleDao.insert(con, article);
|
522
|
|
if(professors != null){
|
|
519
|
if (professors != null) {
|
523
|
520
|
for (String professor : professors) {
|
524
|
521
|
ArticlePro articlePro = new ArticlePro();
|
525
|
522
|
articlePro.setArticleId(articleId);
|
|
@ -527,7 +524,7 @@ public class ArticleService {
|
527
|
524
|
this.articleProDao.insert(con, articlePro);
|
528
|
525
|
}
|
529
|
526
|
}
|
530
|
|
if(resources != null){
|
|
527
|
if (resources != null) {
|
531
|
528
|
for (String resource : resources) {
|
532
|
529
|
ArticleRes articleRes = new ArticleRes();
|
533
|
530
|
articleRes.setArticleId(articleId);
|
|
@ -535,8 +532,8 @@ public class ArticleService {
|
535
|
532
|
this.articleResDao.insert(con, articleRes);
|
536
|
533
|
}
|
537
|
534
|
}
|
538
|
|
if(orgs!=null && orgs.length>0){
|
539
|
|
for(String org:orgs){
|
|
535
|
if (orgs != null && orgs.length > 0) {
|
|
536
|
for (String org : orgs) {
|
540
|
537
|
ArticleOrg articleOrg = new ArticleOrg();
|
541
|
538
|
articleOrg.setArticleId(articleId);
|
542
|
539
|
articleOrg.setOrgId(org);
|
|
@ -544,19 +541,19 @@ public class ArticleService {
|
544
|
541
|
}
|
545
|
542
|
}
|
546
|
543
|
return articleId;
|
547
|
|
}else if(article.getArticleId().trim().length() == 32){
|
548
|
|
if(article.getArticleImg() != null){
|
|
544
|
} else if (article.getArticleId().trim().length() == 32) {
|
|
545
|
if (article.getArticleImg() != null) {
|
549
|
546
|
this.saveArtImg(article.getArticleImg(), article.getArticleId());
|
550
|
|
article.setArticleImg(this.createDate()+"/"+article.getArticleId()+"."+JPG);
|
|
547
|
article.setArticleImg(this.createDate() + "/" + article.getArticleId() + "." + JPG);
|
551
|
548
|
}
|
552
|
549
|
this.articleDao.update(con, article);
|
553
|
550
|
this.articleDao.updatePublishTime(con, article.getArticleId(), "2", article.getPublishTime());
|
554
|
|
this.keyWordService.refreshArticle(con,article.getArticleId(), null);
|
|
551
|
this.keyWordService.refreshArticle(con, article.getArticleId(), null);
|
555
|
552
|
this.articleResDao.delete(con, article.getArticleId());
|
556
|
553
|
this.articleProDao.delete(con, article.getArticleId());
|
557
|
554
|
this.articleOrgDao.delete(con, article.getArticleId());
|
558
|
|
|
559
|
|
if(professors != null){
|
|
555
|
|
|
556
|
if (professors != null) {
|
560
|
557
|
for (String professor : professors) {
|
561
|
558
|
ArticlePro articlePro = new ArticlePro();
|
562
|
559
|
articlePro.setArticleId(article.getArticleId());
|
|
@ -564,7 +561,7 @@ public class ArticleService {
|
564
|
561
|
this.articleProDao.insert(con, articlePro);
|
565
|
562
|
}
|
566
|
563
|
}
|
567
|
|
if(resources != null){
|
|
564
|
if (resources != null) {
|
568
|
565
|
for (String resource : resources) {
|
569
|
566
|
ArticleRes articleRes = new ArticleRes();
|
570
|
567
|
articleRes.setArticleId(article.getArticleId());
|
|
@ -572,8 +569,8 @@ public class ArticleService {
|
572
|
569
|
this.articleResDao.insert(con, articleRes);
|
573
|
570
|
}
|
574
|
571
|
}
|
575
|
|
if(orgs!=null && orgs.length>0){
|
576
|
|
for(String org:orgs){
|
|
572
|
if (orgs != null && orgs.length > 0) {
|
|
573
|
for (String org : orgs) {
|
577
|
574
|
ArticleOrg articleOrg = new ArticleOrg();
|
578
|
575
|
articleOrg.setArticleId(article.getArticleId());
|
579
|
576
|
articleOrg.setOrgId(org);
|
|
@ -581,177 +578,179 @@ public class ArticleService {
|
581
|
578
|
}
|
582
|
579
|
}
|
583
|
580
|
return article.getArticleId();
|
584
|
|
}else{
|
|
581
|
} else {
|
585
|
582
|
throw new JfwBaseException(-2, "bad parameter:articleId");
|
586
|
583
|
}
|
587
|
584
|
}
|
588
|
|
|
|
585
|
|
589
|
586
|
@Post
|
590
|
587
|
@Path("/updateArt")
|
591
|
|
public void update(@JdbcConn(true) Connection con, Article article)
|
592
|
|
throws SQLException, JfwBaseException, IOException{
|
593
|
|
if(article.getArticleImg() != null){
|
|
588
|
public void update(@JdbcConn(true) Connection con, Article article) throws SQLException, JfwBaseException, IOException {
|
|
589
|
if (article.getArticleImg() != null) {
|
594
|
590
|
this.saveArtImg(article.getArticleImg(), article.getArticleId());
|
595
|
|
article.setArticleImg(this.createDate()+"/"+article.getArticleId()+"."+JPG);
|
|
591
|
article.setArticleImg(this.createDate() + "/" + article.getArticleId() + "." + JPG);
|
596
|
592
|
}
|
597
|
593
|
this.articleDao.update(con, article);
|
598
|
594
|
}
|
599
|
|
|
|
595
|
|
600
|
596
|
@Post
|
601
|
597
|
@Path("/pageViews")
|
602
|
|
public void pageViews(@JdbcConn(true) Connection con,String articleId) throws SQLException{
|
|
598
|
public void pageViews(@JdbcConn(true) Connection con, String articleId) throws SQLException {
|
603
|
599
|
this.articleDao.incPageViews(con, articleId);
|
604
|
600
|
}
|
605
|
|
|
|
601
|
|
606
|
602
|
@Post
|
607
|
603
|
@Path("/updateDraft")
|
608
|
|
public void updateDraft(@JdbcConn(true) Connection con, String articleId) throws SQLException{
|
609
|
|
//修改文章状态为草稿
|
|
604
|
public void updateDraft(@JdbcConn(true) Connection con, String articleId) throws SQLException {
|
|
605
|
// 修改文章状态为草稿
|
610
|
606
|
this.articleDao.updateStatus(con, articleId, "0");
|
611
|
|
this.keyWordService.refreshArticle(con,articleId,null);
|
|
607
|
this.keyWordService.refreshArticle(con, articleId, null);
|
612
|
608
|
}
|
613
|
|
|
|
609
|
|
614
|
610
|
@Post
|
615
|
611
|
@Path("/publish")
|
616
|
|
public void publish(@JdbcConn(true) Connection con,String articleId) throws SQLException{
|
617
|
|
//修改文章状态为发布
|
|
612
|
public void publish(@JdbcConn(true) Connection con, String articleId) throws SQLException {
|
|
613
|
// 修改文章状态为发布
|
618
|
614
|
this.articleDao.updateStatus(con, articleId, "1");
|
619
|
615
|
Article a = this.articleDao.queryOne(con, articleId);
|
620
|
|
if(a!=null){
|
621
|
|
this.keyWordService.refreshArticle(con,articleId,KeyWordService.splitKeyWord(a.getSubject()));
|
|
616
|
if (a != null) {
|
|
617
|
this.keyWordService.refreshArticle(con, articleId, KeyWordService.splitKeyWord(a.getSubject()));
|
622
|
618
|
}
|
623
|
619
|
}
|
624
|
|
|
|
620
|
|
625
|
621
|
@Post
|
626
|
622
|
@Path("/deleteArticle")
|
627
|
|
public void deleteArticle(@JdbcConn(true) Connection con,String articleId) throws SQLException{
|
628
|
|
//修改文章状态为删除
|
|
623
|
public void deleteArticle(@JdbcConn(true) Connection con, String articleId) throws SQLException {
|
|
624
|
// 修改文章状态为删除
|
629
|
625
|
this.articleDao.updateStatus(con, articleId, "3");
|
630
|
|
this.keyWordService.refreshArticle(con, articleId,null);
|
|
626
|
this.keyWordService.refreshArticle(con, articleId, null);
|
631
|
627
|
}
|
632
|
|
|
|
628
|
|
633
|
629
|
@Post
|
634
|
630
|
@Path("/close")
|
635
|
|
public void closeArticle(@JdbcConn(true) Connection con,String articleId) throws SQLException{
|
636
|
|
//修改文章状态为关闭
|
|
631
|
public void closeArticle(@JdbcConn(true) Connection con, String articleId) throws SQLException {
|
|
632
|
// 修改文章状态为关闭
|
637
|
633
|
this.articleDao.updateStatus(con, articleId, "4");
|
638
|
634
|
}
|
639
|
|
|
|
635
|
|
640
|
636
|
@Post
|
641
|
637
|
@Path("/agree")
|
642
|
|
public void agree(@JdbcConn(true) Connection con,String operateId,String articleId)throws SQLException{
|
643
|
|
if(this.articleDao.incAgree(con, articleId) > 0){
|
|
638
|
public void agree(@JdbcConn(true) Connection con, String operateId, String articleId) throws SQLException {
|
|
639
|
if (this.articleDao.incAgree(con, articleId) > 0) {
|
644
|
640
|
ArticleAgree articleAgree = new ArticleAgree();
|
645
|
641
|
articleAgree.setOperateId(operateId);
|
646
|
642
|
articleAgree.setArticleId(articleId);
|
647
|
643
|
this.articleAgreeDao.insert(con, articleAgree);
|
648
|
644
|
}
|
649
|
645
|
}
|
650
|
|
|
|
646
|
|
651
|
647
|
@Post
|
652
|
648
|
@Path("/unAgree")
|
653
|
|
public void unAgree(@JdbcConn(true) Connection con,String operateId,String articleId)throws SQLException{
|
654
|
|
if(this.articleDao.decAgree(con, articleId) > 0){
|
|
649
|
public void unAgree(@JdbcConn(true) Connection con, String operateId, String articleId) throws SQLException {
|
|
650
|
if (this.articleDao.decAgree(con, articleId) > 0) {
|
655
|
651
|
this.articleAgreeDao.deleteAgree(con, operateId, articleId);
|
656
|
652
|
}
|
657
|
653
|
}
|
658
|
|
|
|
654
|
|
659
|
655
|
@Get
|
660
|
656
|
@Path("/isAgree")
|
661
|
|
public ArticleAgree queryAgree(@JdbcConn Connection con,String operateId,String articleId)throws SQLException{
|
|
657
|
public ArticleAgree queryAgree(@JdbcConn Connection con, String operateId, String articleId) throws SQLException {
|
662
|
658
|
return this.articleAgreeDao.queryOne(con, operateId, articleId);
|
663
|
659
|
}
|
664
|
|
|
|
660
|
|
665
|
661
|
@Get
|
666
|
662
|
@Path("/agreeList")
|
667
|
|
public List<ArticleAgree> queryAgreeList(@JdbcConn Connection con,String articleId)throws SQLException{
|
|
663
|
public List<ArticleAgree> queryAgreeList(@JdbcConn Connection con, String articleId) throws SQLException {
|
668
|
664
|
return this.articleAgreeDao.query(con, articleId);
|
669
|
665
|
}
|
670
|
|
|
|
666
|
|
671
|
667
|
@Get
|
672
|
668
|
@Path("/qaPro")
|
673
|
|
public List<Article> queryPro(@JdbcConn Connection con, String professorId) throws SQLException{
|
|
669
|
public List<Article> queryPro(@JdbcConn Connection con, String professorId) throws SQLException {
|
674
|
670
|
return this.articleDao.queryPro(con, professorId);
|
675
|
671
|
}
|
676
|
|
|
|
672
|
|
677
|
673
|
@Get
|
678
|
674
|
@Path("/qaProPublish")
|
679
|
|
public List<Article> queryProPublish(@JdbcConn Connection con, String professorId) throws SQLException{
|
|
675
|
public List<Article> queryProPublish(@JdbcConn Connection con, String professorId) throws SQLException {
|
680
|
676
|
return this.articleDao.queryProPublish(con, professorId);
|
681
|
677
|
}
|
682
|
|
|
|
678
|
|
683
|
679
|
@Get
|
684
|
680
|
@Path("/pqProPublish")
|
685
|
|
public PageQueryResult<Article> pageQueryProPublish(@JdbcConn Connection con, String professorId,@DefaultValue("10") int pageSize,@DefaultValue("1") int pageNo) throws SQLException{
|
686
|
|
return this.articleDao.pageQueryProPublish(con, professorId,pageSize,pageNo);
|
|
681
|
public PageQueryResult<Article> pageQueryProPublish(@JdbcConn Connection con, String professorId, @DefaultValue("10") int pageSize,
|
|
682
|
@DefaultValue("1") int pageNo) throws SQLException {
|
|
683
|
return this.articleDao.pageQueryProPublish(con, professorId, pageSize, pageNo);
|
687
|
684
|
}
|
688
|
|
|
|
685
|
|
689
|
686
|
@Get
|
690
|
687
|
@Path("/qaForDesk")
|
691
|
|
public List<Article> queryForDesk(@JdbcConn Connection con, String professorId) throws SQLException{
|
|
688
|
public List<Article> queryForDesk(@JdbcConn Connection con, String professorId) throws SQLException {
|
692
|
689
|
return this.articleDao.queryForDesk(con, professorId);
|
693
|
690
|
}
|
694
|
|
|
|
691
|
|
695
|
692
|
@Get
|
696
|
693
|
@Path("/qaOrg")
|
697
|
|
public List<Article> queryOrg(@JdbcConn Connection con,String orgId)throws SQLException{
|
|
694
|
public List<Article> queryOrg(@JdbcConn Connection con, String orgId) throws SQLException {
|
698
|
695
|
return this.articleDao.queryOrg(con, orgId);
|
699
|
696
|
}
|
700
|
|
|
|
697
|
|
701
|
698
|
@Get
|
702
|
699
|
@Path("/qaOrgPublish")
|
703
|
|
public List<Article> queryOrgPublish(@JdbcConn Connection con,String orgId)throws SQLException{
|
|
700
|
public List<Article> queryOrgPublish(@JdbcConn Connection con, String orgId) throws SQLException {
|
704
|
701
|
return this.articleDao.queryOrgPublish(con, orgId);
|
705
|
702
|
}
|
706
|
|
|
|
703
|
|
707
|
704
|
@Get
|
708
|
705
|
@Path("/pqOrgPublish")
|
709
|
|
public PageQueryResult<Article> pageQueryOrgPublish(@JdbcConn Connection con,String orgId,@DefaultValue("10") int pageSize,@DefaultValue("1") int pageNo)throws SQLException{
|
710
|
|
return this.articleDao.pageQueryOrgPublish(con, orgId,pageSize,pageNo);
|
|
706
|
public PageQueryResult<Article> pageQueryOrgPublish(@JdbcConn Connection con, String orgId, @DefaultValue("10") int pageSize, @DefaultValue("1") int pageNo)
|
|
707
|
throws SQLException {
|
|
708
|
return this.articleDao.pageQueryOrgPublish(con, orgId, pageSize, pageNo);
|
711
|
709
|
}
|
712
|
|
|
|
710
|
|
713
|
711
|
@Get
|
714
|
712
|
@Path("/qlOrg")
|
715
|
|
public List<Article> queryLimitOrg(@JdbcConn Connection con,String orgId,@DefaultValue("com.ekexiu.portal.service.ArticleService.MAX_MODIFYTIME") String modifyTime,@DefaultValue("20") int rows)throws SQLException{
|
|
713
|
public List<Article> queryLimitOrg(@JdbcConn Connection con, String orgId,
|
|
714
|
@DefaultValue("com.ekexiu.portal.service.ArticleService.MAX_MODIFYTIME") String modifyTime, @DefaultValue("20") int rows) throws SQLException {
|
716
|
715
|
return this.articleDao.queryLimit(con, orgId, modifyTime, rows);
|
717
|
716
|
}
|
718
|
|
|
|
717
|
|
719
|
718
|
@Get
|
720
|
719
|
@Path("/query")
|
721
|
|
public Article queryOne(@JdbcConn Connection con, String articleId) throws SQLException{
|
|
720
|
public Article queryOne(@JdbcConn Connection con, String articleId) throws SQLException {
|
722
|
721
|
return this.articleDao.queryOne(con, articleId);
|
723
|
722
|
}
|
724
|
|
|
|
723
|
|
725
|
724
|
@Get
|
726
|
725
|
@Path("/pqpublish")
|
727
|
|
public PageQueryResult<Article> queryPagePublish(@JdbcConn Connection con,@Nullable String articleTitle,
|
728
|
|
@DefaultValue("10") int pageSize,@DefaultValue("1") int pageNo)throws SQLException{
|
729
|
|
if(articleTitle != null){
|
|
726
|
public PageQueryResult<Article> queryPagePublish(@JdbcConn Connection con, @Nullable String articleTitle, @DefaultValue("10") int pageSize,
|
|
727
|
@DefaultValue("1") int pageNo) throws SQLException {
|
|
728
|
if (articleTitle != null) {
|
730
|
729
|
articleTitle = "%" + articleTitle + "%";
|
731
|
730
|
}
|
732
|
731
|
return this.articleDao.queryPageForPublish(con, articleTitle, pageSize, pageNo);
|
733
|
732
|
}
|
734
|
|
|
|
733
|
|
735
|
734
|
@Get
|
736
|
735
|
@Path("/firstpq")
|
737
|
|
public PageQueryResult<Article> firstPageQuery(@JdbcConn Connection con,@Nullable String key,
|
738
|
|
@DefaultValue("20") int pageSize,@DefaultValue("1") int pageNo)throws SQLException{
|
739
|
|
if(key != null){
|
|
736
|
public PageQueryResult<Article> firstPageQuery(@JdbcConn Connection con, @Nullable String key, @DefaultValue("20") int pageSize,
|
|
737
|
@DefaultValue("1") int pageNo) throws SQLException {
|
|
738
|
if (key != null) {
|
740
|
739
|
key = "%" + key + "%";
|
741
|
740
|
}
|
742
|
741
|
PageQueryResult<Article> queryResult = this.articleDao.firstPageQuery(con, key, pageSize, pageNo);
|
743
|
742
|
List<Article> articles = queryResult.getData();
|
744
|
|
if(!articles.isEmpty()){
|
|
743
|
if (!articles.isEmpty()) {
|
745
|
744
|
for (Article article : articles) {
|
746
|
|
if("1".equals(article.getArticleType())){
|
|
745
|
if ("1".equals(article.getArticleType())) {
|
747
|
746
|
EditProfessor professor = this.professorDao.queryBaseInfo(con, article.getProfessorId());
|
748
|
|
if(professor != null){
|
|
747
|
if (professor != null) {
|
749
|
748
|
professor.setHasHeadImage(this.imageService.hasProfessorImage(professor.getId()));
|
750
|
749
|
}
|
751
|
750
|
article.setProfessor(professor);
|
752
|
|
}else if("2".equals(article.getArticleType())){
|
|
751
|
} else if ("2".equals(article.getArticleType())) {
|
753
|
752
|
EditOrganization organization = this.orgDao.queryEditOrg(con, article.getOrgId());
|
754
|
|
if(organization != null){
|
|
753
|
if (organization != null) {
|
755
|
754
|
organization.setHasOrgLogo(this.imageService.hasOrgLogo(organization.getId()));
|
756
|
755
|
}
|
757
|
756
|
article.setEditOrganization(organization);
|
|
@ -760,44 +759,45 @@ public class ArticleService {
|
760
|
759
|
}
|
761
|
760
|
return queryResult;
|
762
|
761
|
}
|
763
|
|
|
|
762
|
|
764
|
763
|
@Get
|
765
|
764
|
@Path("/pqself")
|
766
|
|
public PageQueryResult<Article> queryPageSelf(@JdbcConn Connection con,@Nullable String professorId,@Nullable String orgId,
|
767
|
|
@Nullable String articleTitle,@DefaultValue("10") int pageSize,@DefaultValue("1") int pageNo)throws SQLException{
|
768
|
|
if(articleTitle != null){
|
|
765
|
public PageQueryResult<Article> queryPageSelf(@JdbcConn Connection con, @Nullable String professorId, @Nullable String orgId, @Nullable String articleTitle,
|
|
766
|
@DefaultValue("10") int pageSize, @DefaultValue("1") int pageNo) throws SQLException {
|
|
767
|
if (articleTitle != null) {
|
769
|
768
|
articleTitle = "%" + articleTitle + "%";
|
770
|
769
|
}
|
771
|
770
|
return this.articleDao.queryPageForSelf(con, professorId, orgId, articleTitle, pageSize, pageNo);
|
772
|
771
|
}
|
773
|
|
|
|
772
|
|
774
|
773
|
@Get
|
775
|
774
|
@Path("/pqFind")
|
776
|
|
public PageQueryResult<FindInfo> queryPage(@JdbcConn Connection con,@DefaultValue("10") int pageSize,@DefaultValue("1") int pageNo)throws SQLException{
|
|
775
|
public PageQueryResult<FindInfo> queryPage(@JdbcConn Connection con, @DefaultValue("10") int pageSize, @DefaultValue("1") int pageNo) throws SQLException {
|
777
|
776
|
PageQueryResult<FindInfo> queryResult = this.articleDao.queryPage(con, pageSize, pageNo);
|
778
|
777
|
List<FindInfo> findInfos = queryResult.getData();
|
779
|
778
|
for (FindInfo findInfo : findInfos) {
|
780
|
|
if("3".equals(findInfo.getType())){
|
|
779
|
if ("3".equals(findInfo.getType())) {
|
781
|
780
|
List<Image> images = this.imagesService.queryRes(con, findInfo.getId());
|
782
|
|
if(images.size() > 0){
|
783
|
|
findInfo.setImage(findInfo.getId()+".jpg");
|
|
781
|
if (images.size() > 0) {
|
|
782
|
findInfo.setImage(findInfo.getId() + ".jpg");
|
784
|
783
|
}
|
785
|
784
|
}
|
786
|
785
|
}
|
787
|
786
|
queryResult.setData(findInfos);
|
788
|
787
|
return queryResult;
|
789
|
788
|
}
|
790
|
|
|
|
789
|
|
791
|
790
|
@Get
|
792
|
791
|
@Path("/findHot")
|
793
|
|
public PageQueryResult<FindInfo> queryFindHot(@JdbcConn Connection con,@DefaultValue("10") int pageSize,@DefaultValue("1") int pageNo)throws SQLException{
|
|
792
|
public PageQueryResult<FindInfo> queryFindHot(@JdbcConn Connection con, @DefaultValue("10") int pageSize, @DefaultValue("1") int pageNo)
|
|
793
|
throws SQLException {
|
794
|
794
|
PageQueryResult<FindInfo> queryResult = this.articleDao.queryFindHot(con, pageSize, pageNo);
|
795
|
795
|
List<FindInfo> findInfos = queryResult.getData();
|
796
|
|
if(!findInfos.isEmpty()){
|
|
796
|
if (!findInfos.isEmpty()) {
|
797
|
797
|
for (FindInfo findInfo : findInfos) {
|
798
|
|
if("3".equals(findInfo.getType()) || "4".equals(findInfo.getType())){
|
|
798
|
if ("3".equals(findInfo.getType()) || "4".equals(findInfo.getType())) {
|
799
|
799
|
List<Image> images = this.imagesService.queryRes(con, findInfo.getId());
|
800
|
|
if(images.size() > 0){
|
|
800
|
if (images.size() > 0) {
|
801
|
801
|
findInfo.setImage(images.get(0).getImageSrc());
|
802
|
802
|
}
|
803
|
803
|
}
|
|
@ -806,62 +806,117 @@ public class ArticleService {
|
806
|
806
|
}
|
807
|
807
|
return queryResult;
|
808
|
808
|
}
|
809
|
|
|
|
809
|
|
810
|
810
|
@Get
|
811
|
811
|
@Path("/ralatePro")
|
812
|
|
public List<ArticlePro> ralatePro(@JdbcConn Connection con,String articleId) throws SQLException{
|
|
812
|
public List<ArticlePro> ralatePro(@JdbcConn Connection con, String articleId) throws SQLException {
|
813
|
813
|
return this.articleProDao.query(con, articleId);
|
814
|
814
|
}
|
815
|
|
|
|
815
|
|
816
|
816
|
@Get
|
817
|
817
|
@Path("/ralateRes")
|
818
|
|
public List<ArticleRes> ralateRes(@JdbcConn Connection con,String articleId) throws SQLException{
|
|
818
|
public List<ArticleRes> ralateRes(@JdbcConn Connection con, String articleId) throws SQLException {
|
819
|
819
|
return this.articleResDao.query(con, articleId);
|
820
|
820
|
}
|
|
821
|
|
821
|
822
|
@Get
|
822
|
823
|
@Path("/ralateOrg")
|
823
|
|
public List<ArticleOrg> ralateOrg(@JdbcConn Connection con,String articleId) throws SQLException{
|
|
824
|
public List<ArticleOrg> ralateOrg(@JdbcConn Connection con, String articleId) throws SQLException {
|
824
|
825
|
return this.articleOrgDao.query(con, articleId);
|
825
|
|
}
|
826
|
|
|
827
|
|
|
|
826
|
}
|
|
827
|
|
828
|
828
|
@Get
|
829
|
829
|
@Path("/ralateArticles")
|
830
|
|
public List<Article> ralateArticles(@JdbcConn Connection con,@Nullable String[] keys,@Nullable String professorId,
|
831
|
|
@Nullable String orgId,String articleId,@DefaultValue("5") int rows)throws SQLException{
|
|
830
|
public List<Article> ralateArticles(@JdbcConn Connection con, @Nullable String[] keys, @Nullable String professorId, @Nullable String orgId,
|
|
831
|
String articleId, @DefaultValue("5") int rows) throws SQLException {
|
832
|
832
|
String[] ids = this.articleDao.queryArticleIdWithSameKeyWord(con, articleId, rows);
|
833
|
|
if(ids!=null){
|
834
|
|
return this.articleDao.query(con,ids);
|
|
833
|
if (ids != null) {
|
|
834
|
return this.articleDao.query(con, ids);
|
835
|
835
|
}
|
836
|
|
return Collections.<Article>emptyList();
|
837
|
|
// List<Article> articles = new ArrayList<Article>();
|
838
|
|
// if(keys != null){
|
839
|
|
// articles = this.articleDao.queryLimit(con, keys, articleId, rows);
|
840
|
|
// }
|
841
|
|
// if(articles.isEmpty()){
|
842
|
|
// articles = this.articleDao.queryByAuthor(con, professorId, orgId, articleId, rows);
|
843
|
|
// if(articles.isEmpty()){
|
844
|
|
// articles = this.articleDao.queryByPageViews(con, articleId, rows);
|
845
|
|
// }
|
846
|
|
// }
|
847
|
|
// return articles;
|
|
836
|
return Collections.<Article> emptyList();
|
|
837
|
// List<Article> articles = new ArrayList<Article>();
|
|
838
|
// if(keys != null){
|
|
839
|
// articles = this.articleDao.queryLimit(con, keys, articleId, rows);
|
|
840
|
// }
|
|
841
|
// if(articles.isEmpty()){
|
|
842
|
// articles = this.articleDao.queryByAuthor(con, professorId, orgId,
|
|
843
|
// articleId, rows);
|
|
844
|
// if(articles.isEmpty()){
|
|
845
|
// articles = this.articleDao.queryByPageViews(con, articleId, rows);
|
|
846
|
// }
|
|
847
|
// }
|
|
848
|
// return articles;
|
|
849
|
}
|
|
850
|
|
|
851
|
// @Post
|
|
852
|
// @Path("/delete")
|
|
853
|
// public void delete(@JdbcConn(true) Connection con, String articleId)
|
|
854
|
// throws SQLException{
|
|
855
|
// this.articleDao.delete(con, articleId);
|
|
856
|
// this.leaveWordDao.deleteArticle(con, articleId,LeaveWordService.ARTICLE);
|
|
857
|
// this.articleAgreeDao.delete(con, articleId);
|
|
858
|
// this.watchDao.deleteWatch(con, articleId);
|
|
859
|
// this.articleOrgDao.delete(con, articleId);
|
|
860
|
// this.articleProDao.delete(con, articleId);
|
|
861
|
// this.articleProDao.delete(con, articleId);
|
|
862
|
// }
|
|
863
|
|
|
864
|
@Get
|
|
865
|
@Path("/byAssProfessor")
|
|
866
|
public List<Article> byAssProfessor(@JdbcConn Connection con, String id, @DefaultValue("5") int rows) throws SQLException {
|
|
867
|
|
|
868
|
List<ArticlePro> pros = this.articleProDao.queryByProfessorId(con, id);
|
|
869
|
|
|
870
|
if (pros == null || pros.isEmpty()) {
|
|
871
|
return Collections.<Article> emptyList();
|
|
872
|
}
|
|
873
|
String[] ids = new String[pros.size()];
|
|
874
|
int i = 0;
|
|
875
|
for (ArticlePro ar : pros) {
|
|
876
|
ids[i++] = ar.getArticleId();
|
|
877
|
}
|
|
878
|
|
|
879
|
return this.articleDao.limitQueryPublish(con, ids, rows);
|
848
|
880
|
}
|
849
|
881
|
|
850
|
|
// @Post
|
851
|
|
// @Path("/delete")
|
852
|
|
// public void delete(@JdbcConn(true) Connection con, String articleId) throws SQLException{
|
853
|
|
// this.articleDao.delete(con, articleId);
|
854
|
|
// this.leaveWordDao.deleteArticle(con, articleId,LeaveWordService.ARTICLE);
|
855
|
|
// this.articleAgreeDao.delete(con, articleId);
|
856
|
|
// this.watchDao.deleteWatch(con, articleId);
|
857
|
|
// this.articleOrgDao.delete(con, articleId);
|
858
|
|
// this.articleProDao.delete(con, articleId);
|
859
|
|
// this.articleProDao.delete(con, articleId);
|
860
|
|
// }
|
861
|
|
|
|
882
|
@Get
|
|
883
|
@Path("/byAssOrg")
|
|
884
|
public List<Article> byAssOrg(@JdbcConn Connection con, String id, @DefaultValue("5") int rows) throws SQLException {
|
|
885
|
|
|
886
|
List<ArticleOrg> pros = this.articleOrgDao.queryByOrgId(con, id);
|
|
887
|
|
|
888
|
if (pros == null || pros.isEmpty()) {
|
|
889
|
return Collections.<Article> emptyList();
|
|
890
|
}
|
|
891
|
String[] ids = new String[pros.size()];
|
|
892
|
int i = 0;
|
|
893
|
for (ArticleOrg ar : pros) {
|
|
894
|
ids[i++] = ar.getArticleId();
|
|
895
|
}
|
|
896
|
|
|
897
|
return this.articleDao.limitQueryPublish(con, ids, rows);
|
|
898
|
}
|
|
899
|
@Get
|
|
900
|
@Path("/byAssResource")
|
|
901
|
public List<Article> byAssResource(@JdbcConn Connection con, String id, @DefaultValue("5") int rows) throws SQLException {
|
|
902
|
|
|
903
|
List<ArticleRes> pros = this.articleResDao.queryByResourceId(con, id);
|
|
904
|
|
|
905
|
if (pros == null || pros.isEmpty()) {
|
|
906
|
return Collections.<Article> emptyList();
|
|
907
|
}
|
|
908
|
String[] ids = new String[pros.size()];
|
|
909
|
int i = 0;
|
|
910
|
for (ArticleRes ar : pros) {
|
|
911
|
ids[i++] = ar.getArticleId();
|
|
912
|
}
|
|
913
|
|
|
914
|
return this.articleDao.limitQueryPublish(con, ids, rows);
|
|
915
|
}
|
|
916
|
|
862
|
917
|
@Path("/byShareId")
|
863
|
918
|
@Get
|
864
|
|
public Article query(@JdbcConn Connection con,long id) throws SQLException{
|
|
919
|
public Article query(@JdbcConn Connection con, long id) throws SQLException {
|
865
|
920
|
return this.articleDao.query(con, id);
|
866
|
921
|
}
|
867
|
922
|
|