Commit d47fbb64 by 吴迪

【新增】

parent f0150759
package io.office.modules.manage.controller;
import java.util.List;
import java.util.Map;
......@@ -180,6 +179,7 @@ public class NewsController extends AbstractController {
PageUtils pageUtils = new PageUtils(page);
return R.ok().put("data", pageUtils);
}
/**
* 医疗卫生
*/
......@@ -199,6 +199,7 @@ public class NewsController extends AbstractController {
@Lazy
@Autowired
MedicalService medicalService;
@Login
@GetMapping("/api/medicalInfo/{id}")
public R medicalInfo(@PathVariable("id") String id) {
......@@ -218,6 +219,7 @@ public class NewsController extends AbstractController {
PageUtils pageUtils = new PageUtils(page);
return R.ok().put("data", pageUtils);
}
/**
* 其他
*/
......@@ -230,6 +232,7 @@ public class NewsController extends AbstractController {
PageUtils pageUtils = new PageUtils(page);
return R.ok().put("data", pageUtils);
}
/**
* 食品安全追溯
*/
......@@ -262,6 +265,7 @@ public class NewsController extends AbstractController {
@Lazy
@Autowired
LogisticsService logisticsService;
@Login
@GetMapping("/api/logostocsList/{id}")
public R logostocsList(@PathVariable("id") String id) {
......@@ -269,7 +273,9 @@ public class NewsController extends AbstractController {
return R.ok().put("data", logisticsEntity);
}
/**应用动态*/
/**
* 应用动态
*/
@Login
@PostMapping("/api/yydtList")
public R yydtList(@RequestBody NewsParams newsParams) {
......@@ -278,7 +284,10 @@ public class NewsController extends AbstractController {
PageUtils pageUtils = new PageUtils(page);
return R.ok().put("data", pageUtils);
}
/**视频在线*/
/**
* 视频在线
*/
@Login
@PostMapping("/api/spList")
public R spList(@RequestBody NewsParams newsParams) {
......@@ -288,7 +297,9 @@ public class NewsController extends AbstractController {
return R.ok().put("data", pageUtils);
}
/**公共通知*/
/**
* 公共通知
*/
@Login
@PostMapping("/api/announceList")
public R announceList(@RequestBody NewsParams newsParams) {
......@@ -297,7 +308,10 @@ public class NewsController extends AbstractController {
PageUtils pageUtils = new PageUtils(page);
return R.ok().put("data", pageUtils);
}
/**公共通知详情*/
/**
* 公共通知详情
*/
@Autowired
AnnounceService announceService;
......@@ -308,7 +322,9 @@ public class NewsController extends AbstractController {
return R.ok().put("data", announceEntity);
}
/**左侧标准文档*/
/**
* 左侧标准文档
*/
@Login
@PostMapping("/api/xgbzList")
public R xgbzList(@RequestBody NewsParams newsParams) {
......@@ -318,15 +334,19 @@ public class NewsController extends AbstractController {
return R.ok().put("data", pageUtils);
}
/**右侧标准文档*/
/**
* 右侧标准文档
*/
@Login
@PostMapping("/api/ycxgbzList")
public R ycxgbzList(@RequestBody NewsParams newsParams) {
List<PolicyEntity> list = this.newsService.ycxgbzList();
List<PolicyEntity> list = this.newsService.ycxgbzList();
return R.ok().put("data", list);
}
/**政策法规*/
/**
* 政策法规
*/
@Login
@PostMapping("/api/zcfgList")
public R zcfgList(@RequestBody NewsParams newsParams) {
......@@ -335,14 +355,20 @@ public class NewsController extends AbstractController {
PageUtils pageUtils = new PageUtils(page);
return R.ok().put("data", pageUtils);
}
/**专业术语*/
/**
* 专业术语
*/
@Login
@PostMapping("/api/glossaryList")
public R glossaryList(@RequestBody NewsParams newsParams) {
List<GlossaryEntity> list = this.newsService.glossaryList(newsParams);
List<GlossaryEntity> list = this.newsService.glossaryList(newsParams);
return R.ok().put("data", list);
}
/**小贴士*/
/**
* 小贴士
*/
@Login
@PostMapping("/api/tips")
public R tips(NewsParams newsParams) {
......@@ -350,47 +376,63 @@ public class NewsController extends AbstractController {
return R.ok().put("data", list);
}
/**知识检索*/
/**
* 知识检索
*/
@Login
@PostMapping("/api/searchKnowledgeInfo")
public R searchKnowledgeInfo(@RequestBody NewsParams newsParams) {
Map<String,Object> retMap = this.newsService.searchKnowledgeInfo(newsParams);
Map<String, Object> retMap = this.newsService.searchKnowledgeInfo(newsParams);
return R.ok().put("data", retMap);
}
/**知识检索下来分类*/
/**
* 知识检索下来分类
*/
@Login
@PostMapping("/api/searchKnowledgeInfoList")
public R searchKnowledgeInfoList() {
List<Map<String,Object>> retMap = this.newsService.searchKnowledgeInfoList();
List<Map<String, Object>> retMap = this.newsService.searchKnowledgeInfoList();
return R.ok().put("data", retMap);
}
/**热点点击*/
/**
* 热点点击
*/
@Login
@GetMapping("/api/hotList")
public R hotList() {
List<Map<String,Object>> retMap = this.newsService.hotList();
List<Map<String, Object>> retMap = this.newsService.hotList();
return R.ok().put("data", retMap);
}
@Autowired
@Lazy
KnowledgeinfoService knowledgeinfoService;
/**查看*/
/**
* 查看
*/
@Login
@GetMapping("/api/knowledgeinfo/{id}")
public R getInfo(@PathVariable("id") Integer id) {
KnowledgeinfoEntity retMap = this.knowledgeinfoService.getById(id);
return R.ok().put("data", retMap);
}
/**资讯排行TOP10*/
@Login
@GetMapping("/api/newsTop10")
KnowledgeinfoEntity retMap = this.knowledgeinfoService.getById(id);
return R.ok().put("data", retMap);
}
/**
* 资讯排行TOP10
*/
@Login
@GetMapping("/api/newsTop10")
public R newsTop10() {
List<NewsEntity> list = this.newsService.newsTop10();
return R.ok().put("data", list);
}
/**知识检索分页列表*/
/**
* 知识检索分页列表
*/
@Login
@PostMapping("/api/searchKnowledgePageList")
public R searchKnowledgePageList(@RequestBody NewsParams params) {
......@@ -401,7 +443,9 @@ public class NewsController extends AbstractController {
}
/**党史学习教育专栏*/
/**
* 党史学习教育专栏
*/
@Login
@GetMapping("/api/dsxxjyTop8")
public R dsxxjyTop8() {
......@@ -410,7 +454,9 @@ public class NewsController extends AbstractController {
}
/**中央和总局精神*/
/**
* 中央和总局精神
*/
@Login
@GetMapping("/api/centerTop6")
public R centerTop6() {
......@@ -419,7 +465,9 @@ public class NewsController extends AbstractController {
}
/**规章制度top7*/
/**
* 规章制度top7
*/
@Login
@GetMapping("/api/gzzdTop7")
public R gzzdTop7() {
......@@ -428,7 +476,9 @@ public class NewsController extends AbstractController {
}
/**图片资讯上方*/
/**
* 图片资讯上方
*/
@Login
@GetMapping("/api/pictureTop4")
public R pictureTop4() {
......@@ -437,7 +487,9 @@ public class NewsController extends AbstractController {
}
/**上月资讯排行*/
/**
* 上月资讯排行
*/
@Login
@GetMapping("/api/syzxphList")
public R syzxphList() {
......@@ -445,27 +497,36 @@ public class NewsController extends AbstractController {
return R.ok().put("data", list);
}
/**专题推荐*/
/**
* 专题推荐
*/
@Login
@GetMapping("/api/zttjList")
public R zttjList() {
List<NewtopicEntity> list = this.newsService.zttjList();
return R.ok().put("data", list);
}
@Autowired
@Lazy
NewtopicService newtopicService;
/**专题推荐*/
/**
* 专题推荐
*/
@Login
@GetMapping("/api/newsTopicInfo/{id}")
public R newsTopicInfo(@PathVariable("id") String id) {
NewtopicEntity newtopic = newtopicService.getById(id);
return R.ok().put("data", newtopic);
}
/**相关链接*/
/**
* 相关链接
*/
@Login
@GetMapping("/api/relatedLinks")
public R relatedLinks(@RequestParam Map<String,Object> params) {
public R relatedLinks(@RequestParam Map<String, Object> params) {
List<NewsEntity> list = this.newsService.relatedLinks(params);
return R.ok().put("data", list);
}
......@@ -473,8 +534,8 @@ public class NewsController extends AbstractController {
@Login
@RequestMapping("/api/getSearchInfo")
// @RequiresPermissions("manage:product:findPage")
public R getSearchInfo(@RequestBody Map<String,String> param){
Page<SearchVo> pag = this.newsService.getSearchInfo(param.get("name")==null?null:param.get("page"),
public R getSearchInfo(@RequestBody Map<String, String> param) {
Page<SearchVo> pag = this.newsService.getSearchInfo(param.get("name") == null ? null : param.get("name"),
new Page(Integer.valueOf(param.get("page")),
Integer.valueOf(param.get("size"))));
PageUtils pageUtils = new PageUtils(pag);
......@@ -482,5 +543,4 @@ public class NewsController extends AbstractController {
}
}
......@@ -7,6 +7,7 @@ import io.office.modules.manage.entity.*;
import io.office.modules.manage.entity.dto.NewsParams;
import io.office.modules.manage.vo.response.SearchVo;
import io.office.modules.sys.entity.SysUserEntity;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -543,6 +544,13 @@ public class NewsServiceImpl extends ServiceImpl<NewsDao, NewsEntity> implements
@Override
public Page<SearchVo> getSearchInfo(String name, Page page) {
List<SearchVo> list = this.newsDao.getSearchInfo(name, page);
if(CollectionUtils.isNotEmpty(list)) {
for (SearchVo searchVo : list) {
if(StringUtils.isNotBlank(searchVo.getContent())) {
searchVo.setContent("");
}
}
}
page.setRecords(list);
return page;
}
......
package io.office.modules.manage.utils;
import com.qiniu.util.Md5;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
/**
* 
 @description:
*
* @author wudi
* @date 10:47 2021/12/13
*/
@Component
public class LogUtils {
private static LogUtils logUtils;
private static Logger logger = null;
private static String switchStr = "Y";
private static boolean switchBoolean = false;
private LogUtils() {
logger = LoggerFactory.getLogger(LogUtils.class);
if (StringUtils.isNotBlank(switchStr) && switchStr.equalsIgnoreCase("Y")) {
switchBoolean = true;
}
}
// 使用 synchronized 修饰,临界资源的同步互斥访问
public static synchronized LogUtils getLogUtils() {
if (logUtils == null) {
logUtils = new LogUtils();
}
return logUtils;
}
public void printTime(Class clzss,String message, Long time) {
if (switchBoolean) {
logger.info("kafka >> [{}] [{}] 耗时:{} ms",clzss, message, System.currentTimeMillis() - time);
Runnable task = () -> {
System.out.println("记录日志.......");
};
Thread thread = new Thread(task);
thread.start();
}
}
public Long printCurrentTime(Class clzss) {
Long currentTime = System.currentTimeMillis();
if (switchBoolean) {
logger.info("kafka >> [{}] 当前时间:{}", clzss,currentTime);
}
return currentTime;
}
public void printMessage(String var1, Object... var2) {
logger.info(var1, var2);
}
public static void main(String[] args) {
//Long currentTime = LogUtils.getLogUtils().printCurrentTime();
// LogUtils.getLogUtils().printTime(Md5.class,"测试的方法", currentTime);
LogUtils.getLogUtils().printMessage("测试方法 {} {}","3","2");
System.out.println(LogUtils.getLogUtils() == LogUtils.getLogUtils());
}
}
package io.office.modules.manage.vo.response;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
*
* 
 @description:
*
* @author wudi
* @date 15:08 2021/12/14
*/
@Data
public class SearchVo implements Serializable {
private int id;
private String title;
private String keyword;
private String content;
private String type;
private String urlid;
private Date date;
private String source;
}
......@@ -610,60 +610,9 @@ order by releasedate desc
<select id="getSearchInfo" parameterType="string" resultType="io.office.modules.manage.vo.response.SearchVo">
SELECT id, title, keyword, [content], 1 AS type, id AS urlid, releasedate AS date ,source
FROM dbo.news
WHERE (status = 1) AND (levels > 0) AND (classid IN (32, 33))
select * from NewsSearch
<if test="name!=null and name!=''">
and title like concat('%',#{name},'%')
</if>
UNION ALL
SELECT id, title, keyword, [content], 1 AS type, id AS urlid, releasedate AS date ,source
FROM dbo.Policy
WHERE (levels > 0) AND (class = '相关标准')
<if test="name!=null and name!=''">
and title like concat('%',#{name},'%')
</if>
UNION ALL
SELECT id, title, keyword, [content], 2 AS type, id AS urlid, releasedate AS date ,source
FROM dbo.Policy AS Policy_1
WHERE (levels > 0) AND (class = '法律法规')
<if test="name!=null and name!=''">
and title like concat('%',#{name},'%')
</if>
UNION ALL
SELECT id, title, keyword, [content], 3 AS type, id AS urlid, releasedate AS date ,source
FROM dbo.news AS news_2
WHERE (status = 1) AND (levels > 0) AND (classid NOT IN (12, 13, 14, 15, 16, 18, 19, 20, 21, 32, 33))
<if test="name!=null and name!=''">
and title like concat('%',#{name},'%')
</if>
UNION ALL
SELECT ClassId, Title, Title AS keyword, '' AS Expr1, 31 AS type, ClassId AS urlid, checktime AS date ,'深度专题' AS source
FROM dbo.NewTopic
WHERE (levels > 0) AND (ParentId = 0) AND (checkflag = 1)
<if test="name!=null and name!=''">
and title like concat('%',#{name},'%')
</if>
UNION ALL
SELECT id, title, keyword, brief, 32 AS type, id AS urlid, releasedate AS date ,'精彩视频' AS source
FROM dbo.news_movie
WHERE (status = 1) AND (levels > 0)
<if test="name!=null and name!=''">
and title like concat('%',#{name},'%')
</if>
UNION ALL
SELECT id, title, keyword, [content], 5 AS type, id AS urlid, releasedate AS date ,source
FROM dbo.news AS news_1
WHERE (status = 1) AND (levels > 0) AND (classid IN (12, 13, 14, 15, 16, 18, 19, 20, 21))
<if test="name!=null and name!=''">
and title like concat('%',#{name},'%')
</if>
UNION ALL
SELECT knowledgeInfoID, Title, Title AS keyword, [Content], 6 AS type, knowledgeInfoID AS urlid, inputDate AS date ,'技术知识' AS source
FROM dbo.knowledgeInfo
WHERE status = 1
<if test="name!=null and name!=''">
and title like concat('%',#{name},'%')
where (title like concat('%',#{name},'%') or keyword like concat('%',#{name},'%') or content like concat('%',#{name},'%'))
</if>
</select>
......
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