|
|
@@ -47,7 +47,7 @@ public class AdminNewsApiController extends BaseApiController {
|
|
|
@Autowired
|
|
|
private JDBCIdGenerator idGenerator;
|
|
|
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 新闻列表
|
|
|
*/
|
|
|
@@ -56,7 +56,7 @@ public class AdminNewsApiController extends BaseApiController {
|
|
|
String source, Integer hot, String pageSize, String pageNo,String auditStatus,String releaseStatus,String publishPage) {
|
|
|
Result res = new Result();
|
|
|
// if (null == type) {
|
|
|
-// res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "新闻类型"));
|
|
|
+// res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "新闻类型"));
|
|
|
// return res;
|
|
|
// }
|
|
|
Integer pNo = 1;
|
|
|
@@ -67,7 +67,7 @@ public class AdminNewsApiController extends BaseApiController {
|
|
|
if (StringUtils.isNumeric(pageNo)) {
|
|
|
pNo = Integer.parseInt(pageNo);
|
|
|
}
|
|
|
- res.setData(newsService.listNews(type, title, author, startCreateTime, endCreateTime, source, hot, pNo, pSize,auditStatus,releaseStatus,publishPage,null));
|
|
|
+ res.setData(newsService.listNews(type, title, author, startCreateTime, endCreateTime, source, hot, pNo, pSize,auditStatus,releaseStatus,publishPage,null));
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
@@ -86,13 +86,13 @@ public class AdminNewsApiController extends BaseApiController {
|
|
|
if (!res.getError().isEmpty()) {
|
|
|
return res;
|
|
|
}
|
|
|
- newsService.save(idGenerator.generateId(), (News) res.getData());
|
|
|
+ newsService.save(idGenerator.generateId(), (News) res.getData());
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/*
|
|
|
* 新增
|
|
|
- *
|
|
|
+ *
|
|
|
* */
|
|
|
@RequestMapping(value="/apply",method=RequestMethod.POST)
|
|
|
public Result apply(@Valid InputNews news,BindingResult bindingResult,String[] publishPages) {
|
|
|
@@ -100,7 +100,7 @@ public Result apply(@Valid InputNews news,BindingResult bindingResult,String[] p
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
result.getError().add(
|
|
|
buildErrorByMsg(bindingResult.getFieldError()
|
|
|
- .getDefaultMessage(), NewsFields
|
|
|
+ .getDefaultMessage(), NewsFields
|
|
|
.getFieldDesc(bindingResult.getFieldError()
|
|
|
.getField())));
|
|
|
return result;
|
|
|
@@ -121,22 +121,22 @@ public Result apply(@Valid InputNews news,BindingResult bindingResult,String[] p
|
|
|
if(news.getType()==null)
|
|
|
news.setType(0);
|
|
|
BeanUtils.copyProperties(news, news2);
|
|
|
- result.setData(newsService.save( news2,webPages,appPages));
|
|
|
+ result.setData(newsService.save( news2,webPages,appPages));
|
|
|
return result;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/*
|
|
|
* 修改
|
|
|
- *
|
|
|
+ *
|
|
|
* */
|
|
|
@RequestMapping(value="/updateNews",method=RequestMethod.POST)
|
|
|
public Result updateNews(@Valid InputNews news,BindingResult bindingResult,String[] publishPages) {
|
|
|
Result result=new Result();
|
|
|
-
|
|
|
+
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
result.getError().add(
|
|
|
buildErrorByMsg(bindingResult.getFieldError()
|
|
|
- .getDefaultMessage(), NewsFields
|
|
|
+ .getDefaultMessage(), NewsFields
|
|
|
.getFieldDesc(bindingResult.getFieldError()
|
|
|
.getField())));
|
|
|
return result;
|
|
|
@@ -150,15 +150,24 @@ public Result apply(@Valid InputNews news,BindingResult bindingResult,String[] p
|
|
|
}
|
|
|
news.setCreateTime(new Date());
|
|
|
if(news.getAuditStatus() == 2) {
|
|
|
- news.setReleaseDate(new Date());
|
|
|
+ if (news.getReleaseDateStr() !=null){
|
|
|
+ try {
|
|
|
+ news.setReleaseDate(DateUtils.parseDate(news.getReleaseDateStr(),AFTConstants.YYYYMMDDHHMMSS));
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ news.setReleaseDate(new Date());
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
News news2=new News();
|
|
|
BeanUtils.copyProperties(news, news2);
|
|
|
- result.setData(newsService.updateSelectively( news2,webPages,appPages));
|
|
|
+ result.setData(newsService.updateSelectively( news2,webPages,appPages));
|
|
|
//publishPages
|
|
|
return result;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
/*
|
|
|
* 变更发布状态、发布时间
|
|
|
@@ -183,10 +192,10 @@ public Result apply(@Valid InputNews news,BindingResult bindingResult,String[] p
|
|
|
}
|
|
|
news.setReleaseDate(new Date());}
|
|
|
if(auditStatus!=null) {
|
|
|
- news.setAuditStatus(auditStatus);
|
|
|
+ news.setAuditStatus(auditStatus);
|
|
|
if(auditStatus ==2){
|
|
|
news.setReleaseDate(new Date());
|
|
|
-
|
|
|
+
|
|
|
newsService.updateJtCollectSearch(news);
|
|
|
newsService.addJtCollectSearch(news);
|
|
|
}
|
|
|
@@ -194,13 +203,13 @@ public Result apply(@Valid InputNews news,BindingResult bindingResult,String[] p
|
|
|
newsService.updateJtCollectSearch(news);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- result.setData(newsService.updateSelectivelyWithoutPages(news));
|
|
|
+
|
|
|
+ result.setData(newsService.updateSelectivelyWithoutPages(news));
|
|
|
return result;
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
private void checkApplyParams(InputNews news, List<String>webPages,List<String>appPages, Result result) {
|
|
|
/*if(webPages.size()<1 && appPages.size()<1)
|
|
|
{
|
|
|
@@ -224,7 +233,7 @@ public Result apply(@Valid InputNews news,BindingResult bindingResult,String[] p
|
|
|
result.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","是否热门"));
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -262,7 +271,7 @@ public Result apply(@Valid InputNews news,BindingResult bindingResult,String[] p
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "新闻Id"));
|
|
|
return res;
|
|
|
}
|
|
|
- res.setData(newsService.findNewsDetail(id));
|
|
|
+ res.setData(newsService.findNewsDetail(id));
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
@@ -288,7 +297,7 @@ public Result apply(@Valid InputNews news,BindingResult bindingResult,String[] p
|
|
|
if (id == null) {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
|
|
|
} else {
|
|
|
- res.setData(newsService.deleteByPrimaryKey(id));
|
|
|
+ res.setData(newsService.deleteByPrimaryKey(id));
|
|
|
}
|
|
|
return res;
|
|
|
}
|
|
|
@@ -331,7 +340,7 @@ public Result apply(@Valid InputNews news,BindingResult bindingResult,String[] p
|
|
|
}
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
private Result disposeInputNews(Result res, InputNews news, String createTimeFormattedDate) {
|
|
|
if (StringUtils.isBlank(news.getTitle())) {
|