Commit bd5249c1 authored by 廖旭伟's avatar 廖旭伟

新闻详细接口修改

parent 2fe886e3
......@@ -11,6 +11,8 @@ import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.busiz.applets.req.NewsReq;
import com.mortals.xhx.busiz.applets.rsp.NewsListInfo;
import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.news.model.NewsCategoryQuery;
......@@ -19,6 +21,7 @@ import com.mortals.xhx.module.news.model.NewsQuery;
import com.mortals.xhx.module.news.service.NewsCategoryService;
import com.mortals.xhx.module.news.service.NewsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -28,6 +31,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -106,6 +110,9 @@ public class NewsApiController extends AbstractBaseController<NewsReq> {
query.setOrderColList(Arrays.asList(new OrderCol("createTime", OrderCol.DESCENDING)));
Result<NewsEntity> result = newsService.find(query, pageInfo, context);
result.getList().forEach(item->{
item.setContent(null);
});
// List<NewsListInfo> collect = result.getList().stream().map(item -> {
// NewsListInfo newsListInfo = new NewsListInfo();
// BeanUtils.copyProperties(item, newsListInfo, BeanUtil.getNullPropertyNames(item));
......
......@@ -117,6 +117,26 @@ public class NewsServiceImpl extends AbstractCRUDServiceImpl<NewsDao, NewsEntity
if(StringUtils.isNotEmpty(entity.getContent())) {
entity.setContent(entity.getContent().replaceAll(regex, replacement));
}
if(context!=null && context.getUser()!=null){
UserEntity userEntity = userService.get(context.getUser().getId());
if(userEntity!=null){
NewsShareEntity newsShareEntity = newsShareService.selectOne(new NewsShareQuery().newsId(key).createUserId(userEntity.getId()));
NewsUpEntity newsUpEntity = newsUpService.selectOne(new NewsUpQuery().newsId(key).upId(userEntity.getId()));
if(newsShareEntity!=null){
entity.setShareStatus(1);
}else {
entity.setShareStatus(0);
}
if(newsUpEntity!=null){
entity.setUpStatus(1);
}else {
entity.setUpStatus(0);
}
}else {
entity.setShareStatus(0);
entity.setUpStatus(0);
}
}
}
return entity;
}
......
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