|
|
@ -18,7 +18,6 @@ |
|
|
|
package com.elink.esua.epdc.service.impl; |
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import cn.hutool.core.map.MapUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
@ -33,8 +32,6 @@ import com.elink.esua.epdc.commons.tools.security.user.UserDetail; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|
|
|
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
|
|
|
import com.elink.esua.epdc.constant.NewsConstant; |
|
|
|
import com.elink.esua.epdc.dao.NewsCategoryDao; |
|
|
|
import com.elink.esua.epdc.dao.NewsDao; |
|
|
|
import com.elink.esua.epdc.dto.BannerDTO; |
|
|
|
import com.elink.esua.epdc.dto.NewsDTO; |
|
|
@ -42,7 +39,6 @@ import com.elink.esua.epdc.dto.NewsUserAttitudeDTO; |
|
|
|
import com.elink.esua.epdc.dto.ParentAndAllDeptDTO; |
|
|
|
import com.elink.esua.epdc.dto.epdc.form.*; |
|
|
|
import com.elink.esua.epdc.dto.epdc.result.EpdcNewsListResultDTO; |
|
|
|
import com.elink.esua.epdc.entity.NewsCategoryEntity; |
|
|
|
import com.elink.esua.epdc.entity.NewsUserAttitudeEntity; |
|
|
|
import com.elink.esua.epdc.enums.AppNewsLikeEnum; |
|
|
|
import com.elink.esua.epdc.dto.epdc.result.EpdcNewsDetailResultDTO; |
|
|
@ -257,7 +253,6 @@ public class NewsServiceImpl extends BaseServiceImpl<NewsDao, NewsEntity> implem |
|
|
|
BannerDTO bannerDto = ConvertUtils.sourceToTarget(newsDto, BannerDTO.class); |
|
|
|
bannerDto.setId(bannerId); |
|
|
|
bannerDto.setAllDeptIdsShow(allDeptIdsShow); |
|
|
|
bannerDto.setPosition(getBannerPositionByCategoryId(newsDto.getNewsCateroryId())); |
|
|
|
bannerService.saveOrUpdate(packBannerDtoByNews(bannerDto, newsDto.getId(), newsDto.getNewsImageUrl(), newsDto.getNewsTitle())); |
|
|
|
} |
|
|
|
} |
|
|
@ -310,6 +305,8 @@ public class NewsServiceImpl extends BaseServiceImpl<NewsDao, NewsEntity> implem |
|
|
|
bannerDto.setNewsFlag(YesOrNoEnum.YES.value()); |
|
|
|
bannerDto.setNewsId(newsId); |
|
|
|
bannerDto.setTitle(newsTitle); |
|
|
|
// 通过新闻上banner,banner位置默认设置为顶部banner
|
|
|
|
bannerDto.setPosition(BannerPositionEnum.HEAD.getValue()); |
|
|
|
// 数据字典值,2-新闻类型
|
|
|
|
bannerDto.setBannerType(NumConstant.TWO_STR); |
|
|
|
return bannerDto; |
|
|
@ -445,7 +442,6 @@ public class NewsServiceImpl extends BaseServiceImpl<NewsDao, NewsEntity> implem |
|
|
|
|
|
|
|
BannerDTO banner = packBannerDtoByNews(ConvertUtils.sourceToTarget(newsDto, BannerDTO.class), |
|
|
|
newsId, newsDto.getNewsImageUrl(), newsDto.getNewsTitle()); |
|
|
|
banner.setPosition(getBannerPosition(newsDto.getNewsCateroryCode())); |
|
|
|
this.bannerService.saveNewsToBanner(banner, deptIds); |
|
|
|
|
|
|
|
NewsEntity news = new NewsEntity(); |
|
|
@ -457,44 +453,6 @@ public class NewsServiceImpl extends BaseServiceImpl<NewsDao, NewsEntity> implem |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private NewsCategoryDao newsCategoryDao; |
|
|
|
|
|
|
|
/** |
|
|
|
* 新闻上banner时,根据新闻类别id确定banner位置 |
|
|
|
* |
|
|
|
* @param newsCategoryId |
|
|
|
* @return java.lang.String |
|
|
|
* @author work@yujt.net.cn |
|
|
|
* @date 2020/5/27 10:15 |
|
|
|
*/ |
|
|
|
private String getBannerPositionByCategoryId(String newsCategoryId) { |
|
|
|
String newsCategoryCode = StringUtils.EMPTY; |
|
|
|
NewsCategoryEntity categoryEntity = newsCategoryDao.selectById(newsCategoryId); |
|
|
|
if (null != categoryEntity) { |
|
|
|
newsCategoryCode = categoryEntity.getCategoryCode(); |
|
|
|
} |
|
|
|
return getBannerPosition(newsCategoryCode); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 新闻上banner时,根据新闻类别编码确定banner位置 |
|
|
|
* |
|
|
|
* @param newsCategoryCode |
|
|
|
* @return java.lang.String |
|
|
|
* @author work@yujt.net.cn |
|
|
|
* @date 2020/5/27 10:15 |
|
|
|
*/ |
|
|
|
private String getBannerPosition(String newsCategoryCode) { |
|
|
|
switch (newsCategoryCode) { |
|
|
|
case NewsConstant.POLICE_NOTICE: |
|
|
|
case NewsConstant.SAFETY_PRECAUTIONS: |
|
|
|
return BannerPositionEnum.SAFETY.getValue(); |
|
|
|
default: |
|
|
|
return BannerPositionEnum.HOME_PAGE_HEAD.getValue(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 用户新闻参与类型 |
|
|
|
* |
|
|
|