Commit 43309bbe by 阳浪

查看我的投稿接口

parent 9e4dacf8
package com.yizhi.site.application; package com.yizhi.site.application;
import com.yizhi.core.application.security.config.SpringSecurityConfig;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration; import org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration;
import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.DependsOn;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableTransactionManagement @EnableTransactionManagement
...@@ -18,9 +15,5 @@ public class SiteApplication { ...@@ -18,9 +15,5 @@ public class SiteApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(SiteApplication.class, args); SpringApplication.run(SiteApplication.class, args);
} }
@Bean
public SpringSecurityConfig springSecurityConfig(){
return new SpringSecurityConfig();
}
} }
...@@ -25,6 +25,8 @@ public interface InformationMapper extends BaseMapper<Information> { ...@@ -25,6 +25,8 @@ public interface InformationMapper extends BaseMapper<Information> {
List<Information> informationTwoList(InfomationParamVO vo, Page<Information> page); List<Information> informationTwoList(InfomationParamVO vo, Page<Information> page);
List<Information> informationThreeList(InfomationParamVO vo, Page<Information> page);
List<AnnouncementVO> selectAnnouncement(Page<AnnouncementVO> page, Map<String, Object> map); List<AnnouncementVO> selectAnnouncement(Page<AnnouncementVO> page, Map<String, Object> map);
List<InformationStudentVO> informationPageList(@Param("typeName") String typeName, @Param("siteId") Long siteId, @Param("typeOne") Long typeOne, Page<InformationStudentVO> page); List<InformationStudentVO> informationPageList(@Param("typeName") String typeName, @Param("siteId") Long siteId, @Param("typeOne") Long typeOne, Page<InformationStudentVO> page);
......
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.mapper.EntityWrapper; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page; import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.baomidou.mybatisplus.service.impl.ServiceImpl;
//import com.yizhi.application.job.remote.vo.VmyJobVO; //import com.yizhi.application.job.remote.vo.VmyJobVO;
import com.google.common.collect.Lists;
import com.yizhi.site.application.domain.DataClassification; import com.yizhi.site.application.domain.DataClassification;
import com.yizhi.site.application.domain.Information; import com.yizhi.site.application.domain.Information;
import com.yizhi.site.application.domain.ProtalPlate; import com.yizhi.site.application.domain.ProtalPlate;
...@@ -79,10 +80,10 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor ...@@ -79,10 +80,10 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
private PdfPagesClient pdfPagesClient; private PdfPagesClient pdfPagesClient;
@Autowired @Autowired
private ITrInformationReadNumberService informationReadNumberService; private ITrInformationReadNumberService informationReadNumberService;
@Autowired @Autowired
private InformationClassifyMapper informationClassifyMapper; private InformationClassifyMapper informationClassifyMapper;
// @Autowired // @Autowired
// JobClient jobClient; // JobClient jobClient;
...@@ -463,15 +464,15 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor ...@@ -463,15 +464,15 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
siteComponyIdVO.setSiteId(res.getSiteId()); siteComponyIdVO.setSiteId(res.getSiteId());
List<ClassificationVO> classificationVOList = null;//dataClassificationService.getClassification(siteComponyIdVO); List<ClassificationVO> classificationVOList = null;//dataClassificationService.getClassification(siteComponyIdVO);
//获取根节点下的所有分类 //获取根节点下的所有分类
Long typeOne = vo.getRelationId(); Long typeOne = vo.getRelationId();
if(typeOne == null){ if(typeOne == null){
typeOne = 0L; typeOne = 0L;
} }
List<DataClassificationVo> classifyNews = null; List<DataClassificationVo> classifyNews = null;
Long typeTwo = vo.getTypeTwo(); Long typeTwo = vo.getTypeTwo();
//如果是新闻,查出所有新闻分页信息及其新闻分类列表 //如果是新闻,查出所有新闻分页信息及其新闻分类列表
if (vo.getTypeName().equals(SiteConstant.PCPORTALNEWS)) { if (vo.getTypeName().equals(SiteConstant.PCPORTALNEWS)) {
//如果是分类列表 //如果是分类列表
...@@ -497,9 +498,9 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor ...@@ -497,9 +498,9 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
} }
} else { } else {
//如果是全部列表,查询所有的分类含根目录 //如果是全部列表,查询所有的分类含根目录
classifyNews = dataClassificationService.getAllClassification(siteComponyIdVO, typeOne); classifyNews = dataClassificationService.getAllClassification(siteComponyIdVO, typeOne);
infoVO.setClassifyNews(classifyNews); infoVO.setClassifyNews(classifyNews);
/* if (null != pageNo && pageNo == 1) { /* if (null != pageNo && pageNo == 1) {
//没有内容的二级分类需要筛除,重写sql //没有内容的二级分类需要筛除,重写sql
List<DataClassification> selectByMap = dataClassificationService.getSubcategories(siteId, typeOne); List<DataClassification> selectByMap = dataClassificationService.getSubcategories(siteId, typeOne);
...@@ -509,10 +510,10 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor ...@@ -509,10 +510,10 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
BeanUtils.copyProperties(d,entityVo); BeanUtils.copyProperties(d,entityVo);
selectVoByMap.add(entityVo); selectVoByMap.add(entityVo);
} }
}*/ }*/
//查询所有分类 //查询所有分类
list = informationMapper.informationPcPageList(SiteConstant.PORTALNEWS, siteId, typeOne, page); list = informationMapper.informationPcPageList(SiteConstant.PORTALNEWS, siteId, typeOne, page);
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
...@@ -578,7 +579,7 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor ...@@ -578,7 +579,7 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
infoVO.setPageTotal(page.getTotal()); infoVO.setPageTotal(page.getTotal());
} }
} }
return infoVO; return infoVO;
} }
...@@ -919,8 +920,22 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor ...@@ -919,8 +920,22 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
BeanUtils.copyProperties(vo,infomationParamVO); BeanUtils.copyProperties(vo,infomationParamVO);
infomationParamVO.setState(2); infomationParamVO.setState(2);
Page<Information> page = new Page<Information>(vo.getPageNo(), vo.getPageSize()); Page<Information> page = new Page<Information>(vo.getPageNo(), vo.getPageSize());
List<Information> list = informationMapper.informationFirstList(infomationParamVO, page); List<Information> list = Lists.newArrayList();
if (selectById == null) {
return null;
}
if (selectById.getName().equals(SiteConstant.ANNOUNCEMENT) && selectById.getParentId() == 0) { //公告
list = informationMapper.informationFirstList(infomationParamVO, page);
} else if (selectById.getParentId() == 0) {//新闻所有列表
list = informationMapper.informationFirstList(infomationParamVO, page);
} else {
DataClassification selectByParentId = dataClassificationService.selectById(selectById.getParentId());
if(selectByParentId==null || selectById.getParentId() == 0){
list = informationMapper.informationTwoList(infomationParamVO, page);//新闻分类列表
}else{
list = informationMapper.informationThreeList(infomationParamVO, page);//新闻分类列表
}
}
if (list.size() > 0 && list != null) { if (list.size() > 0 && list != null) {
for (Information info : list) { for (Information info : list) {
if (info.getTypeOne() != null && info.getTypeOne() != 0) { if (info.getTypeOne() != null && info.getTypeOne() != 0) {
...@@ -979,7 +994,12 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor ...@@ -979,7 +994,12 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
} else if (selectById.getParentId() == 0) {//新闻所有列表 } else if (selectById.getParentId() == 0) {//新闻所有列表
list = informationMapper.informationFirstList(vo, page); list = informationMapper.informationFirstList(vo, page);
} else { } else {
list = informationMapper.informationTwoList(vo, page);//新闻分类列表 DataClassification selectByParentId = dataClassificationService.selectById(selectById.getParentId());
if(selectByParentId==null || selectById.getParentId() == 0){
list = informationMapper.informationTwoList(vo, page);//新闻分类列表
}else{
list = informationMapper.informationThreeList(vo, page);//新闻分类列表
}
} }
if (list.size() > 0 && list != null) { if (list.size() > 0 && list != null) {
for (Information info : list) { for (Information info : list) {
...@@ -1020,20 +1040,20 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor ...@@ -1020,20 +1040,20 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
EntityWrapper<InformationClassify> wrapper = new EntityWrapper<InformationClassify>(classify); EntityWrapper<InformationClassify> wrapper = new EntityWrapper<InformationClassify>(classify);
List<InformationClassify> informationClassify = informationClassifyMapper.selectList(wrapper); List<InformationClassify> informationClassify = informationClassifyMapper.selectList(wrapper);
if (!CollectionUtils.isEmpty(informationClassify)) { if (!CollectionUtils.isEmpty(informationClassify)) {
for(InformationClassify item : informationClassify){ for(InformationClassify item : informationClassify){
if (item.getTypeOne() != null && item.getTypeOne() != 0) { if (item.getTypeOne() != null && item.getTypeOne() != 0) {
item.setTypeOneName(findNameById(item.getTypeOne())); item.setTypeOneName(findNameById(item.getTypeOne()));
} }
if (item.getTypeTwo() != null && item.getTypeTwo() != 0) { if (item.getTypeTwo() != null && item.getTypeTwo() != 0) {
item.setTypeTwoName(findNameById(item.getTypeTwo())); item.setTypeTwoName(findNameById(item.getTypeTwo()));
} }
if (item.getTypeThree() != null && item.getTypeThree() != 0) { if (item.getTypeThree() != null && item.getTypeThree() != 0) {
item.setTypeThreeName(findNameById(item.getTypeThree())); item.setTypeThreeName(findNameById(item.getTypeThree()));
} }
} }
} }
info.setInformationClassify(informationClassify); info.setInformationClassify(informationClassify);
return info; return info;
} }
...@@ -1063,23 +1083,23 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor ...@@ -1063,23 +1083,23 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
} else { } else {
information.setState(SiteConstant.TWO); information.setState(SiteConstant.TWO);
this.insert(information); this.insert(information);
} }
//保存资讯分类 //保存资讯分类
if (!CollectionUtils.isEmpty(information.getInformationClassify())) { if (!CollectionUtils.isEmpty(information.getInformationClassify())) {
for(InformationClassify item : information.getInformationClassify()){ for(InformationClassify item : information.getInformationClassify()){
item.setId(idGenerator.generate()); item.setId(idGenerator.generate());
item.setInformationId(information.getId()); item.setInformationId(information.getId());
item.setCreateById(information.getCreateById()); item.setCreateById(information.getCreateById());
item.setCreateByName(information.getCreateByName()); item.setCreateByName(information.getCreateByName());
item.setCreateTime(information.getCreateTime()); item.setCreateTime(information.getCreateTime());
item.setUpdateById(information.getUpdateById()); item.setUpdateById(information.getUpdateById());
item.setUpdateByName(information.getUpdateByName()); item.setUpdateByName(information.getUpdateByName());
item.setUpdateTime(information.getUpdateTime()); item.setUpdateTime(information.getUpdateTime());
informationClassifyMapper.insert(item); informationClassifyMapper.insert(item);
} }
} }
if (!StringUtils.isEmpty(information.getPdfOssUrl()) && !StringUtils.isEmpty(information.getPdfFileName())) { if (!StringUtils.isEmpty(information.getPdfOssUrl()) && !StringUtils.isEmpty(information.getPdfFileName())) {
...@@ -1092,16 +1112,16 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor ...@@ -1092,16 +1112,16 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
pdfVO.setOriginalFile(information.getPdfFileName()); pdfVO.setOriginalFile(information.getPdfFileName());
pdfVO.setOriginalFileUrl(information.getPdfOssUrl()); pdfVO.setOriginalFileUrl(information.getPdfOssUrl());
pdfVOs.add(pdfVO); pdfVOs.add(pdfVO);
try { try {
if (!CollectionUtils.isEmpty(pdfVOs)) { if (!CollectionUtils.isEmpty(pdfVOs)) {
LOGGER.info("pdf解析图片发送消息:"+pdfVOs.toString()); LOGGER.info("pdf解析图片发送消息:"+pdfVOs.toString());
cloudEventPublisher.publish("pdfToPng",new EventWrapper(0L, pdfVOs)); cloudEventPublisher.publish("pdfToPng",new EventWrapper(0L, pdfVOs));
} }
} catch (Exception e) { } catch (Exception e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
LOGGER.error("pdf解析图片发送消息失败:",e); LOGGER.error("pdf解析图片发送消息失败:",e);
} }
} }
return id; return id;
} }
...@@ -1252,7 +1272,7 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor ...@@ -1252,7 +1272,7 @@ public class InformationServiceImpl extends ServiceImpl<InformationMapper, Infor
Pattern p_html = Pattern.compile(regEx_html, Pattern.CASE_INSENSITIVE); Pattern p_html = Pattern.compile(regEx_html, Pattern.CASE_INSENSITIVE);
Matcher m_html = p_html.matcher(htmlStr); Matcher m_html = p_html.matcher(htmlStr);
htmlStr = m_html.replaceAll(""); //过滤html标签 htmlStr = m_html.replaceAll(""); //过滤html标签
//过滤空格符 //过滤空格符
String pattern = "&nbsp;"; String pattern = "&nbsp;";
Pattern r = Pattern.compile(pattern); Pattern r = Pattern.compile(pattern);
......
...@@ -52,22 +52,16 @@ ...@@ -52,22 +52,16 @@
<if test="end != null"> <if test="end != null">
and #{end} >= a.release_time and #{end} >= a.release_time
</if> </if>
<if test="null != typeTwoId">
and a.type_two = #{typeTwoId}
</if>
<if test="null != typeThreeId">
and a.type_three = #{typeThreeId}
</if>
<if test="null != state"> <if test="null != state">
and a.state = #{state} and a.state = #{state}
</if> </if>
order by a.is_top desc, a.create_time desc order by a.is_top desc, a.create_time desc
</select> </select>
<select id="informationTwoList" resultType="com.yizhi.site.application.domain.Information"> <select id="informationThreeList" resultType="com.yizhi.site.application.domain.Information">
<!-- select a.* from information a left join data_classification b on a.type_two=b.id <!-- select a.* from information a left join data_classification b on a.type_two=b.id
where 1=1 and a.site_id=#{siteId} and b.site_id=#{siteId} and b.name=#{name} --> where 1=1 and a.site_id=#{siteId} and b.site_id=#{siteId} and b.name=#{name} -->
select a.* from information a where 1=1 and a.site_id=#{siteId} and a.type_two=#{typeId} select a.* from information a where 1=1 and a.site_id=#{siteId} and a.type_three=#{typeId}
<if test="fileName != null and fileName != ''"> <if test="fileName != null and fileName != ''">
and (a.file_name like CONCAT('%', '${fileName}', '%' ) or a.key_words like CONCAT('%', '${fileName}', '%' ) ) and (a.file_name like CONCAT('%', '${fileName}', '%' ) or a.key_words like CONCAT('%', '${fileName}', '%' ) )
</if> </if>
...@@ -83,6 +77,25 @@ ...@@ -83,6 +77,25 @@
order by a.is_top desc, a.create_time desc order by a.is_top desc, a.create_time desc
</select> </select>
<select id="informationTwoList" resultType="com.yizhi.site.application.domain.Information">
<!-- select a.* from information a left join data_classification b on a.type_two=b.id
where 1=1 and a.site_id=#{siteId} and b.site_id=#{siteId} and b.name=#{name} -->
select a.* from information a where 1=1 and a.site_id=#{siteId} and a.type_two=#{typeId}
<if test="fileName != null and fileName != ''">
and (a.file_name like CONCAT('%', '${fileName}', '%' ) or a.key_words like CONCAT('%', '${fileName}', '%' ) )
</if>
<!-- <if test="keyWords != null and keyWords != ''">-->
<!-- and a.key_words like CONCAT('%', '${keyWords}', '%' )-->
<!-- </if>-->
<if test="start != null">
and a.release_time >= #{start}
</if>
<if test="end != null">
and #{end} >= a.release_time
</if>
order by a.is_top desc, a.create_time desc
</select>
<select id="informationPageList" resultType="com.yizhi.site.application.vo.site.InformationStudentVO"> <select id="informationPageList" resultType="com.yizhi.site.application.vo.site.InformationStudentVO">
SELECT 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