| | |
| | | import com.ruoyi.project.system.mapper.SysUserMapper;
|
| | | import com.ruoyi.project.system.service.ISysNoticeService;
|
| | | import lombok.RequiredArgsConstructor;
|
| | | import org.springframework.context.annotation.Lazy;
|
| | | import lombok.extern.slf4j.Slf4j;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | |
| | | *
|
| | | * @author ruoyi
|
| | | */
|
| | | @Slf4j
|
| | | @Service
|
| | | @RequiredArgsConstructor
|
| | | public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice> implements ISysNoticeService {
|
| | |
| | | private final SysUserMapper userMapper;
|
| | | private final SysDeptMapper deptMapper;
|
| | | private final SysUserDeptMapper userDeptMapper;
|
| | | @Lazy
|
| | | private final ISysNoticeService sysNoticeService;
|
| | | private final UnipushService unipushService;
|
| | |
|
| | | /**
|
| | | * 查询公告信息
|
| | |
| | | Long userId = SecurityUtils.getLoginUser().getUserId();
|
| | | Long tenantId = SecurityUtils.getLoginUser().getTenantId();
|
| | | List<SysNotice> sysNotices = consigneeId.stream()
|
| | | .map(it -> convertSysNotice(title, message, it, tenantId, jumpPath, unipushService.convertWebPathToAppPath(jumpPath), userId))
|
| | | .map(it -> convertSysNotice(title, message, it, tenantId, jumpPath, jumpPath, userId))
|
| | | .collect(Collectors.toList());
|
| | | sysNoticeService.saveBatch(sysNotices);
|
| | | try {
|
| | | unipushService.sendClientMessage(sysNotices);
|
| | | } catch (Exception e) {
|
| | | log.error("APP推送通知失败,原因: {}", e);
|
| | | }
|
| | | noticeMapper.insert(sysNotices);
|
| | | log.info("公告已保存至数据库,推送功能已禁用");
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | it.getUserId(),
|
| | | it.getTenantId(),
|
| | | jumpPath,
|
| | | unipushService.convertWebPathToAppPath(jumpPath),
|
| | | jumpPath,
|
| | | userId
|
| | | ))
|
| | | .collect(Collectors.toList());
|
| | |
|
| | | sysNoticeService.saveBatch(collect);
|
| | | try {
|
| | | unipushService.sendClientMessage(collect);
|
| | | } catch (Exception e) {
|
| | | log.error("APP推送通知失败,原因: {}", e);
|
| | | }
|
| | | noticeMapper.insert(collect);
|
| | | log.info("公告已保存至数据库,推送功能已禁用");
|
| | | }
|
| | |
|
| | |
|