Commit 28757503 authored by 周亚武's avatar 周亚武

小程序新闻列表接口

parent aa6f6fb5
...@@ -28,6 +28,11 @@ ...@@ -28,6 +28,11 @@
<profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr> <profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group> <profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace> <profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<profiles.rabbitmq.host>192.168.0.251</profiles.rabbitmq.host>
<profiles.rabbitmq.port>5672</profiles.rabbitmq.port>
<profiles.rabbitmq.username>root_mq</profiles.rabbitmq.username>
<profiles.rabbitmq.password>xhx@2022</profiles.rabbitmq.password>
<profiles.rabbitmq.virtualhost>/</profiles.rabbitmq.virtualhost>
<profiles.log.path>/home/mortals/app/logs</profiles.log.path> <profiles.log.path>/home/mortals/app/logs</profiles.log.path>
<profiles.log.level>info</profiles.log.level> <profiles.log.level>info</profiles.log.level>
<profiles.publish.path>/home/publish</profiles.publish.path> <profiles.publish.path>/home/publish</profiles.publish.path>
......
...@@ -18,6 +18,6 @@ public class NewsReq extends BaseReq { ...@@ -18,6 +18,6 @@ public class NewsReq extends BaseReq {
/** /**
* 分类id * 分类id
*/ */
private Long categoryId; private Long newsCategoryId;
} }
...@@ -13,6 +13,8 @@ import com.mortals.xhx.base.system.user.service.UserService; ...@@ -13,6 +13,8 @@ import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.busiz.applets.req.NewsReq; import com.mortals.xhx.busiz.applets.req.NewsReq;
import com.mortals.xhx.busiz.applets.rsp.NewsListInfo; import com.mortals.xhx.busiz.applets.rsp.NewsListInfo;
import com.mortals.xhx.common.utils.BeanUtil; import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.module.category.model.CategoryQuery;
import com.mortals.xhx.module.category.service.CategoryService;
import com.mortals.xhx.module.dept.model.DeptQuery; import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.service.DeptService; import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.news.model.NewsCategoryQuery; import com.mortals.xhx.module.news.model.NewsCategoryQuery;
...@@ -21,6 +23,7 @@ import com.mortals.xhx.module.news.model.NewsQuery; ...@@ -21,6 +23,7 @@ import com.mortals.xhx.module.news.model.NewsQuery;
import com.mortals.xhx.module.news.service.NewsCategoryService; import com.mortals.xhx.module.news.service.NewsCategoryService;
import com.mortals.xhx.module.news.service.NewsService; import com.mortals.xhx.module.news.service.NewsService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -60,6 +63,7 @@ public class NewsApiController extends AbstractBaseController<NewsReq> { ...@@ -60,6 +63,7 @@ public class NewsApiController extends AbstractBaseController<NewsReq> {
@Autowired @Autowired
private UserService userService; private UserService userService;
protected void init(Map<String, Object> model, Context context) { protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "top", paramService.getParamBySecondOrganize("News", "top")); this.addDict(model, "top", paramService.getParamBySecondOrganize("News", "top"));
this.addDict(model, "viewNums", paramService.getParamBySecondOrganize("News", "viewNums")); this.addDict(model, "viewNums", paramService.getParamBySecondOrganize("News", "viewNums"));
...@@ -69,10 +73,27 @@ public class NewsApiController extends AbstractBaseController<NewsReq> { ...@@ -69,10 +73,27 @@ public class NewsApiController extends AbstractBaseController<NewsReq> {
} }
/**
* 新闻频道分类
*/
@PostMapping(value = "categoryList")
public Rest<Object> categoryList(){
String busiDesc = "新闻频道";
Rest<Object> rest = Rest.ok();
try {
rest.setData(newsCategoryService.find(new NewsCategoryQuery()));
}catch (Exception e) {
log.error(busiDesc, e);
rest = Rest.fail(super.convertException(e));
}
return rest;
}
/** /**
* 新闻列表 * 新闻列表
*/ */
@PostMapping(value = "list") @PostMapping(value = "newsList")
public Rest<Object> newsList(@RequestBody NewsReq newsReq) { public Rest<Object> newsList(@RequestBody NewsReq newsReq) {
String busiDesc = "新闻列表"; String busiDesc = "新闻列表";
log.info("【{}】【请求体】--> {}", busiDesc, JSONObject.toJSONString(newsReq)); log.info("【{}】【请求体】--> {}", busiDesc, JSONObject.toJSONString(newsReq));
...@@ -86,8 +107,8 @@ public class NewsApiController extends AbstractBaseController<NewsReq> { ...@@ -86,8 +107,8 @@ public class NewsApiController extends AbstractBaseController<NewsReq> {
PageInfo pageInfo = buildPageInfo(newsReq); PageInfo pageInfo = buildPageInfo(newsReq);
NewsQuery query = new NewsQuery(); NewsQuery query = new NewsQuery();
if(!ObjectUtils.isEmpty(newsReq.getCategoryId())){ if(!ObjectUtils.isEmpty(newsReq.getNewsCategoryId())){
query.setCategoryId(newsReq.getCategoryId()); query.setCategoryId(newsReq.getNewsCategoryId());
} }
query.setOrderColList(Arrays.asList(new OrderCol("createTime", OrderCol.DESCENDING))); query.setOrderColList(Arrays.asList(new OrderCol("createTime", OrderCol.DESCENDING)));
...@@ -113,7 +134,7 @@ public class NewsApiController extends AbstractBaseController<NewsReq> { ...@@ -113,7 +134,7 @@ public class NewsApiController extends AbstractBaseController<NewsReq> {
/** /**
* 新闻详细 * 新闻详细
*/ */
@PostMapping(value = "info") @PostMapping(value = "newsInfo")
public Rest<NewsEntity> appealInfo(@RequestBody NewsReq newsReq) { public Rest<NewsEntity> appealInfo(@RequestBody NewsReq newsReq) {
String busiDesc = "新闻详细"; String busiDesc = "新闻详细";
log.info("【{}】【请求体】--> {}", busiDesc, JSONObject.toJSONString(newsReq)); log.info("【{}】【请求体】--> {}", busiDesc, JSONObject.toJSONString(newsReq));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment