Commit b4a3cbe7 by 吴博

Merge branch 'fixbug/fixNews' into 'master'

bug:[none] fixNews

See merge request rays/pcloud-book!915
parents 433160dc 74b37981
...@@ -285,4 +285,5 @@ public interface AppletNewsBiz { ...@@ -285,4 +285,5 @@ public interface AppletNewsBiz {
*/ */
void updateCardShowState(AppletNews appletNews); void updateCardShowState(AppletNews appletNews);
AppletNewsDTO getNewsById4Applet(Long newsId);
} }
...@@ -62,6 +62,7 @@ import com.pcloud.common.page.PageParam; ...@@ -62,6 +62,7 @@ import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.ListUtils; import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.cache.redis.JedisClusterUtils; import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
import com.pcloud.common.utils.string.StringUtil; import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.readercenter.common.enums.YesOrNoNumEnum;
import com.pcloud.readercenter.wechat.entity.WechatUser; import com.pcloud.readercenter.wechat.entity.WechatUser;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -1178,4 +1179,46 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -1178,4 +1179,46 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
appletNewsDao.updateCardShowState(appletNews); appletNewsDao.updateCardShowState(appletNews);
JedisClusterUtils.del(AppletConstants.HOME_NEWS_LIST); JedisClusterUtils.del(AppletConstants.HOME_NEWS_LIST);
} }
@Override
public AppletNewsDTO getNewsById4Applet(Long id) {
AppletNews appletNews = appletNewsDao.getById(id);
AppletNewsDTO appletNewsDTO = new AppletNewsDTO();
if (null!=appletNews){
BeanUtils.copyProperties(appletNews,appletNewsDTO);
}
// this.fillAppletNewsServe(appletNewsDTO);
this.fillBrowseCount(Lists.newArrayList(appletNewsDTO));
fillLabel(Arrays.asList(appletNewsDTO));
//填充类别集合
fillCategory(Arrays.asList(appletNewsDTO));
//填充第三方资源
fillThirdResources4Applet(Arrays.asList(appletNewsDTO));
fillBusinessCard(appletNewsDTO);
// 填充城市信息
if (StrUtil.isNotBlank(appletNews.getCityCode())) {
appletNewsDTO.setCity(regionMapMapper.getCitysByCode(appletNews.getCityCode()));
}
return appletNewsDTO;
}
private void fillThirdResources4Applet(List<AppletNewsDTO> appletNewsDTOList) {
if (ListUtils.isEmpty(appletNewsDTOList)) {
return;
}
for (AppletNewsDTO newsDTO : appletNewsDTOList) {
Long newsId = newsDTO.getId();
if (null != newsDTO.getShowState() && newsDTO.getShowState()) {
List<AppletThirdResources> thirdResourcesList = thirdResourcesDao.getThirdResourcesByNewsId(newsId);
if (ListUtils.isEmpty(thirdResourcesList)) {
continue;
}
newsDTO.setThirdResourcesRelations(thirdResourcesList);
}
}
}
} }
...@@ -631,7 +631,7 @@ public class AppletHomeFacade { ...@@ -631,7 +631,7 @@ public class AppletHomeFacade {
if (null == newsId){ if (null == newsId){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少参数"); throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少参数");
} }
return new ResponseDto<>(appletNewsBiz.getNewsById(newsId)); return new ResponseDto<>(appletNewsBiz.getNewsById4Applet(newsId));
} }
@ApiOperation("查图书详情-出版作者分类书名") @ApiOperation("查图书详情-出版作者分类书名")
......
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