Compare commits
2 Commits
2189f6a3f0
...
e12f4f0a62
Author | SHA1 | Date |
---|---|---|
wangliwen | e12f4f0a62 | |
wangliwen | f2ec0b118d |
|
@ -17,11 +17,15 @@ import io.swagger.annotations.Api;
|
|||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
|
@ -34,6 +38,7 @@ import java.util.Map;
|
|||
@RequestMapping("sys/notice")
|
||||
@Api(tags = "通知管理")
|
||||
public class SysNoticeController {
|
||||
private static Logger logger = LoggerFactory.getLogger(SysNoticeController.class);
|
||||
@Autowired
|
||||
private SysNoticeService sysNoticeService;
|
||||
@Autowired
|
||||
|
@ -89,9 +94,19 @@ public class SysNoticeController {
|
|||
|
||||
@PutMapping("mynotice/read/{noticeId}")
|
||||
@ApiOperation("标记我的通知为已读")
|
||||
public Result read(@PathVariable("noticeId") Long noticeId) {
|
||||
sysNoticeUserService.updateReadStatus(SecurityUser.getUserId(), noticeId);
|
||||
|
||||
public Result read(@PathVariable("noticeId") String noticeId) {
|
||||
if (StringUtils.isNotEmpty(noticeId) && noticeId.contains(";")) {
|
||||
String[] noticeIds = noticeId.split(";");
|
||||
Arrays.asList(noticeIds).stream().distinct().forEach(index -> {
|
||||
try {
|
||||
sysNoticeUserService.updateReadStatus(SecurityUser.getUserId(), Long.valueOf(index));
|
||||
} catch (Exception exception) {
|
||||
logger.error("标识已读失败", exception);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
sysNoticeUserService.updateReadStatus(SecurityUser.getUserId(), Long.valueOf(noticeId));
|
||||
}
|
||||
return new Result();
|
||||
}
|
||||
|
||||
|
|
|
@ -86,6 +86,7 @@ public class SysNoticeServiceImpl extends CrudServiceImpl<SysNoticeDao, SysNotic
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public void save(SysNoticeDTO dto) {
|
||||
SysNoticeEntity entity = ConvertUtils.sourceToTarget(dto, SysNoticeEntity.class);
|
||||
entity.setFrom("其它"); // 站内信通知来源 (通知、评论、其它)
|
||||
|
||||
//更新发送者信息
|
||||
if (dto.getStatus() == NoticeStatusEnum.SEND.value() && StringUtils.isEmpty(dto.getSenderName())) {
|
||||
|
|
Loading…
Reference in New Issue