需求4
parent
4941fe0cd0
commit
5ccc0bf14d
|
@ -0,0 +1,104 @@
|
||||||
|
//package com.muyu.system.controller;
|
||||||
|
//
|
||||||
|
//import java.util.List;
|
||||||
|
//import javax.servlet.http.HttpServletResponse;
|
||||||
|
//import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
//import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
//import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
//import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
//import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
//import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
//import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
//import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
//import org.springframework.web.bind.annotation.RestController;
|
||||||
|
//import com.muyu.common.log.annotation.Log;
|
||||||
|
//import com.muyu.common.log.enums.BusinessType;
|
||||||
|
//import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
|
//import com.muyu.system.domain.AsNoticeUser;
|
||||||
|
//import com.muyu.system.service.AsNoticeUserService;
|
||||||
|
//import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
//import com.muyu.common.core.domain.Result;
|
||||||
|
//import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
//import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * 通知公告人员中间Controller
|
||||||
|
// *
|
||||||
|
// * @author muyu
|
||||||
|
// * @date 2024-04-13
|
||||||
|
// */
|
||||||
|
//@RestController
|
||||||
|
//@RequestMapping("/user")
|
||||||
|
//public class AsNoticeUserController extends BaseController
|
||||||
|
//{
|
||||||
|
// @Autowired
|
||||||
|
// private AsNoticeUserService asNoticeUserService;
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 查询通知公告人员中间列表
|
||||||
|
// */
|
||||||
|
// @RequiresPermissions("system:user:list")
|
||||||
|
// @GetMapping("/list")
|
||||||
|
// public Result<TableDataInfo<AsNoticeUser>> list(AsNoticeUser asNoticeUser)
|
||||||
|
// {
|
||||||
|
// startPage();
|
||||||
|
// List<AsNoticeUser> list = asNoticeUserService.selectAsNoticeUserList(asNoticeUser);
|
||||||
|
// return getDataTable(list);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 导出通知公告人员中间列表
|
||||||
|
// */
|
||||||
|
// @RequiresPermissions("system:user:export")
|
||||||
|
// @Log(title = "通知公告人员中间", businessType = BusinessType.EXPORT)
|
||||||
|
// @PostMapping("/export")
|
||||||
|
// public void export(HttpServletResponse response, AsNoticeUser asNoticeUser)
|
||||||
|
// {
|
||||||
|
// List<AsNoticeUser> list = asNoticeUserService.selectAsNoticeUserList(asNoticeUser);
|
||||||
|
// ExcelUtil<AsNoticeUser> util = new ExcelUtil<AsNoticeUser>(AsNoticeUser.class);
|
||||||
|
// util.exportExcel(response, list, "通知公告人员中间数据");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 获取通知公告人员中间详细信息
|
||||||
|
// */
|
||||||
|
// @RequiresPermissions("system:user:query")
|
||||||
|
// @GetMapping(value = "/{id}")
|
||||||
|
// public Result getInfo(@PathVariable("id") Long id)
|
||||||
|
// {
|
||||||
|
// return success(asNoticeUserService.selectAsNoticeUserById(id));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 新增通知公告人员中间
|
||||||
|
// */
|
||||||
|
// @RequiresPermissions("system:user:add")
|
||||||
|
// @Log(title = "通知公告人员中间", businessType = BusinessType.INSERT)
|
||||||
|
// @PostMapping
|
||||||
|
// public Result add(@RequestBody AsNoticeUser asNoticeUser)
|
||||||
|
// {
|
||||||
|
// return toAjax(asNoticeUserService.insertAsNoticeUser(asNoticeUser));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 修改通知公告人员中间
|
||||||
|
// */
|
||||||
|
// @RequiresPermissions("system:user:edit")
|
||||||
|
// @Log(title = "通知公告人员中间", businessType = BusinessType.UPDATE)
|
||||||
|
// @PutMapping
|
||||||
|
// public Result edit(@RequestBody AsNoticeUser asNoticeUser)
|
||||||
|
// {
|
||||||
|
// return toAjax(asNoticeUserService.updateAsNoticeUser(asNoticeUser));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 删除通知公告人员中间
|
||||||
|
// */
|
||||||
|
// @RequiresPermissions("system:user:remove")
|
||||||
|
// @Log(title = "通知公告人员中间", businessType = BusinessType.DELETE)
|
||||||
|
// @DeleteMapping("/{ids}")
|
||||||
|
// public Result remove(@PathVariable Long[] ids)
|
||||||
|
// {
|
||||||
|
// return toAjax(asNoticeUserService.deleteAsNoticeUserByIds(ids));
|
||||||
|
// }
|
||||||
|
//}
|
|
@ -39,6 +39,16 @@ public class SysDeptController extends BaseController {
|
||||||
return success(depts);
|
return success(depts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取部门列表(children)
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("system:dept:list")
|
||||||
|
@GetMapping("/listDeptFind")
|
||||||
|
public Result listDeptFind () {
|
||||||
|
return success(deptService.listDeptFind());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询部门列表(排除节点)
|
* 查询部门列表(排除节点)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -7,7 +7,13 @@ import com.muyu.common.log.annotation.Log;
|
||||||
import com.muyu.common.log.enums.BusinessType;
|
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.AsNoticeUser;
|
||||||
import com.muyu.system.domain.SysNotice;
|
import com.muyu.system.domain.SysNotice;
|
||||||
|
import com.muyu.system.domain.req.AsNoticeUserReq;
|
||||||
|
import com.muyu.system.domain.req.ReadEditReq;
|
||||||
|
import com.muyu.system.domain.req.SelectAsNoticeUserReq;
|
||||||
|
import com.muyu.system.domain.resp.AsNoticeUserResp;
|
||||||
|
import com.muyu.system.domain.resp.SysNoticeResp;
|
||||||
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;
|
||||||
|
@ -31,9 +37,9 @@ public class SysNoticeController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@RequiresPermissions("system:notice:list")
|
@RequiresPermissions("system:notice:list")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public Result<TableDataInfo<SysNotice>> list (SysNotice notice) {
|
public Result<TableDataInfo<SysNoticeResp>> list (SysNotice notice) {
|
||||||
startPage();
|
startPage();
|
||||||
List<SysNotice> list = noticeService.selectNoticeList(notice);
|
List<SysNoticeResp> list = noticeService.selectNoticeList(notice);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,9 +58,26 @@ 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 AsNoticeUserReq req) {
|
||||||
notice.setCreateBy(SecurityUtils.getUsername());
|
if (req.getInDateTime() ==null || req.getSelectedOptions().isEmpty() || req.getUserCheckedList().isEmpty()){
|
||||||
return toAjax(noticeService.insertNotice(notice));
|
return Result.error("请检查有效日期,选中接收人,不能为空");
|
||||||
|
}
|
||||||
|
return toAjax(noticeService.insertNotice(req));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log(title = "修改已读状态", businessType = BusinessType.UPDATE)
|
||||||
|
@GetMapping("readEdit/{asNoticeId}")
|
||||||
|
public Result readEdit(@PathVariable Long asNoticeId){
|
||||||
|
return toAjax(noticeService.updateAsNoticeUser(asNoticeId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户获取自己所有的通知和公告
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("noticeByUserId")
|
||||||
|
public Result<List<AsNoticeUserResp>> noticeByUserId(@RequestBody SelectAsNoticeUserReq req){
|
||||||
|
return Result.success(noticeService.noticeByUserId(req));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
package com.muyu.system.domain;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.muyu.system.domain.req.AsNoticeUserReq;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.muyu.common.core.annotation.Excel;
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通知公告人员中间对象 as_notice_user
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-04-13
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class AsNoticeUser extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 0L;
|
||||||
|
|
||||||
|
/** 主键 */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 通知id */
|
||||||
|
@Excel(name = "通知id")
|
||||||
|
private Long noticeId;
|
||||||
|
|
||||||
|
/** 人员id */
|
||||||
|
@Excel(name = "人员id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/** 已读状态,'Y'已读,'N'未读 */
|
||||||
|
@Excel(name = "已读状态,'Y'已读,'N'未读")
|
||||||
|
private String readStates;
|
||||||
|
|
||||||
|
/** 过期时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "过期时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date endTime;
|
||||||
|
|
||||||
|
/** 过期状态'N'未过期,'Y'已过期 */
|
||||||
|
@Excel(name = "过期状态'N'未过期,'Y'已过期")
|
||||||
|
private String outStates;
|
||||||
|
|
||||||
|
// public static AsNoticeUser saveBuilder(AsNoticeUserReq req) {
|
||||||
|
// return AsNoticeUser.builder()
|
||||||
|
// .userId()
|
||||||
|
// .outStates(req.getStatus())
|
||||||
|
// .endTime(req.getInDateTime())
|
||||||
|
// .readStates("N")
|
||||||
|
// .outStates("N")
|
||||||
|
// .createBy(req.getCreateBy())
|
||||||
|
// .build();
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package com.muyu.system.domain;
|
||||||
|
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
import com.muyu.common.core.xss.Xss;
|
import com.muyu.common.core.xss.Xss;
|
||||||
|
import com.muyu.system.domain.req.AsNoticeUserReq;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
@ -12,6 +13,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通知公告表 sys_notice
|
* 通知公告表 sys_notice
|
||||||
|
@ -51,13 +54,18 @@ public class SysNotice extends BaseEntity {
|
||||||
*/
|
*/
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
public Long getNoticeId () {
|
public static SysNotice saveBuilder(AsNoticeUserReq req, Supplier<String> user) {
|
||||||
return noticeId;
|
return SysNotice.builder()
|
||||||
|
.noticeContent(req.getNoticeContent())
|
||||||
|
.noticeTitle(req.getNoticeTitle())
|
||||||
|
.noticeType(req.getNoticeType())
|
||||||
|
.status(req.getStatus())
|
||||||
|
.createBy(user.get())
|
||||||
|
.createTime(new Date())
|
||||||
|
.build();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNoticeId (Long noticeId) {
|
|
||||||
this.noticeId = noticeId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Xss(message = "公告标题不能包含脚本字符")
|
@Xss(message = "公告标题不能包含脚本字符")
|
||||||
@NotBlank(message = "公告标题不能为空")
|
@NotBlank(message = "公告标题不能为空")
|
||||||
|
@ -66,47 +74,4 @@ public class SysNotice extends BaseEntity {
|
||||||
return noticeTitle;
|
return noticeTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNoticeTitle (String noticeTitle) {
|
|
||||||
this.noticeTitle = noticeTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNoticeType () {
|
|
||||||
return noticeType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNoticeType (String noticeType) {
|
|
||||||
this.noticeType = noticeType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNoticeContent () {
|
|
||||||
return noticeContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNoticeContent (String noticeContent) {
|
|
||||||
this.noticeContent = noticeContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStatus () {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus (String status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString () {
|
|
||||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
|
||||||
.append("noticeId", getNoticeId())
|
|
||||||
.append("noticeTitle", getNoticeTitle())
|
|
||||||
.append("noticeType", getNoticeType())
|
|
||||||
.append("noticeContent", getNoticeContent())
|
|
||||||
.append("status", getStatus())
|
|
||||||
.append("createBy", getCreateBy())
|
|
||||||
.append("createTime", getCreateTime())
|
|
||||||
.append("updateBy", getUpdateBy())
|
|
||||||
.append("updateTime", getUpdateTime())
|
|
||||||
.append("remark", getRemark())
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
package com.muyu.system.domain.req;
|
||||||
|
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName AsNoticeUserReq
|
||||||
|
* @Description 描述
|
||||||
|
* @Author SaiSai.Liu
|
||||||
|
* @Date 2024/4/13 15:05
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
public class AsNoticeUserReq extends BaseEntity {
|
||||||
|
/**
|
||||||
|
* 公告id
|
||||||
|
*/
|
||||||
|
private Long noticeId;
|
||||||
|
/**
|
||||||
|
* 公告标题
|
||||||
|
*/
|
||||||
|
private String noticeTitle;
|
||||||
|
/**
|
||||||
|
* 公告内容
|
||||||
|
*/
|
||||||
|
private String noticeContent;
|
||||||
|
/**
|
||||||
|
* 公告有效日期
|
||||||
|
*/
|
||||||
|
private Date inDateTime;
|
||||||
|
/**
|
||||||
|
* 公告类型
|
||||||
|
*/
|
||||||
|
private String noticeType;
|
||||||
|
/**
|
||||||
|
* 选择部门
|
||||||
|
*/
|
||||||
|
private List<Long> selectedOptions;
|
||||||
|
/**
|
||||||
|
* 特定接收人
|
||||||
|
*/
|
||||||
|
private List<Long> userCheckedList;
|
||||||
|
/**
|
||||||
|
* 公告状态
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.muyu.system.domain.req;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName ReadEditReq
|
||||||
|
* @Description 描述
|
||||||
|
* @Author SaiSai.Liu
|
||||||
|
* @Date 2024/4/14 9:14
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
public class ReadEditReq {
|
||||||
|
private Long notice_id;
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.muyu.system.domain.req;
|
||||||
|
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName AsNoticeUserReq
|
||||||
|
* @Description 描述
|
||||||
|
* @Author SaiSai.Liu
|
||||||
|
* @Date 2024/4/13 15:05
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
public class SelectAsNoticeUserReq extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 读取状态
|
||||||
|
*/
|
||||||
|
private String readStates;
|
||||||
|
/**
|
||||||
|
* 公告类型
|
||||||
|
*/
|
||||||
|
private String noticeType;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.muyu.system.domain.resp;
|
||||||
|
|
||||||
|
import com.muyu.system.domain.SysNotice;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName AsNoticeUserResp
|
||||||
|
* @Description 描述
|
||||||
|
* @Author SaiSai.Liu
|
||||||
|
* @Date 2024/4/14 9:22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
public class AsNoticeUserResp {
|
||||||
|
|
||||||
|
private Long asNoticeId;
|
||||||
|
private String createBy;
|
||||||
|
private String noticeType;
|
||||||
|
private String readStates;
|
||||||
|
private Date createTime;
|
||||||
|
private Date endTime;
|
||||||
|
private SysNotice sysNotice;
|
||||||
|
}
|
|
@ -0,0 +1,89 @@
|
||||||
|
package com.muyu.system.domain.resp;
|
||||||
|
|
||||||
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import com.muyu.common.core.xss.Xss;
|
||||||
|
import com.muyu.system.domain.SysNotice;
|
||||||
|
import com.muyu.system.domain.req.AsNoticeUserReq;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
import net.bytebuddy.implementation.bind.annotation.Super;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName SysNoticeResp
|
||||||
|
* @Description 描述
|
||||||
|
* @Author SaiSai.Liu
|
||||||
|
* @Date 2024/4/14 14:21
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
public class SysNoticeResp extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告ID
|
||||||
|
*/
|
||||||
|
private Long noticeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告标题
|
||||||
|
*/
|
||||||
|
private String noticeTitle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告类型(1通知 2公告)
|
||||||
|
*/
|
||||||
|
private String noticeType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告内容
|
||||||
|
*/
|
||||||
|
private String noticeContent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 有效日期
|
||||||
|
*/
|
||||||
|
private Date endTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公告状态(0正常 1关闭)
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总通知数量
|
||||||
|
*/
|
||||||
|
private Long num;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已读数量
|
||||||
|
*/
|
||||||
|
private Long readNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未读数量
|
||||||
|
*/
|
||||||
|
private Long unReadNum;
|
||||||
|
|
||||||
|
public static SysNoticeResp saveBuilder(SysNotice req){
|
||||||
|
return SysNoticeResp.builder()
|
||||||
|
.noticeId(req.getNoticeId())
|
||||||
|
.noticeContent(req.getNoticeContent())
|
||||||
|
.noticeTitle(req.getNoticeTitle())
|
||||||
|
.noticeType(req.getNoticeType())
|
||||||
|
.status(req.getStatus())
|
||||||
|
.createBy(req.getCreateBy())
|
||||||
|
.createTime(req.getCreateTime())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
package com.muyu.system.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.common.system.domain.SysDept;
|
||||||
|
import com.muyu.system.domain.AsNoticeUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通知公告人员中间Mapper接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-04-13
|
||||||
|
*/
|
||||||
|
public interface AsNoticeUserMapper extends BaseMapper<AsNoticeUser>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询通知公告人员中间
|
||||||
|
*
|
||||||
|
* @param id 通知公告人员中间主键
|
||||||
|
* @return 通知公告人员中间
|
||||||
|
*/
|
||||||
|
public AsNoticeUser selectAsNoticeUserById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询通知公告人员中间列表
|
||||||
|
*
|
||||||
|
* @param asNoticeUser 通知公告人员中间
|
||||||
|
* @return 通知公告人员中间集合
|
||||||
|
*/
|
||||||
|
public List<AsNoticeUser> selectAsNoticeUserList(AsNoticeUser asNoticeUser);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增通知公告人员中间
|
||||||
|
*
|
||||||
|
* @param asNoticeUser 通知公告人员中间
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertAsNoticeUser(AsNoticeUser asNoticeUser);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改通知公告人员中间
|
||||||
|
*
|
||||||
|
* @param asNoticeUser 通知公告人员中间
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateAsNoticeUser(AsNoticeUser asNoticeUser);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除通知公告人员中间
|
||||||
|
*
|
||||||
|
* @param id 通知公告人员中间主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteAsNoticeUserById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除通知公告人员中间
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteAsNoticeUserByIds(Long[] ids);
|
||||||
|
}
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.muyu.system.domain.SysConfig;
|
import com.muyu.system.domain.SysConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 系统配置 数据层
|
||||||
* @author DongZl
|
* @author DongZl
|
||||||
* @description: 配置mybatis配置
|
* @description: 配置mybatis配置
|
||||||
* @Date 2023-11-13 上午 10:05
|
* @Date 2023-11-13 上午 10:05
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
package com.muyu.system.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.common.system.domain.SysDept;
|
||||||
|
import com.muyu.system.domain.AsNoticeUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通知公告人员中间Service接口
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-04-13
|
||||||
|
*/
|
||||||
|
public interface AsNoticeUserService extends IService<AsNoticeUser>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询通知公告人员中间
|
||||||
|
*
|
||||||
|
* @param id 通知公告人员中间主键
|
||||||
|
* @return 通知公告人员中间
|
||||||
|
*/
|
||||||
|
public AsNoticeUser selectAsNoticeUserById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询通知公告人员中间列表
|
||||||
|
*
|
||||||
|
* @param asNoticeUser 通知公告人员中间
|
||||||
|
* @return 通知公告人员中间集合
|
||||||
|
*/
|
||||||
|
public List<AsNoticeUser> selectAsNoticeUserList(AsNoticeUser asNoticeUser);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增通知公告人员中间
|
||||||
|
*
|
||||||
|
* @param asNoticeUser 通知公告人员中间
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertAsNoticeUser(AsNoticeUser asNoticeUser);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改通知公告人员中间
|
||||||
|
*
|
||||||
|
* @param asNoticeUser 通知公告人员中间
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateAsNoticeUser(AsNoticeUser asNoticeUser);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除通知公告人员中间
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的通知公告人员中间主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteAsNoticeUserByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除通知公告人员中间信息
|
||||||
|
*
|
||||||
|
* @param id 通知公告人员中间主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteAsNoticeUserById(Long id);
|
||||||
|
}
|
|
@ -135,4 +135,6 @@ public interface SysDeptService extends IService<SysDept> {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteDeptById (Long deptId);
|
public int deleteDeptById (Long deptId);
|
||||||
|
|
||||||
|
List<SysDept> listDeptFind();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,10 @@ 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.req.AsNoticeUserReq;
|
||||||
|
import com.muyu.system.domain.req.SelectAsNoticeUserReq;
|
||||||
|
import com.muyu.system.domain.resp.AsNoticeUserResp;
|
||||||
|
import com.muyu.system.domain.resp.SysNoticeResp;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -27,7 +31,7 @@ public interface SysNoticeService extends IService<SysNotice> {
|
||||||
*
|
*
|
||||||
* @return 公告集合
|
* @return 公告集合
|
||||||
*/
|
*/
|
||||||
public List<SysNotice> selectNoticeList (SysNotice notice);
|
public List<SysNoticeResp> selectNoticeList (SysNotice notice);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增公告
|
* 新增公告
|
||||||
|
@ -36,7 +40,7 @@ public interface SysNoticeService extends IService<SysNotice> {
|
||||||
*
|
*
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int insertNotice (SysNotice notice);
|
public int insertNotice (AsNoticeUserReq notice);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改公告
|
* 修改公告
|
||||||
|
@ -64,4 +68,8 @@ public interface SysNoticeService extends IService<SysNotice> {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteNoticeByIds (Long[] noticeIds);
|
public int deleteNoticeByIds (Long[] noticeIds);
|
||||||
|
|
||||||
|
public List<AsNoticeUserResp> noticeByUserId(SelectAsNoticeUserReq req);
|
||||||
|
|
||||||
|
int updateAsNoticeUser(Long asNoticeId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,101 @@
|
||||||
|
package com.muyu.system.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.common.core.utils.DateUtils;
|
||||||
|
import com.muyu.common.system.domain.SysDept;
|
||||||
|
import com.muyu.system.mapper.SysDeptMapper;
|
||||||
|
import com.muyu.system.service.SysDeptService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.muyu.system.mapper.AsNoticeUserMapper;
|
||||||
|
import com.muyu.system.domain.AsNoticeUser;
|
||||||
|
import com.muyu.system.service.AsNoticeUserService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通知公告人员中间Service业务层处理
|
||||||
|
*
|
||||||
|
* @author muyu
|
||||||
|
* @date 2024-04-13
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class AsNoticeUserServiceImpl extends ServiceImpl<AsNoticeUserMapper, AsNoticeUser> implements AsNoticeUserService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private AsNoticeUserMapper asNoticeUserMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询通知公告人员中间
|
||||||
|
*
|
||||||
|
* @param id 通知公告人员中间主键
|
||||||
|
* @return 通知公告人员中间
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AsNoticeUser selectAsNoticeUserById(Long id)
|
||||||
|
{
|
||||||
|
return asNoticeUserMapper.selectAsNoticeUserById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询通知公告人员中间列表
|
||||||
|
*
|
||||||
|
* @param asNoticeUser 通知公告人员中间
|
||||||
|
* @return 通知公告人员中间
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<AsNoticeUser> selectAsNoticeUserList(AsNoticeUser asNoticeUser)
|
||||||
|
{
|
||||||
|
return asNoticeUserMapper.selectAsNoticeUserList(asNoticeUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增通知公告人员中间
|
||||||
|
*
|
||||||
|
* @param asNoticeUser 通知公告人员中间
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertAsNoticeUser(AsNoticeUser asNoticeUser)
|
||||||
|
{
|
||||||
|
asNoticeUser.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return asNoticeUserMapper.insertAsNoticeUser(asNoticeUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改通知公告人员中间
|
||||||
|
*
|
||||||
|
* @param asNoticeUser 通知公告人员中间
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateAsNoticeUser(AsNoticeUser asNoticeUser)
|
||||||
|
{
|
||||||
|
asNoticeUser.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return asNoticeUserMapper.updateAsNoticeUser(asNoticeUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除通知公告人员中间
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的通知公告人员中间主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteAsNoticeUserByIds(Long[] ids)
|
||||||
|
{
|
||||||
|
return asNoticeUserMapper.deleteAsNoticeUserByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除通知公告人员中间信息
|
||||||
|
*
|
||||||
|
* @param id 通知公告人员中间主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteAsNoticeUserById(Long id)
|
||||||
|
{
|
||||||
|
return asNoticeUserMapper.deleteAsNoticeUserById(id);
|
||||||
|
}
|
||||||
|
}
|
|
@ -15,6 +15,7 @@ import com.muyu.system.domain.vo.TreeSelect;
|
||||||
import com.muyu.system.mapper.SysDeptMapper;
|
import com.muyu.system.mapper.SysDeptMapper;
|
||||||
import com.muyu.system.mapper.SysRoleMapper;
|
import com.muyu.system.mapper.SysRoleMapper;
|
||||||
import com.muyu.system.service.SysDeptService;
|
import com.muyu.system.service.SysDeptService;
|
||||||
|
import lombok.extern.log4j.Log4j2;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@ -29,6 +30,7 @@ import java.util.stream.Collectors;
|
||||||
* @author muyu
|
* @author muyu
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@Log4j2
|
||||||
public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> implements SysDeptService {
|
public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> implements SysDeptService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysDeptMapper deptMapper;
|
private SysDeptMapper deptMapper;
|
||||||
|
@ -280,13 +282,29 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||||
return deptMapper.deleteDeptById(deptId);
|
return deptMapper.deleteDeptById(deptId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取部门树级结构
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<SysDept> listDeptFind() {
|
||||||
|
List<SysDept> sysDepts = new ArrayList<>();
|
||||||
|
List<SysDept> depts = this.selectDeptList(new SysDept(){{setDeptId(0L);}});
|
||||||
|
sysDepts = buildDeptTree(depts);
|
||||||
|
log.info(sysDepts);
|
||||||
|
return sysDepts;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 递归列表
|
* 递归列表
|
||||||
*/
|
*/
|
||||||
private void recursionFn (List<SysDept> list, SysDept t) {
|
private void recursionFn (List<SysDept> list, SysDept t) {
|
||||||
// 得到子节点列表
|
// 得到子节点列表
|
||||||
List<SysDept> childList = getChildList(list, t);
|
List<SysDept> childList = getChildList(list, t);
|
||||||
|
if (!childList.isEmpty()){
|
||||||
t.setChildren(childList);
|
t.setChildren(childList);
|
||||||
|
}
|
||||||
for (SysDept tChild : childList) {
|
for (SysDept tChild : childList) {
|
||||||
if (hasChild(list, tChild)) {
|
if (hasChild(list, tChild)) {
|
||||||
recursionFn(list, tChild);
|
recursionFn(list, tChild);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
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.core.constant.Constants;
|
import com.muyu.common.core.constant.Constants;
|
||||||
import com.muyu.common.core.constant.UserConstants;
|
import com.muyu.common.core.constant.UserConstants;
|
||||||
|
@ -93,9 +92,6 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||||
treeMenu(sysMenu);
|
treeMenu(sysMenu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// for (SysMenu sysMenu : sysMenus1) {
|
|
||||||
// sysMenus.addAll(treeMenu(sysMenu));
|
|
||||||
// }
|
|
||||||
return sysMenus1;
|
return sysMenus1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,27 @@
|
||||||
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.core.text.Convert;
|
||||||
|
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.AsNoticeUser;
|
||||||
import com.muyu.system.domain.SysNotice;
|
import com.muyu.system.domain.SysNotice;
|
||||||
|
import com.muyu.system.domain.SysPost;
|
||||||
|
import com.muyu.system.domain.req.AsNoticeUserReq;
|
||||||
|
import com.muyu.system.domain.req.SelectAsNoticeUserReq;
|
||||||
|
import com.muyu.system.domain.resp.AsNoticeUserResp;
|
||||||
|
import com.muyu.system.domain.resp.SysNoticeResp;
|
||||||
import com.muyu.system.mapper.SysNoticeMapper;
|
import com.muyu.system.mapper.SysNoticeMapper;
|
||||||
import com.muyu.system.service.SysNoticeService;
|
import com.muyu.system.service.*;
|
||||||
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.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公告 服务层实现
|
* 公告 服务层实现
|
||||||
|
@ -19,11 +33,23 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysNoticeMapper noticeMapper;
|
private SysNoticeMapper noticeMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AsNoticeUserService asNoticeUserService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysUserService userService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysPostService postService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysDeptService deptService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询公告信息
|
* 查询公告信息
|
||||||
*
|
*
|
||||||
* @param noticeId 公告ID
|
* @param noticeId 公告ID
|
||||||
*
|
|
||||||
* @return 公告信息
|
* @return 公告信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -35,31 +61,79 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
||||||
* 查询公告列表
|
* 查询公告列表
|
||||||
*
|
*
|
||||||
* @param notice 公告信息
|
* @param notice 公告信息
|
||||||
*
|
|
||||||
* @return 公告集合
|
* @return 公告集合
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysNotice> selectNoticeList (SysNotice notice) {
|
public List<SysNoticeResp> selectNoticeList(SysNotice notice) {
|
||||||
return noticeMapper.selectNoticeList(notice);
|
List<SysNotice> sysNotices = noticeMapper.selectNoticeList(notice);
|
||||||
|
List<SysNoticeResp> sysNoticeRespList = sysNotices.stream().map(sysNotice -> {
|
||||||
|
//通知总数
|
||||||
|
List<AsNoticeUser> allList = asNoticeUserService.list(new LambdaQueryWrapper<AsNoticeUser>() {{
|
||||||
|
eq(AsNoticeUser::getNoticeId, sysNotice.getNoticeId());
|
||||||
|
}});
|
||||||
|
//已读数量
|
||||||
|
long allCount = allList.size();
|
||||||
|
long readCount = allList.stream().filter(user -> "Y".equals(user.getReadStates())).count();
|
||||||
|
long unReadCount = allCount - readCount;
|
||||||
|
|
||||||
|
SysNoticeResp sysNoticeResp = SysNoticeResp.saveBuilder(sysNotice);
|
||||||
|
if (!allList.isEmpty()) {
|
||||||
|
sysNoticeResp.setEndTime(allList.get(0).getEndTime());
|
||||||
|
}
|
||||||
|
sysNoticeResp.setNum(allCount);
|
||||||
|
sysNoticeResp.setReadNum(readCount);
|
||||||
|
sysNoticeResp.setUnReadNum(unReadCount);
|
||||||
|
return sysNoticeResp;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
return sysNoticeRespList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增公告
|
* 新增公告
|
||||||
*
|
*
|
||||||
* @param notice 公告信息
|
* @param req 公告信息
|
||||||
*
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int insertNotice (SysNotice notice) {
|
public int insertNotice(AsNoticeUserReq req) {
|
||||||
return noticeMapper.insertNotice(notice);
|
SysNotice sysNotice = SysNotice.saveBuilder(req, SecurityUtils::getUsername);
|
||||||
|
int i = noticeMapper.insertNotice(sysNotice);
|
||||||
|
|
||||||
|
if (i > 0) {
|
||||||
|
SysUser sysUser = userService.selectUserById(SecurityUtils.getUserId());
|
||||||
|
List<SysPost> list = postService.selectPostListByUserId(SecurityUtils.getUserId()).stream().map(postId -> postService.selectPostById(postId)).toList();
|
||||||
|
SysDept dept = deptService.selectDeptById(sysUser.getDeptId());
|
||||||
|
StringBuffer buffer = new StringBuffer();
|
||||||
|
list.forEach(sysPost -> buffer.append(sysPost.getPostName()));
|
||||||
|
req.setCreateBy(sysUser.getUserName() + "(" + dept.getDeptName() + "/" + String.valueOf(buffer) + ")");
|
||||||
|
List<Long> userCheckedList = req.getUserCheckedList();
|
||||||
|
List<Long> finalUserCheckedList = userCheckedList;
|
||||||
|
req.getSelectedOptions().forEach(deptId ->
|
||||||
|
finalUserCheckedList.addAll(userService.selectUserList(new SysUser() {{
|
||||||
|
setDeptId(deptId);
|
||||||
|
}}).stream().map(SysUser::getUserId).toList()
|
||||||
|
));
|
||||||
|
userCheckedList = userCheckedList.stream().distinct().toList();
|
||||||
|
List<AsNoticeUser> asNoticeUserList = userCheckedList.stream().map(userId ->
|
||||||
|
AsNoticeUser.builder()
|
||||||
|
.endTime(req.getInDateTime())
|
||||||
|
.userId(userId)
|
||||||
|
.noticeId(sysNotice.getNoticeId())
|
||||||
|
.outStates("N")
|
||||||
|
.readStates("N")
|
||||||
|
.createBy(req.getCreateBy())
|
||||||
|
.createTime(new Date())
|
||||||
|
.build()).collect(Collectors.toList());
|
||||||
|
|
||||||
|
asNoticeUserService.saveBatch(asNoticeUserList);
|
||||||
|
}
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改公告
|
* 修改公告
|
||||||
*
|
*
|
||||||
* @param notice 公告信息
|
* @param notice 公告信息
|
||||||
*
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -71,7 +145,6 @@ public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice
|
||||||
* 删除公告对象
|
* 删除公告对象
|
||||||
*
|
*
|
||||||
* @param noticeId 公告ID
|
* @param noticeId 公告ID
|
||||||
*
|
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -83,11 +156,58 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户获取收到的通知和公告
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<AsNoticeUserResp> noticeByUserId(SelectAsNoticeUserReq req) {
|
||||||
|
List<AsNoticeUser> list = asNoticeUserService.
|
||||||
|
list(new LambdaQueryWrapper<AsNoticeUser>() {{
|
||||||
|
eq(AsNoticeUser::getUserId, SecurityUtils.getUserId());
|
||||||
|
ge(AsNoticeUser::getEndTime, new Date());
|
||||||
|
if (req.getReadStates() != null && !req.getReadStates().isEmpty())
|
||||||
|
eq(AsNoticeUser::getReadStates, req.getReadStates());
|
||||||
|
}}
|
||||||
|
);
|
||||||
|
List<AsNoticeUserResp> result = new ArrayList<>();
|
||||||
|
list.forEach(noticeUser -> {
|
||||||
|
SysNotice sysNotice = this.getOne(new LambdaQueryWrapper<SysNotice>() {{
|
||||||
|
eq(SysNotice::getNoticeId, noticeUser.getNoticeId());
|
||||||
|
if (req.getNoticeType() != null && !req.getNoticeType().isEmpty() &&!req.getNoticeType().equals("0"))
|
||||||
|
eq(SysNotice::getNoticeType, req.getNoticeType());
|
||||||
|
}});
|
||||||
|
if (sysNotice!=null){
|
||||||
|
AsNoticeUserResp apply = AsNoticeUserResp.builder()
|
||||||
|
.asNoticeId(noticeUser.getId())
|
||||||
|
.endTime(noticeUser.getEndTime())
|
||||||
|
.createTime(noticeUser.getCreateTime())
|
||||||
|
.createBy(noticeUser.getCreateBy())
|
||||||
|
.noticeType(sysNotice.getNoticeType())
|
||||||
|
.readStates(noticeUser.getReadStates())
|
||||||
|
.sysNotice(sysNotice)
|
||||||
|
.build();
|
||||||
|
result.add(apply);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateAsNoticeUser(Long asNoticeId) {
|
||||||
|
|
||||||
|
AsNoticeUser asNoticeUser = new AsNoticeUser() {{
|
||||||
|
setReadStates("Y");
|
||||||
|
setId(asNoticeId);
|
||||||
|
}};
|
||||||
|
return asNoticeUserService.updateAsNoticeUser(asNoticeUser);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,95 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.muyu.system.mapper.AsNoticeUserMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.muyu.system.domain.AsNoticeUser" id="AsNoticeUserResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="noticeId" column="notice_id" />
|
||||||
|
<result property="userId" column="user_id" />
|
||||||
|
<result property="readStates" column="read_states" />
|
||||||
|
<result property="endTime" column="end_time" />
|
||||||
|
<result property="outStates" column="out_states" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectAsNoticeUserVo">
|
||||||
|
select id, notice_id, user_id, read_states, end_time, out_states, create_by, create_time, update_by, update_time from as_notice_user
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectAsNoticeUserList" parameterType="com.muyu.system.domain.AsNoticeUser" resultMap="AsNoticeUserResult">
|
||||||
|
<include refid="selectAsNoticeUserVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="noticeId != null "> and notice_id = #{noticeId}</if>
|
||||||
|
<if test="userId != null "> and user_id = #{userId}</if>
|
||||||
|
<if test="readStates != null and readStates != ''"> and read_states = #{readStates}</if>
|
||||||
|
<if test="endTime != null "> and end_time = #{endTime}</if>
|
||||||
|
<if test="outStates != null and outStates != ''"> and out_states = #{outStates}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAsNoticeUserById" parameterType="Long" resultMap="AsNoticeUserResult">
|
||||||
|
<include refid="selectAsNoticeUserVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertAsNoticeUser" parameterType="com.muyu.system.domain.AsNoticeUser">
|
||||||
|
insert into as_notice_user
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">id,</if>
|
||||||
|
<if test="noticeId != null">notice_id,</if>
|
||||||
|
|
||||||
|
<if test="userId != null">user_id,</if>
|
||||||
|
<if test="readStates != null and readStates != ''">read_states,</if>
|
||||||
|
<if test="endTime != null">end_time,</if>
|
||||||
|
<if test="outStates != null and outStates != ''">out_states,</if>
|
||||||
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">#{id},</if>
|
||||||
|
<if test="noticeId != null">#{noticeId},</if>
|
||||||
|
<if test="userId != null">#{userId},</if>
|
||||||
|
<if test="readStates != null and readStates != ''">#{readStates},</if>
|
||||||
|
<if test="endTime != null">#{endTime},</if>
|
||||||
|
<if test="outStates != null and outStates != ''">#{outStates},</if>
|
||||||
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateAsNoticeUser" parameterType="com.muyu.system.domain.AsNoticeUser">
|
||||||
|
update as_notice_user
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="noticeId != null">notice_id = #{noticeId},</if>
|
||||||
|
<if test="userId != null">user_id = #{userId},</if>
|
||||||
|
<if test="readStates != null and readStates != ''">read_states = #{readStates},</if>
|
||||||
|
<if test="endTime != null">end_time = #{endTime},</if>
|
||||||
|
<if test="outStates != null and outStates != ''">out_states = #{outStates},</if>
|
||||||
|
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteAsNoticeUserById" parameterType="Long">
|
||||||
|
delete from as_notice_user where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteAsNoticeUserByIds" parameterType="String">
|
||||||
|
delete from as_notice_user where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
|
@ -51,7 +51,7 @@
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertNotice" parameterType="com.muyu.system.domain.SysNotice">
|
<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>
|
||||||
|
|
Loading…
Reference in New Issue