fix 78143 动态消息-未发布已发布状态的数据权限需要再明确一下

This commit is contained in:
liao
2023-11-06 10:30:25 +08:00
parent 0c1dd9ee11
commit 888cde30f0
5 changed files with 38 additions and 7 deletions
@@ -0,0 +1,14 @@
package com.jero.modules.laws.common.constant;
/**
* @Author: liao
* @Date: 2023/11/6 10:23
* @Description: 字典常量
*/
public class DictCommon {
private DictCommon() {}
public static final String DYNAMIC_NEWS_TYPE_ID = "1704331613726781442"; // 动态分类 dynamic_news_type
}
@@ -0,0 +1,14 @@
package com.jero.modules.laws.common.constant;
/**
* @Author: liao
* @Date: 2023/11/6 10:28
* @Description: 消息模板编码
*/
public class MessageTemplateCodeCommon {
private MessageTemplateCodeCommon() {}
public static final String LAWS_NEWS_FEED = "laws_news_feed"; // 动态消息
}
@@ -74,13 +74,14 @@ public class LawsNewsFeedController extends JeroController<LawsNewsFeed, ILawsNe
public Result<String> save(@Validated @RequestBody LawsNewsFeed lawsNewsFeed) {
// 第一次保存,附上初值
if (Objects.isNull(lawsNewsFeed.getReleaseStatus())) {
lawsNewsFeed.setReleaseStatus(0);
lawsNewsFeed.setReadCount(0);
}
// 发布时间不为空(发布后的保存,发布时间更新)
if (!Objects.isNull(lawsNewsFeed.getReleaseTime())) {
// 发布
lawsNewsFeed.setReleaseStatus(0);
// 发布时间不为空(发布后的保存,发布时间更新)-不更新
/*if (!Objects.isNull(lawsNewsFeed.getReleaseTime())) {
lawsNewsFeed.setReleaseTime(new Date());
}
}*/
lawsNewsFeedService.add(lawsNewsFeed, "save");
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
}
@@ -32,6 +32,6 @@
<if test="param.dynamicHeading != null and param.dynamicHeading != ''">
AND lnf.dynamic_heading LIKE CONCAT('%', #{param.dynamicHeading}, '%')
</if>
ORDER BY create_time DESC
ORDER BY release_time DESC
</select>
</mapper>
@@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jero.common.api.dto.message.SendMessageDTO;
import com.jero.common.api.vo.SendMessageAPI;
import com.jero.common.system.vo.LoginUser;
import com.jero.modules.laws.common.constant.DictCommon;
import com.jero.modules.laws.common.constant.FieldCommon;
import com.jero.modules.laws.common.constant.MessageTemplateCodeCommon;
import com.jero.modules.laws.common.constant.ResultCommon;
import com.jero.modules.laws.standard.entity.LawsNewsFeed;
import com.jero.modules.laws.standard.entity.LawsPushRange;
@@ -168,14 +170,14 @@ public class LawsNewsFeedServiceImpl extends ServiceImpl<LawsNewsFeedMapper, Law
if ("release".equals(type)) {
// 发送消息
SendMessageDTO sendMessageDTO = new SendMessageDTO();
sendMessageDTO.setTemplateCode("laws_news_feed");
sendMessageDTO.setTemplateCode(MessageTemplateCodeCommon.LAWS_NEWS_FEED);
sendMessageDTO.setToUserId(pushRange);
Map<String, String> map = new HashMap<>();
map.put("title", lawsNewsFeed.getDynamicHeading());
LambdaQueryWrapper<SysDictItem> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SysDictItem::getItemValue, lawsNewsFeed.getDynamicClassification());
lambdaQueryWrapper.eq(SysDictItem::getDictId, "1704331613726781442");
lambdaQueryWrapper.eq(SysDictItem::getDictId, DictCommon.DYNAMIC_NEWS_TYPE_ID);
SysDictItem sysDictItem = sysDictItemService.getOne(lambdaQueryWrapper);
map.put("type", sysDictItem.getItemText());