修改
This commit is contained in:
parent
324b241e12
commit
dbe91094ec
@ -164,6 +164,12 @@ public class AppNewsController extends BaseController {
|
||||
inspectionNews.setPublishUnit(partners.getPartnerName());
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(inspectionNews.getType()) || inspectionNews.getType().equals("null")){
|
||||
if (ObjectUtil.isNotEmpty(inspectionNews.getIfShow())){
|
||||
inspectionNews.setType(inspectionNews.getIfShow().equals("01") ? "staff" : "user");
|
||||
}
|
||||
}
|
||||
|
||||
//判断是否为当前登录用户创建的
|
||||
return toAjax(inspectionNewsService.insertInspectionNews(inspectionNews));
|
||||
}
|
||||
|
@ -56,4 +56,8 @@ public class InspectionNews extends TenantBaseDO
|
||||
@TableField(exist = false)
|
||||
private String isRead;
|
||||
|
||||
/** 设置可见 */
|
||||
@TableField(exist = false)
|
||||
private String ifShow;
|
||||
|
||||
}
|
||||
|
@ -81,6 +81,6 @@ public interface InspectionNewsMapper extends BaseMapper<InspectionNews>
|
||||
void addReadNum(Long id);
|
||||
IPage<InspectionNews> collectionNews(Page<InspectionNews> page, @Param("userId") Long userId,@Param("newsName")String newsName);
|
||||
Integer newMsgNum(@Param("partnerId") Long partnerId);
|
||||
IPage<InspectionNews> msgList(Page<InspectionNews> page, @Param("partnerId") Long partnerId);
|
||||
IPage<InspectionNews> msgList(Page<InspectionNews> page, @Param("ifShow") String ifShow);
|
||||
List<String> listGfClass(@Param("type") String type);
|
||||
}
|
||||
|
@ -4,10 +4,15 @@ import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||
import cn.iocoder.yudao.module.system.api.permission.PermissionApi;
|
||||
import cn.iocoder.yudao.module.system.api.permission.RoleApi;
|
||||
import cn.iocoder.yudao.module.system.api.permission.dto.RoleReqDTO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@ -28,6 +33,8 @@ import cn.iocoder.yudao.module.inspection.utils.HtmlFilter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】Service业务层处理
|
||||
*
|
||||
@ -44,6 +51,10 @@ public class InspectionNewsServiceImpl extends ServiceImpl<InspectionNewsMapper,
|
||||
private AdminUserService userService;
|
||||
@Autowired
|
||||
private IInspectionNewsCommentService commentService;
|
||||
@Resource
|
||||
private PermissionApi permissionApi;
|
||||
@Resource
|
||||
private RoleApi roleApi;
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
@ -106,7 +117,7 @@ public class InspectionNewsServiceImpl extends ServiceImpl<InspectionNewsMapper,
|
||||
public int insertInspectionNews(InspectionNews inspectionNews)
|
||||
{
|
||||
|
||||
return baseMapper.insertInspectionNews(inspectionNews);
|
||||
return baseMapper.insert(inspectionNews);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -266,9 +277,27 @@ public class InspectionNewsServiceImpl extends ServiceImpl<InspectionNewsMapper,
|
||||
}
|
||||
|
||||
@Override
|
||||
@TenantIgnore
|
||||
// @TenantIgnore
|
||||
public IPage<InspectionNews> msgList(Page<InspectionNews> page, Long partnerId) {
|
||||
IPage<InspectionNews> news = baseMapper.msgList(page, partnerId);
|
||||
List<Long> roleIdsByUserId = permissionApi.getRoleIdsByUserId(SecurityFrameworkUtils.getLoginUserId());
|
||||
List<RoleReqDTO> roleList = roleApi.getRoleList();
|
||||
List<RoleReqDTO> collect = roleList.stream().filter(item -> roleIdsByUserId.contains(item.getId())).collect(Collectors.toList());
|
||||
String ifShow = "";
|
||||
if (CollUtil.isNotEmpty(collect)){
|
||||
List<String> collect1 = collect.stream().map(RoleReqDTO::getCode).collect(Collectors.toList());
|
||||
// 检测用户
|
||||
if (collect1.contains("jcyh")){
|
||||
ifShow = "user";
|
||||
}
|
||||
// else if (collect1.contains("jcgf") || collect1.contains("jcshop") || collect1.contains("dealers") || collect1.contains("partners")){
|
||||
// // 检测官方 检测商户 经销商 合作商
|
||||
// ifShow = "";
|
||||
// }
|
||||
else {
|
||||
ifShow = "staff";
|
||||
}
|
||||
}
|
||||
IPage<InspectionNews> news = baseMapper.msgList(page, ifShow);
|
||||
news.getRecords().forEach(it->{
|
||||
it.setNewsContent(HtmlFilter.dealFunction(it.getNewsContent()));
|
||||
});
|
||||
|
@ -167,8 +167,14 @@
|
||||
news.*,IF(ina.id is null,0,1) as isRead
|
||||
FROM
|
||||
inspection_news news
|
||||
left JOIN inspection_news_association ina ON ina.news_id = news.id and ina.user_id = #{partnerId} and ina.type = 'read'
|
||||
WHERE news.category = 'jcztz' or news.category = 'zflm'
|
||||
left JOIN inspection_news_association ina ON ina.news_id = news.id and ina.type = 'read'
|
||||
WHERE news.category = 'zflm'
|
||||
<if test="ifShow != null and ifShow != ''">
|
||||
or news.category = 'jcztz'
|
||||
or news.type = #{ifShow}
|
||||
or news.type = 'null'
|
||||
</if>
|
||||
group by news.id
|
||||
order by isRead,news.create_time desc
|
||||
</select>
|
||||
<select id="listGfClass" resultType="java.lang.String">
|
||||
|
Loading…
Reference in New Issue
Block a user