From 56efd0aa54e2c5cea81ff9b28855bca520dee475 Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期五, 17 十月 2025 16:42:43 +0800
Subject: [PATCH] 无形广告资产接口
---
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OaNotificationServiceImpl.java | 77 ++++++++++++++++++++++++++++++++++++++
1 files changed, 77 insertions(+), 0 deletions(-)
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OaNotificationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OaNotificationServiceImpl.java
index 77d6ed2..0ca76f9 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OaNotificationServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OaNotificationServiceImpl.java
@@ -1,10 +1,22 @@
package com.ruoyi.system.service.impl;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.basic.PageInfo;
+import com.ruoyi.common.core.domain.entity.TDept;
import com.ruoyi.system.mapper.OaNotificationMapper;
+import com.ruoyi.system.mapper.TDeptMapper;
import com.ruoyi.system.model.OaNotification;
+import com.ruoyi.system.query.NotificationListQuery;
import com.ruoyi.system.service.OaNotificationService;
+import com.ruoyi.system.vo.system.NotificationVO;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
/**
* <p>
@@ -17,4 +29,69 @@
@Service
public class OaNotificationServiceImpl extends ServiceImpl<OaNotificationMapper, OaNotification> implements OaNotificationService {
+ @Autowired
+ private TDeptMapper deptMapper;
+ @Override
+ public PageInfo<NotificationVO> pageList(NotificationListQuery query) {
+ List<TDept> tDepts = deptMapper.selectList(null);
+ Map<Integer, String> deptMap = tDepts.stream().collect(Collectors.toMap(TDept::getId, TDept::getDeptName));
+ if (StringUtils.hasLength(query.getDeptName())){
+ List<Integer> deptIds = deptMapper.selectList(new LambdaQueryWrapper<TDept>().like(TDept::getDeptName, query.getDeptName()))
+ .stream().map(TDept::getId).collect(Collectors.toList());
+ if (deptIds.isEmpty()){
+ return new PageInfo<>();
+ }
+ query.setDeptIds(deptIds);
+ }
+ PageInfo<NotificationVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
+ List<NotificationVO> list = this.baseMapper.pageList(query,pageInfo);
+ for (NotificationVO notificationVO : list) {
+ StringBuilder deptName = new StringBuilder();
+ if (notificationVO.getType()){
+ for (String deptId : notificationVO.getDeptIds().split(",")) {
+ String orDefault = deptMap.getOrDefault(Integer.parseInt(deptId), "");
+ deptName.append(orDefault).append(",");
+ }
+ notificationVO.setDeptName(deptName.substring(0,deptName.length()-1));
+ }else{
+ notificationVO.setDeptName("全部人员");
+
+ }
+
+ }
+ pageInfo.setRecords(list);
+ return pageInfo;
+ }
+
+ @Override
+ public PageInfo<NotificationVO> pageListUser(NotificationListQuery query) {
+ List<TDept> tDepts = deptMapper.selectList(null);
+ Map<Integer, String> deptMap = tDepts.stream().collect(Collectors.toMap(TDept::getId, TDept::getDeptName));
+ if (StringUtils.hasLength(query.getDeptName())){
+ List<Integer> deptIds = deptMapper.selectList(new LambdaQueryWrapper<TDept>().like(TDept::getDeptName, query.getDeptName()))
+ .stream().map(TDept::getId).collect(Collectors.toList());
+ if (deptIds.isEmpty()){
+ return new PageInfo<>();
+ }
+ query.setDeptIds(deptIds);
+ }
+ PageInfo<NotificationVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
+ List<NotificationVO> list = this.baseMapper.pageListUser(query,pageInfo);
+ for (NotificationVO notificationVO : list) {
+ StringBuilder deptName = new StringBuilder();
+ if (notificationVO.getType()){
+ for (String deptId : notificationVO.getDeptIds().split(",")) {
+ String orDefault = deptMap.getOrDefault(Integer.parseInt(deptId), "");
+ deptName.append(orDefault).append(",");
+ }
+ notificationVO.setDeptName(deptName.substring(0,deptName.length()-1));
+ }else{
+ notificationVO.setDeptName("全部人员");
+
+ }
+
+ }
+ pageInfo.setRecords(list);
+ return pageInfo;
+ }
}
--
Gitblit v1.7.1