Commit 1e8c9bec by rongkailun

【新增】热点关注、规章制度、中央和总局精神

parent fd0b17b8
package io.office.modules.manage.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.manage.entity.TopicnewsEntity;
import io.office.modules.manage.entity.dto.NewsParams;
import io.office.modules.manage.service.TopicnewsService;
import io.office.modules.sys.controller.AbstractController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author rkl
* @description 中央和总局精神
* @date 2021/11/04
*/
@RestController
@RequestMapping("/center")
@Slf4j
public class CenterController extends AbstractController {
@Autowired
private TopicnewsService topicnewsService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("generator:topicnews:list")
public R list(@RequestBody NewsParams newsParams){
newsParams.setClassId(429);
Page<NewsEntity> page = this.topicnewsService.selectTopicList(newsParams,
new Page(newsParams.getPage(),newsParams.getLimit()));
PageUtils pageUtils = new PageUtils(page);
return R.ok().put("page", pageUtils);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
// @RequiresPermissions("generator:topicnews:info")
public R info(@PathVariable("id") Integer id){
TopicnewsEntity topicnews = topicnewsService.getById(id);
return R.ok().put("topicnews", topicnews);
}
/**
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("generator:topicnews:save")
public R save(@RequestBody NewsEntity news){
try {
news.setClassid(429);
R r = this.topicnewsService.insertHdbd(news, getUser());
return r;
} catch (Exception e) {
log.error("insertHdbd error:", e);
return R.error(e.getMessage());
}
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("generator:topicnews:update")
public R update(@RequestBody NewsEntity news){
try {
R r = this.topicnewsService.updateHdbd(news, getUser());
return r;
} catch (Exception e) {
log.error("update error:", e);
return R.error(e.getMessage());
}
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("generator:topicnews:delete")
public R delete(@RequestBody List<Long> ids){
try {
R r = this.topicnewsService.deleteHdbd(ids, getUser());
return r;
} catch (Exception e) {
log.error("delete error:", e);
return R.error(e.getMessage());
}
}
/**
* 审核
*/
@PostMapping("/verifyTopic")
// @RequiresPermissions("manage:news:verify")
public R verify(@RequestBody NewsEntity news) {
try {
R r = this.topicnewsService.verifyTopic(news,getUser());
return r;
} catch (Exception e) {
log.error("verifyTopic error:", e);
return R.error(e.getMessage());
}
}
}
package io.office.modules.manage.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.manage.entity.TopicnewsEntity;
import io.office.modules.manage.entity.dto.NewsParams;
import io.office.modules.manage.service.TopicnewsService;
import io.office.modules.sys.controller.AbstractController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author rkl
* @description 热点关注
* @date 2021/11/04
*/
@RestController
@RequestMapping("/hotFlow")
@Slf4j
public class HotFollowController extends AbstractController {
@Autowired
private TopicnewsService topicnewsService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("generator:topicnews:list")
public R list(@RequestBody NewsParams newsParams){
newsParams.setClassId(435);
Page<NewsEntity> page = this.topicnewsService.selectTopicList(newsParams,
new Page(newsParams.getPage(),newsParams.getLimit()));
PageUtils pageUtils = new PageUtils(page);
return R.ok().put("page", pageUtils);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
// @RequiresPermissions("generator:topicnews:info")
public R info(@PathVariable("id") Integer id){
TopicnewsEntity topicnews = topicnewsService.getById(id);
return R.ok().put("topicnews", topicnews);
}
/**
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("generator:topicnews:save")
public R save(@RequestBody NewsEntity news){
try {
news.setClassid(435);
R r = this.topicnewsService.insertHdbd(news, getUser());
return r;
} catch (Exception e) {
log.error("insertHdbd error:", e);
return R.error(e.getMessage());
}
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("generator:topicnews:update")
public R update(@RequestBody NewsEntity news){
try {
R r = this.topicnewsService.updateHdbd(news, getUser());
return r;
} catch (Exception e) {
log.error("update error:", e);
return R.error(e.getMessage());
}
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("generator:topicnews:delete")
public R delete(@RequestBody List<Long> ids){
try {
R r = this.topicnewsService.deleteHdbd(ids, getUser());
return r;
} catch (Exception e) {
log.error("delete error:", e);
return R.error(e.getMessage());
}
}
/**
* 审核
*/
@PostMapping("/verifyTopic")
// @RequiresPermissions("manage:news:verify")
public R verify(@RequestBody NewsEntity news) {
try {
R r = this.topicnewsService.verifyTopic(news,getUser());
return r;
} catch (Exception e) {
log.error("verifyTopic error:", e);
return R.error(e.getMessage());
}
}
}
package io.office.modules.manage.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.manage.entity.TopicnewsEntity;
import io.office.modules.manage.entity.dto.NewsParams;
import io.office.modules.manage.service.TopicnewsService;
import io.office.modules.sys.controller.AbstractController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author rkl
* @description
* @date 2021/11/04
*/
@RestController
@RequestMapping("/rules")
@Slf4j
public class RulesAndRegulationsController extends AbstractController {
@Autowired
private TopicnewsService topicnewsService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("generator:topicnews:list")
public R list(@RequestBody NewsParams newsParams){
newsParams.setClassId(430);
Page<NewsEntity> page = this.topicnewsService.selectTopicList(newsParams,
new Page(newsParams.getPage(),newsParams.getLimit()));
PageUtils pageUtils = new PageUtils(page);
return R.ok().put("page", pageUtils);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
// @RequiresPermissions("generator:topicnews:info")
public R info(@PathVariable("id") Integer id){
TopicnewsEntity topicnews = topicnewsService.getById(id);
return R.ok().put("topicnews", topicnews);
}
/**
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("generator:topicnews:save")
public R save(@RequestBody NewsEntity news){
try {
news.setClassid(430);
R r = this.topicnewsService.insertHdbd(news, getUser());
return r;
} catch (Exception e) {
log.error("insertHdbd error:", e);
return R.error(e.getMessage());
}
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("generator:topicnews:update")
public R update(@RequestBody NewsEntity news){
try {
R r = this.topicnewsService.updateHdbd(news, getUser());
return r;
} catch (Exception e) {
log.error("update error:", e);
return R.error(e.getMessage());
}
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("generator:topicnews:delete")
public R delete(@RequestBody List<Long> ids){
try {
R r = this.topicnewsService.deleteHdbd(ids, getUser());
return r;
} catch (Exception e) {
log.error("delete error:", e);
return R.error(e.getMessage());
}
}
/**
* 审核
*/
@PostMapping("/verifyTopic")
// @RequiresPermissions("manage:news:verify")
public R verify(@RequestBody NewsEntity news) {
try {
R r = this.topicnewsService.verifyTopic(news,getUser());
return r;
} catch (Exception e) {
log.error("verifyTopic error:", e);
return R.error(e.getMessage());
}
}
}
package io.office.modules.manage.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
......@@ -98,7 +99,7 @@ public class NewsEntity implements Serializable {
* 分类id
*/
private Integer classid;
@TableField(exist = false)
private Integer cclassid;
/**
* 出版时间
......
......@@ -29,4 +29,5 @@ public class NewsParams extends PageParams {
private Date updateTimeStart;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTimeEnd;
private Integer classId;
}
......@@ -46,10 +46,10 @@ public class TopicnewsServiceImpl extends ServiceImpl<TopicnewsDao, TopicnewsEnt
private NewsService newsService;
@Override
public R insertHdbd(NewsEntity news, SysUserEntity user) {
news.setCclassid(35);
newsService.insertNews(news,user);
TopicnewsEntity topicnewsEntity = new TopicnewsEntity();
topicnewsEntity.setClassid(428);
topicnewsEntity.setClassid(news.getClassid());
news.setClassid(35);
newsService.insertNews(news,user);
topicnewsEntity.setNewsid(news.getId());
topicnewsEntity.setNewslevels(news.getLevels());
topicnewsEntity.setTime(new Date());
......@@ -97,6 +97,7 @@ public class TopicnewsServiceImpl extends ServiceImpl<TopicnewsDao, TopicnewsEnt
@Override
public Page<NewsEntity> selectTopicList(NewsParams newsParams, Page page) {
newsParams.setClassId(newsParams.getClassId());
List<NewsEntity> newsList = this.topicnewsDao.selectTopicList(newsParams, page);
page.setRecords(newsList);
return page;
......
......@@ -32,7 +32,7 @@
TopIcNews AS a
LEFT JOIN news AS b ON a.newsid = b.id
WHERE
a.classid = 428
a.classid = #{newsParams.classId}
AND levels > 0
ORDER BY
levels DESC,
......
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