消息公告
parent
ab00e7ece8
commit
a7a14ae5fb
|
@ -15,9 +15,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 43.142.149.172:8848
|
server-addr: 43.142.149.172:8848
|
||||||
|
namespace: test
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 43.142.149.172:8848
|
server-addr: 43.142.149.172:8848
|
||||||
|
namespace: test
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -15,9 +15,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 43.142.149.172:8848
|
server-addr: 43.142.149.172:8848
|
||||||
|
namespace: test
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 43.142.149.172:8848
|
server-addr: 43.142.149.172:8848
|
||||||
|
namespace: test
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
@ -34,6 +36,7 @@ spring:
|
||||||
ds1:
|
ds1:
|
||||||
nacos:
|
nacos:
|
||||||
server-addr: 43.142.149.172:8848
|
server-addr: 43.142.149.172:8848
|
||||||
|
namespace: test
|
||||||
dataId: sentinel-muyu-gateway
|
dataId: sentinel-muyu-gateway
|
||||||
groupId: DEFAULT_GROUP
|
groupId: DEFAULT_GROUP
|
||||||
data-type: json
|
data-type: json
|
||||||
|
|
|
@ -15,9 +15,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 43.142.149.172:8848
|
server-addr: 43.142.149.172:8848
|
||||||
|
namespace: test
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 43.142.149.172:8848
|
server-addr: 43.142.149.172:8848
|
||||||
|
namespace: test
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -15,9 +15,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 43.142.149.172:8848
|
server-addr: 43.142.149.172:8848
|
||||||
|
namespace: test
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 43.142.149.172:8848
|
server-addr: 43.142.149.172:8848
|
||||||
|
namespace: test
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -15,9 +15,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 43.142.149.172:8848
|
server-addr: 43.142.149.172:8848
|
||||||
|
namespace: test
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 43.142.149.172:8848
|
server-addr: 43.142.149.172:8848
|
||||||
|
namespace: test
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -8,6 +8,9 @@ import com.muyu.common.log.enums.BusinessType;
|
||||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
import com.muyu.common.security.utils.SecurityUtils;
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
import com.muyu.system.domain.SysNotice;
|
import com.muyu.system.domain.SysNotice;
|
||||||
|
import com.muyu.system.domain.model.NoticListModel;
|
||||||
|
import com.muyu.system.domain.model.SysNoticeModel;
|
||||||
|
import com.muyu.system.domain.resp.NoticDetailReadNumResp;
|
||||||
import com.muyu.system.service.SysNoticeService;
|
import com.muyu.system.service.SysNoticeService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
@ -26,6 +29,39 @@ public class SysNoticeController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysNoticeService noticeService;
|
private SysNoticeService noticeService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取公告列表
|
||||||
|
*/
|
||||||
|
|
||||||
|
@GetMapping("/noticList")
|
||||||
|
public Result<List<NoticListModel>> noticList () {
|
||||||
|
List<NoticListModel> list = noticeService.noticList();
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 阅读公告
|
||||||
|
*/
|
||||||
|
|
||||||
|
@GetMapping("/readNotic")
|
||||||
|
public Result<String> readNotic (@RequestParam Long noticeId) {
|
||||||
|
noticeService.readNotic(noticeId);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取公告详情列表
|
||||||
|
*/
|
||||||
|
|
||||||
|
@GetMapping("/noticListDetail")
|
||||||
|
public Result<List<NoticDetailReadNumResp>> noticListDetail () {
|
||||||
|
List<NoticDetailReadNumResp> list = noticeService.noticListDetail();
|
||||||
|
return Result.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取通知公告列表
|
* 获取通知公告列表
|
||||||
*/
|
*/
|
||||||
|
@ -52,9 +88,8 @@ public class SysNoticeController extends BaseController {
|
||||||
@RequiresPermissions("system:notice:add")
|
@RequiresPermissions("system:notice:add")
|
||||||
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public Result add (@Validated @RequestBody SysNotice notice) {
|
public Result add (@Validated @RequestBody SysNoticeModel sysNoticeModel) {
|
||||||
notice.setCreateBy(SecurityUtils.getUsername());
|
return toAjax(noticeService.insertNotice(sysNoticeModel));
|
||||||
return toAjax(noticeService.insertNotice(notice));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
package com.muyu.system.domain.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告列表
|
||||||
|
*
|
||||||
|
* @author WangLei
|
||||||
|
* @Date 2024/4/13 013 9:35
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class NoticListModel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 公告ID
|
||||||
|
*/
|
||||||
|
private Long noticeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告标题
|
||||||
|
*/
|
||||||
|
private String noticeTitle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告类型(1通知 2公告)
|
||||||
|
*/
|
||||||
|
private String noticeType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告内容
|
||||||
|
*/
|
||||||
|
private String noticeContent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布人
|
||||||
|
*/
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布时间
|
||||||
|
*/
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前状态
|
||||||
|
*/
|
||||||
|
private String flag;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
package com.muyu.system.domain.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告添加模型
|
||||||
|
*
|
||||||
|
* @author WangLei
|
||||||
|
* @Date 2024/4/13 013 9:33
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class SysNoticeModel {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告id
|
||||||
|
*/
|
||||||
|
private Long noticeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告标题
|
||||||
|
*/
|
||||||
|
private String noticeTitle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告类型(1通知 2公告)
|
||||||
|
*/
|
||||||
|
private String noticeType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告内容
|
||||||
|
*/
|
||||||
|
private String noticeContent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告状态(0正常 1关闭)
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告开始时间
|
||||||
|
*/
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date startTime;
|
||||||
|
/**
|
||||||
|
* 公告结束时间
|
||||||
|
*/
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date endTime;
|
||||||
|
/**
|
||||||
|
* 要通知的用户
|
||||||
|
*/
|
||||||
|
private String userNames;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private String createBy;
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.muyu.system.domain.resp;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告阅读数量详情响应
|
||||||
|
*
|
||||||
|
* @author WangLei
|
||||||
|
* @Date 2024/4/14 014 10:18
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class NoticDetailReadNumResp {
|
||||||
|
/**
|
||||||
|
* 公告id
|
||||||
|
*/
|
||||||
|
private Long noticeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已阅读数
|
||||||
|
*/
|
||||||
|
private Long readNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总数
|
||||||
|
*/
|
||||||
|
private Long totalNum;
|
||||||
|
|
||||||
|
}
|
|
@ -1,8 +1,17 @@
|
||||||
package com.muyu.system.mapper;
|
package com.muyu.system.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.common.system.domain.SysDept;
|
||||||
|
import com.muyu.common.system.domain.SysUser;
|
||||||
import com.muyu.system.domain.SysNotice;
|
import com.muyu.system.domain.SysNotice;
|
||||||
|
import com.muyu.system.domain.SysPost;
|
||||||
|
import com.muyu.system.domain.SysUserPost;
|
||||||
|
import com.muyu.system.domain.model.NoticListModel;
|
||||||
|
import com.muyu.system.domain.model.SysNoticeModel;
|
||||||
|
import com.muyu.system.domain.resp.NoticDetailReadNumResp;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -64,4 +73,22 @@ public interface SysNoticeMapper extends BaseMapper<SysNotice> {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteNoticeByIds (Long[] noticeIds);
|
public int deleteNoticeByIds (Long[] noticeIds);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SysUser findByName(@Param("name") String name);
|
||||||
|
|
||||||
|
void addUserNotice(@Param("noticeId") Long noticeId, @Param("userId") Long userId,@Param("createBy") String createBy, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||||
|
|
||||||
|
|
||||||
|
List<SysUser> findByAllName();
|
||||||
|
|
||||||
|
List<NoticListModel> finByNoticList(@Param("userId") Long userId);
|
||||||
|
|
||||||
|
|
||||||
|
List<NoticDetailReadNumResp> findByNoticeId();
|
||||||
|
|
||||||
|
void readNotic(@Param("noticeId") Long noticeId, @Param("userId") Long userId);
|
||||||
|
|
||||||
|
List<SysNotice> selectNotice(@Param("userId") Long userId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,9 @@ package com.muyu.system.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.muyu.system.domain.SysNotice;
|
import com.muyu.system.domain.SysNotice;
|
||||||
|
import com.muyu.system.domain.model.NoticListModel;
|
||||||
|
import com.muyu.system.domain.model.SysNoticeModel;
|
||||||
|
import com.muyu.system.domain.resp.NoticDetailReadNumResp;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -32,11 +35,10 @@ public interface SysNoticeService extends IService<SysNotice> {
|
||||||
/**
|
/**
|
||||||
* 新增公告
|
* 新增公告
|
||||||
*
|
*
|
||||||
* @param notice 公告信息
|
|
||||||
*
|
*
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int insertNotice (SysNotice notice);
|
public Boolean insertNotice (SysNoticeModel sysNoticeModel);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改公告
|
* 修改公告
|
||||||
|
@ -64,4 +66,10 @@ public interface SysNoticeService extends IService<SysNotice> {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteNoticeByIds (Long[] noticeIds);
|
public int deleteNoticeByIds (Long[] noticeIds);
|
||||||
|
|
||||||
|
List<NoticListModel> noticList();
|
||||||
|
|
||||||
|
List<NoticDetailReadNumResp> noticListDetail();
|
||||||
|
|
||||||
|
void readNotic(Long noticeId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,29 @@
|
||||||
package com.muyu.system.service.impl;
|
package com.muyu.system.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
import com.muyu.common.system.domain.SysDept;
|
||||||
|
import com.muyu.common.system.domain.SysUser;
|
||||||
import com.muyu.system.domain.SysNotice;
|
import com.muyu.system.domain.SysNotice;
|
||||||
|
import com.muyu.system.domain.SysPost;
|
||||||
|
import com.muyu.system.domain.SysUserPost;
|
||||||
|
import com.muyu.system.domain.model.NoticListModel;
|
||||||
|
import com.muyu.system.domain.model.SysNoticeModel;
|
||||||
|
import com.muyu.system.domain.resp.NoticDetailReadNumResp;
|
||||||
import com.muyu.system.mapper.SysNoticeMapper;
|
import com.muyu.system.mapper.SysNoticeMapper;
|
||||||
|
import com.muyu.system.mapper.SysUserPostMapper;
|
||||||
|
import com.muyu.system.service.SysDeptService;
|
||||||
import com.muyu.system.service.SysNoticeService;
|
import com.muyu.system.service.SysNoticeService;
|
||||||
|
import com.muyu.system.service.SysPostService;
|
||||||
|
import com.muyu.system.service.SysUserService;
|
||||||
|
import org.apache.http.auth.AUTH;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公告 服务层实现
|
* 公告 服务层实现
|
||||||
|
@ -19,15 +35,29 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysNoticeMapper noticeMapper;
|
private SysNoticeMapper noticeMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysDeptService sysDeptService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysUserService sysUserService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysPostService sysPostService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询公告信息
|
* 查询公告信息
|
||||||
*
|
*
|
||||||
* @param noticeId 公告ID
|
* @param noticeId 公告ID
|
||||||
*
|
|
||||||
* @return 公告信息
|
* @return 公告信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysNotice selectNoticeById (Long noticeId) {
|
public SysNotice selectNoticeById(Long noticeId) {
|
||||||
return noticeMapper.selectNoticeById(noticeId);
|
return noticeMapper.selectNoticeById(noticeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,35 +65,84 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
||||||
* 查询公告列表
|
* 查询公告列表
|
||||||
*
|
*
|
||||||
* @param notice 公告信息
|
* @param notice 公告信息
|
||||||
*
|
|
||||||
* @return 公告集合
|
* @return 公告集合
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysNotice> selectNoticeList (SysNotice notice) {
|
public List<SysNotice> selectNoticeList(SysNotice notice) {
|
||||||
return noticeMapper.selectNoticeList(notice);
|
return noticeMapper.selectNoticeList(notice);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增公告
|
* 新增公告
|
||||||
*
|
*
|
||||||
* @param notice 公告信息
|
|
||||||
*
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertNotice (SysNotice notice) {
|
public Boolean insertNotice(SysNoticeModel sysNoticeModel) {
|
||||||
return noticeMapper.insertNotice(notice);
|
SysNotice notice = SysNotice.builder()
|
||||||
|
.noticeTitle(sysNoticeModel.getNoticeTitle())
|
||||||
|
.noticeType(sysNoticeModel.getNoticeType())
|
||||||
|
.noticeContent(sysNoticeModel.getNoticeContent())
|
||||||
|
.status(sysNoticeModel.getStatus())
|
||||||
|
.build();
|
||||||
|
//新增公告表
|
||||||
|
notice.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
noticeMapper.insertNotice(notice);
|
||||||
|
|
||||||
|
SysUser sysUser1 = sysUserService.selectUserById(SecurityUtils.getUserId());
|
||||||
|
SysDept sysDept = sysDeptService.selectDeptById(sysUser1.getDeptId());
|
||||||
|
|
||||||
|
String deptName = sysDept.getDeptName();
|
||||||
|
String postGroup = sysUserService.selectUserPostGroup(sysUser1.getUserName());
|
||||||
|
|
||||||
|
String username = SecurityUtils.getUsername();
|
||||||
|
String createBy = username+"("+deptName+"/"+postGroup+")";
|
||||||
|
|
||||||
|
|
||||||
|
if (sysNoticeModel.getNoticeType().equals("2")) {
|
||||||
|
List<SysUser> sysUserList = noticeMapper.findByAllName();
|
||||||
|
sysUserList.forEach(
|
||||||
|
sysUser -> {
|
||||||
|
noticeMapper.addUserNotice(
|
||||||
|
notice.getNoticeId(),
|
||||||
|
sysUser.getUserId(),
|
||||||
|
createBy,
|
||||||
|
sysNoticeModel.getStartTime(),
|
||||||
|
sysNoticeModel.getEndTime()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//新增用户表和公告表id
|
||||||
|
String names = sysNoticeModel.getUserNames();
|
||||||
|
if (names != null) {
|
||||||
|
String[] nameList = names.split(",");
|
||||||
|
|
||||||
|
for (String name : nameList) {
|
||||||
|
SysUser sysUser = noticeMapper.findByName(name);
|
||||||
|
noticeMapper.addUserNotice(
|
||||||
|
notice.getNoticeId(),
|
||||||
|
sysUser.getUserId(),
|
||||||
|
createBy,
|
||||||
|
sysNoticeModel.getStartTime(),
|
||||||
|
sysNoticeModel.getEndTime());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改公告
|
* 修改公告
|
||||||
*
|
*
|
||||||
* @param notice 公告信息
|
* @param notice 公告信息
|
||||||
*
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateNotice (SysNotice notice) {
|
public int updateNotice(SysNotice notice) {
|
||||||
return noticeMapper.updateNotice(notice);
|
return noticeMapper.updateNotice(notice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,11 +150,10 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
||||||
* 删除公告对象
|
* 删除公告对象
|
||||||
*
|
*
|
||||||
* @param noticeId 公告ID
|
* @param noticeId 公告ID
|
||||||
*
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteNoticeById (Long noticeId) {
|
public int deleteNoticeById(Long noticeId) {
|
||||||
return noticeMapper.deleteNoticeById(noticeId);
|
return noticeMapper.deleteNoticeById(noticeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,11 +161,71 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
||||||
* 批量删除公告信息
|
* 批量删除公告信息
|
||||||
*
|
*
|
||||||
* @param noticeIds 需要删除的公告ID
|
* @param noticeIds 需要删除的公告ID
|
||||||
*
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteNoticeByIds (Long[] noticeIds) {
|
public int deleteNoticeByIds(Long[] noticeIds) {
|
||||||
return noticeMapper.deleteNoticeByIds(noticeIds);
|
return noticeMapper.deleteNoticeByIds(noticeIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<NoticListModel> noticList() {
|
||||||
|
|
||||||
|
SysUser sysUser1 = sysUserService.selectUserById(SecurityUtils.getUserId());
|
||||||
|
|
||||||
|
String postGroup = sysUserService.selectUserPostGroup(sysUser1.getUserName());
|
||||||
|
|
||||||
|
List<NoticListModel> noticeModelList = new ArrayList<>();
|
||||||
|
List<NoticListModel> fin = new ArrayList<>();
|
||||||
|
if ("董事长".equals(postGroup)) {
|
||||||
|
fin= noticeMapper.finByNoticList(null);
|
||||||
|
}else{
|
||||||
|
fin= noticeMapper.finByNoticList(sysUser1.getUserId());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// List<SysNotice> sysNoticeList = this.list();
|
||||||
|
List<SysNotice> sysNoticeList=noticeMapper.selectNotice(sysUser1.getUserId());
|
||||||
|
|
||||||
|
|
||||||
|
for (SysNotice sysNotice : sysNoticeList) {
|
||||||
|
|
||||||
|
noticeModelList.add(
|
||||||
|
NoticListModel.builder()
|
||||||
|
.noticeId(sysNotice.getNoticeId())
|
||||||
|
.noticeTitle(sysNotice.getNoticeTitle())
|
||||||
|
.noticeType(sysNotice.getNoticeType())
|
||||||
|
.createTime(sysNotice.getCreateTime())
|
||||||
|
.noticeContent(sysNotice.getNoticeContent())
|
||||||
|
.flag(sysNotice.getStatus())
|
||||||
|
.build()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (NoticListModel noticListModel : fin) {
|
||||||
|
noticeModelList.stream().filter(listModel -> Objects.equals(noticListModel.getNoticeId(), listModel.getNoticeId())).forEach(listModel -> {
|
||||||
|
listModel.setFlag(noticListModel.getFlag());
|
||||||
|
listModel.setCreateBy(noticListModel.getCreateBy());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (noticeModelList == null) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
return noticeModelList;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<NoticDetailReadNumResp> noticListDetail() {
|
||||||
|
return noticeMapper.findByNoticeId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readNotic(Long noticeId) {
|
||||||
|
Long userId = SecurityUtils.getUserId();
|
||||||
|
noticeMapper.readNotic(noticeId,userId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,9 +15,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 43.142.149.172:8848
|
server-addr: 43.142.149.172:8848
|
||||||
|
namespace: test
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 43.142.149.172:8848
|
server-addr: 43.142.149.172:8848
|
||||||
|
namespace: test
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
|
@ -50,8 +50,48 @@
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="findByName" resultType="com.muyu.common.system.domain.SysUser">
|
||||||
|
select * from sys_user where user_name = #{name}
|
||||||
|
</select>
|
||||||
|
<select id="findByAllName" resultType="com.muyu.common.system.domain.SysUser">
|
||||||
|
select * from sys_user
|
||||||
|
</select>
|
||||||
|
<select id="finByNoticList" resultType="com.muyu.system.domain.model.NoticListModel">
|
||||||
|
select
|
||||||
|
id,
|
||||||
|
user_id,
|
||||||
|
notice_id,
|
||||||
|
create_by,
|
||||||
|
start_time,
|
||||||
|
end_time,
|
||||||
|
flag
|
||||||
|
from a_test
|
||||||
|
<if test="userId != null">
|
||||||
|
where user_id =#{userId}
|
||||||
|
</if>
|
||||||
|
|
||||||
<insert id="insertNotice" parameterType="com.muyu.system.domain.SysNotice">
|
</select>
|
||||||
|
<select id="findByNoticeId" resultType="com.muyu.system.domain.resp.NoticDetailReadNumResp">
|
||||||
|
SELECT
|
||||||
|
notice_id,
|
||||||
|
COUNT(*) AS totalNum,
|
||||||
|
SUM(CASE WHEN flag = 1 THEN 1 ELSE 0 END) AS readNum
|
||||||
|
FROM
|
||||||
|
a_test
|
||||||
|
GROUP BY
|
||||||
|
notice_id
|
||||||
|
</select>
|
||||||
|
<select id="selectNotice" resultType="com.muyu.system.domain.SysNotice">
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM a_test a
|
||||||
|
LEFT JOIN sys_user su on a.user_id=su.user_id
|
||||||
|
LEFT JOIN sys_notice sn on a.notice_id=sn.notice_id
|
||||||
|
WHERE su.user_id =#{userId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<insert id="insertNotice" parameterType="com.muyu.system.domain.SysNotice" keyProperty="noticeId" useGeneratedKeys="true">
|
||||||
insert into sys_notice (
|
insert into sys_notice (
|
||||||
<if test="noticeTitle != null and noticeTitle != '' ">notice_title,</if>
|
<if test="noticeTitle != null and noticeTitle != '' ">notice_title,</if>
|
||||||
<if test="noticeType != null and noticeType != '' ">notice_type,</if>
|
<if test="noticeType != null and noticeType != '' ">notice_type,</if>
|
||||||
|
@ -70,6 +110,46 @@
|
||||||
sysdate()
|
sysdate()
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
<insert id="addUserNotice">
|
||||||
|
INSERT INTO `ry-cloud`.`a_test`
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="userId != null and userId != ''">
|
||||||
|
user_id,
|
||||||
|
</if>
|
||||||
|
<if test="noticeId != null and noticeId != ''">
|
||||||
|
notice_id,
|
||||||
|
</if>
|
||||||
|
<if test="createBy != null and createBy != ''">
|
||||||
|
create_by,
|
||||||
|
</if>
|
||||||
|
<if test="startTime != null">
|
||||||
|
start_time,
|
||||||
|
</if>
|
||||||
|
<if test="endTime != null">
|
||||||
|
end_time
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
VALUES
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="userId != null and userId != ''">
|
||||||
|
#{userId},
|
||||||
|
</if>
|
||||||
|
<if test="noticeId != null and noticeId != ''">
|
||||||
|
#{noticeId},
|
||||||
|
</if>
|
||||||
|
<if test="createBy != null and createBy != ''">
|
||||||
|
#{createBy},
|
||||||
|
</if>
|
||||||
|
<if test="startTime != null">
|
||||||
|
#{startTime},
|
||||||
|
</if>
|
||||||
|
<if test="endTime != null">
|
||||||
|
#{endTime}
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
|
||||||
<update id="updateNotice" parameterType="com.muyu.system.domain.SysNotice">
|
<update id="updateNotice" parameterType="com.muyu.system.domain.SysNotice">
|
||||||
update sys_notice
|
update sys_notice
|
||||||
|
@ -83,6 +163,10 @@
|
||||||
</set>
|
</set>
|
||||||
where notice_id = #{noticeId}
|
where notice_id = #{noticeId}
|
||||||
</update>
|
</update>
|
||||||
|
<update id="readNotic">
|
||||||
|
update a_test set flag = 1
|
||||||
|
where notice_id = #{noticeId} and user_id = #{userId}
|
||||||
|
</update>
|
||||||
|
|
||||||
<delete id="deleteNoticeById" parameterType="Long">
|
<delete id="deleteNoticeById" parameterType="Long">
|
||||||
delete
|
delete
|
||||||
|
|
|
@ -15,9 +15,11 @@ spring:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 43.142.149.172:8848
|
server-addr: 43.142.149.172:8848
|
||||||
|
namespace: test
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 43.142.149.172:8848
|
server-addr: 43.142.149.172:8848
|
||||||
|
namespace: test
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|
Loading…
Reference in New Issue