新增通知历史列表,在线发送通知功能,处理通知发送逻辑,增加发送状态
This commit is contained in:
parent
d1bd705350
commit
aaad74eb29
@ -1,10 +1,12 @@
|
|||||||
package ink.wgink.module.instantmessage.controller.api;
|
package ink.wgink.module.instantmessage.controller.api;
|
||||||
|
|
||||||
import ink.wgink.annotation.CheckRequestBodyAnnotation;
|
import ink.wgink.annotation.CheckRequestBodyAnnotation;
|
||||||
|
import ink.wgink.common.base.DefaultBaseController;
|
||||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||||
import ink.wgink.module.instantmessage.pojo.bos.NoticeBO;
|
import ink.wgink.module.instantmessage.pojo.bos.NoticeBO;
|
||||||
import ink.wgink.module.instantmessage.pojo.bos.NoticeTargetBO;
|
import ink.wgink.module.instantmessage.pojo.bos.NoticeTargetBO;
|
||||||
import ink.wgink.module.instantmessage.pojo.vos.MessageVO;
|
import ink.wgink.module.instantmessage.pojo.vos.MessageVO;
|
||||||
|
import ink.wgink.module.instantmessage.pojo.vos.NoticeSendVO;
|
||||||
import ink.wgink.module.instantmessage.service.IMessageService;
|
import ink.wgink.module.instantmessage.service.IMessageService;
|
||||||
import ink.wgink.pojo.result.ErrorResult;
|
import ink.wgink.pojo.result.ErrorResult;
|
||||||
import ink.wgink.pojo.result.SuccessResult;
|
import ink.wgink.pojo.result.SuccessResult;
|
||||||
@ -27,11 +29,20 @@ import java.util.Arrays;
|
|||||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "消息接口")
|
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "消息接口")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(ISystemConstant.API_PREFIX + "/websocket/message")
|
@RequestMapping(ISystemConstant.API_PREFIX + "/websocket/message")
|
||||||
public class WebSocketMessageController {
|
public class WebSocketMessageController extends DefaultBaseController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IMessageService messageService;
|
private IMessageService messageService;
|
||||||
|
|
||||||
|
@ApiOperation(value = "通知消息", notes = "通知消息接口")
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@PostMapping("notice")
|
||||||
|
@CheckRequestBodyAnnotation
|
||||||
|
public SuccessResult notice(@RequestBody NoticeSendVO noticeSendVO) throws Exception {
|
||||||
|
messageService.notice(noticeSendVO);
|
||||||
|
return new SuccessResult();
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "通知消息", notes = "通知消息接口")
|
@ApiOperation(value = "通知消息", notes = "通知消息接口")
|
||||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
@PostMapping("notice/{clientName}")
|
@PostMapping("notice/{clientName}")
|
||||||
|
@ -0,0 +1,73 @@
|
|||||||
|
package ink.wgink.module.instantmessage.controller.api;
|
||||||
|
|
||||||
|
import ink.wgink.annotation.CheckRequestBodyAnnotation;
|
||||||
|
import ink.wgink.common.base.DefaultBaseController;
|
||||||
|
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||||
|
import ink.wgink.module.instantmessage.pojo.dtos.NoticeDTO;
|
||||||
|
import ink.wgink.module.instantmessage.pojo.vos.NoticeSendVO;
|
||||||
|
import ink.wgink.module.instantmessage.service.INoticeService;
|
||||||
|
import ink.wgink.pojo.ListPage;
|
||||||
|
import ink.wgink.pojo.result.ErrorResult;
|
||||||
|
import ink.wgink.pojo.result.SuccessResult;
|
||||||
|
import ink.wgink.pojo.result.SuccessResultList;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When you feel like quitting. Think about why you started
|
||||||
|
* 当你想要放弃的时候,想想当初你为何开始
|
||||||
|
*
|
||||||
|
* @ClassName: MessageController
|
||||||
|
* @Description: 消息
|
||||||
|
* @Author: wanggeng
|
||||||
|
* @Date: 2021/1/14 3:25 下午
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "消息接口")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(ISystemConstant.API_PREFIX + "/websocket/notice")
|
||||||
|
public class WebSocketNoticeController extends DefaultBaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private INoticeService noticeService;
|
||||||
|
|
||||||
|
@ApiOperation(value = "删除通知", notes = "删除通知接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "noticeIds", value = "通知ID列表", paramType = "path"),
|
||||||
|
})
|
||||||
|
@DeleteMapping("remove/{noticeIds}")
|
||||||
|
public SuccessResult delete(@PathVariable("noticeIds") String noticeIds) {
|
||||||
|
noticeService.remove(Arrays.asList(noticeIds.split("\\_")));
|
||||||
|
return new SuccessResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "通知列表", notes = "通知列表接口")
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("list")
|
||||||
|
public List<NoticeDTO> list() {
|
||||||
|
Map<String, Object> params = requestParams();
|
||||||
|
return noticeService.list(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "通知分页列表", notes = "通知分页列表接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
|
||||||
|
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
|
||||||
|
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
|
||||||
|
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
|
||||||
|
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("listpage")
|
||||||
|
public SuccessResultList<List<NoticeDTO>> listPage(ListPage page) {
|
||||||
|
Map<String, Object> params = requestParams();
|
||||||
|
page.setParams(params);
|
||||||
|
return noticeService.listPage(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package ink.wgink.module.instantmessage.controller.route;
|
||||||
|
|
||||||
|
import ink.wgink.common.base.DefaultBaseController;
|
||||||
|
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName: NoticeController
|
||||||
|
* @Description: 即使消息通知路由
|
||||||
|
* @Author: CodeFactory
|
||||||
|
* @Date: 2021-10-22 11:04:57
|
||||||
|
* @Version: 3.0
|
||||||
|
**/
|
||||||
|
@Api(tags = ISystemConstant.ROUTE_TAGS_PREFIX + "即使消息通知路由")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(ISystemConstant.ROUTE_PREFIX + "/websocket/notice")
|
||||||
|
public class WebSocketNoticeRouteController extends DefaultBaseController {
|
||||||
|
|
||||||
|
@GetMapping("send")
|
||||||
|
public ModelAndView send() {
|
||||||
|
return new ModelAndView("notice/send");
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("list")
|
||||||
|
public ModelAndView list() {
|
||||||
|
return new ModelAndView("notice/list");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -5,6 +5,7 @@ import ink.wgink.exceptions.SaveException;
|
|||||||
import ink.wgink.exceptions.SearchException;
|
import ink.wgink.exceptions.SearchException;
|
||||||
import ink.wgink.exceptions.UpdateException;
|
import ink.wgink.exceptions.UpdateException;
|
||||||
import ink.wgink.interfaces.init.IInitBaseTable;
|
import ink.wgink.interfaces.init.IInitBaseTable;
|
||||||
|
import ink.wgink.module.instantmessage.pojo.dtos.NoticeDTO;
|
||||||
import ink.wgink.module.instantmessage.pojo.pos.NoticePO;
|
import ink.wgink.module.instantmessage.pojo.pos.NoticePO;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
@ -101,4 +102,21 @@ public interface INoticeDao extends IInitBaseTable {
|
|||||||
* @throws RemoveException
|
* @throws RemoveException
|
||||||
*/
|
*/
|
||||||
void delete(Map<String, Object> params) throws RemoveException;
|
void delete(Map<String, Object> params) throws RemoveException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*
|
||||||
|
* @param params
|
||||||
|
* @throws RemoveException
|
||||||
|
*/
|
||||||
|
void remove(Map<String, Object> params) throws RemoveException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通知列表
|
||||||
|
*
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
* @throws SearchException
|
||||||
|
*/
|
||||||
|
List<NoticeDTO> list(Map<String, Object> params) throws SearchException;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,166 @@
|
|||||||
|
package ink.wgink.module.instantmessage.pojo.dtos;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName: NoticeDTO
|
||||||
|
* @Description: 通知
|
||||||
|
* @Author: wanggeng
|
||||||
|
* @Date: 2021/10/22 11:18 上午
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
@ApiModel
|
||||||
|
public class NoticeDTO {
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "noticeId", value = "通知标题")
|
||||||
|
private String noticeId;
|
||||||
|
@ApiModelProperty(name = "noticeTitle", value = "通知内容")
|
||||||
|
private String noticeTitle;
|
||||||
|
@ApiModelProperty(name = "noticeMsg", value = "通知内容")
|
||||||
|
private String noticeMsg;
|
||||||
|
@ApiModelProperty(name = "noticeTarget", value = "通知触发目标")
|
||||||
|
private String noticeTarget;
|
||||||
|
@ApiModelProperty(name = "noticeSystem", value = "通知业务系统")
|
||||||
|
private String noticeSystem;
|
||||||
|
@ApiModelProperty(name = "noticeModule", value = "通知业务模块")
|
||||||
|
private String noticeModule;
|
||||||
|
@ApiModelProperty(name = "noticeMenu", value = "通知业务菜单")
|
||||||
|
private String noticeMenu;
|
||||||
|
@ApiModelProperty(name = "noticeServiceId", value = "通知业务ID")
|
||||||
|
private String noticeServiceId;
|
||||||
|
@ApiModelProperty(name = "userId", value = "通知人")
|
||||||
|
private String userId;
|
||||||
|
@ApiModelProperty(name = "userName", value = "通知人昵称")
|
||||||
|
private String userName;
|
||||||
|
@ApiModelProperty(name = "userUsername", value = "通知人用户名")
|
||||||
|
private String userUsername;
|
||||||
|
@ApiModelProperty(name = "isSend", value = "是否发送")
|
||||||
|
private Integer isSend;
|
||||||
|
@ApiModelProperty(name = "isHandle", value = "是否处理")
|
||||||
|
private Integer isHandle;
|
||||||
|
@ApiModelProperty(name = "gmtCreate", value = "创建时间")
|
||||||
|
private String gmtCreate;
|
||||||
|
@ApiModelProperty(name = "gmtModified", value = "修改时间")
|
||||||
|
private String gmtModified;
|
||||||
|
|
||||||
|
public String getNoticeId() {
|
||||||
|
return noticeId == null ? "" : noticeId.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNoticeId(String noticeId) {
|
||||||
|
this.noticeId = noticeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNoticeTitle() {
|
||||||
|
return noticeTitle == null ? "" : noticeTitle.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNoticeTitle(String noticeTitle) {
|
||||||
|
this.noticeTitle = noticeTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNoticeMsg() {
|
||||||
|
return noticeMsg == null ? "" : noticeMsg.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNoticeMsg(String noticeMsg) {
|
||||||
|
this.noticeMsg = noticeMsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNoticeTarget() {
|
||||||
|
return noticeTarget == null ? "" : noticeTarget.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNoticeTarget(String noticeTarget) {
|
||||||
|
this.noticeTarget = noticeTarget;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNoticeSystem() {
|
||||||
|
return noticeSystem == null ? "" : noticeSystem.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNoticeSystem(String noticeSystem) {
|
||||||
|
this.noticeSystem = noticeSystem;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNoticeModule() {
|
||||||
|
return noticeModule == null ? "" : noticeModule.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNoticeModule(String noticeModule) {
|
||||||
|
this.noticeModule = noticeModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNoticeMenu() {
|
||||||
|
return noticeMenu == null ? "" : noticeMenu.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNoticeMenu(String noticeMenu) {
|
||||||
|
this.noticeMenu = noticeMenu;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNoticeServiceId() {
|
||||||
|
return noticeServiceId == null ? "" : noticeServiceId.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNoticeServiceId(String noticeServiceId) {
|
||||||
|
this.noticeServiceId = noticeServiceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserId() {
|
||||||
|
return userId == null ? "" : userId.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(String userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserName() {
|
||||||
|
return userName == null ? "" : userName.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserName(String userName) {
|
||||||
|
this.userName = userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserUsername() {
|
||||||
|
return userUsername == null ? "" : userUsername.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserUsername(String userUsername) {
|
||||||
|
this.userUsername = userUsername;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getIsSend() {
|
||||||
|
return isSend == null ? 0 : isSend;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsSend(Integer isSend) {
|
||||||
|
this.isSend = isSend;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getIsHandle() {
|
||||||
|
return isHandle == null ? 0 : isHandle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsHandle(Integer isHandle) {
|
||||||
|
this.isHandle = isHandle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGmtCreate() {
|
||||||
|
return gmtCreate == null ? "" : gmtCreate.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGmtCreate(String gmtCreate) {
|
||||||
|
this.gmtCreate = gmtCreate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGmtModified() {
|
||||||
|
return gmtModified == null ? "" : gmtModified.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGmtModified(String gmtModified) {
|
||||||
|
this.gmtModified = gmtModified;
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,7 @@
|
|||||||
package ink.wgink.module.instantmessage.pojo.pos;
|
package ink.wgink.module.instantmessage.pojo.pos;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When you feel like quitting. Think about why you started
|
* When you feel like quitting. Think about why you started
|
||||||
* 当你想要放弃的时候,想想当初你为何开始
|
* 当你想要放弃的时候,想想当初你为何开始
|
||||||
@ -10,8 +12,9 @@ package ink.wgink.module.instantmessage.pojo.pos;
|
|||||||
* @Date: 2021/3/29 4:39 下午
|
* @Date: 2021/3/29 4:39 下午
|
||||||
* @Version: 1.0
|
* @Version: 1.0
|
||||||
*/
|
*/
|
||||||
public class NoticePO {
|
public class NoticePO implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -7182904168489429255L;
|
||||||
private Long id;
|
private Long id;
|
||||||
private String noticeId;
|
private String noticeId;
|
||||||
private String noticeTitle;
|
private String noticeTitle;
|
||||||
@ -22,6 +25,9 @@ public class NoticePO {
|
|||||||
private String noticeMenu;
|
private String noticeMenu;
|
||||||
private String noticeServiceId;
|
private String noticeServiceId;
|
||||||
private String userId;
|
private String userId;
|
||||||
|
private String userName;
|
||||||
|
private String userUsername;
|
||||||
|
private Integer isSend;
|
||||||
private Integer isHandle;
|
private Integer isHandle;
|
||||||
private String gmtCreate;
|
private String gmtCreate;
|
||||||
private String creator;
|
private String creator;
|
||||||
@ -109,6 +115,30 @@ public class NoticePO {
|
|||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getUserName() {
|
||||||
|
return userName == null ? "" : userName.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserName(String userName) {
|
||||||
|
this.userName = userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserUsername() {
|
||||||
|
return userUsername == null ? "" : userUsername.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserUsername(String userUsername) {
|
||||||
|
this.userUsername = userUsername;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getIsSend() {
|
||||||
|
return isSend == null ? 0 : isSend;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsSend(Integer isSend) {
|
||||||
|
this.isSend = isSend;
|
||||||
|
}
|
||||||
|
|
||||||
public Integer getIsHandle() {
|
public Integer getIsHandle() {
|
||||||
return isHandle == null ? 0 : isHandle;
|
return isHandle == null ? 0 : isHandle;
|
||||||
}
|
}
|
||||||
@ -157,42 +187,5 @@ public class NoticePO {
|
|||||||
this.isDelete = isDelete;
|
this.isDelete = isDelete;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
final StringBuilder sb = new StringBuilder("{");
|
|
||||||
sb.append("\"id\":")
|
|
||||||
.append(id);
|
|
||||||
sb.append(",\"noticeId\":\"")
|
|
||||||
.append(noticeId).append('\"');
|
|
||||||
sb.append(",\"noticeTitle\":\"")
|
|
||||||
.append(noticeTitle).append('\"');
|
|
||||||
sb.append(",\"noticeMsg\":\"")
|
|
||||||
.append(noticeMsg).append('\"');
|
|
||||||
sb.append(",\"noticeTarget\":\"")
|
|
||||||
.append(noticeTarget).append('\"');
|
|
||||||
sb.append(",\"noticeSystem\":\"")
|
|
||||||
.append(noticeSystem).append('\"');
|
|
||||||
sb.append(",\"noticeModule\":\"")
|
|
||||||
.append(noticeModule).append('\"');
|
|
||||||
sb.append(",\"noticeMenu\":\"")
|
|
||||||
.append(noticeMenu).append('\"');
|
|
||||||
sb.append(",\"noticeServiceId\":\"")
|
|
||||||
.append(noticeServiceId).append('\"');
|
|
||||||
sb.append(",\"userId\":\"")
|
|
||||||
.append(userId).append('\"');
|
|
||||||
sb.append(",\"isHandle\":")
|
|
||||||
.append(isHandle);
|
|
||||||
sb.append(",\"gmtCreate\":\"")
|
|
||||||
.append(gmtCreate).append('\"');
|
|
||||||
sb.append(",\"creator\":\"")
|
|
||||||
.append(creator).append('\"');
|
|
||||||
sb.append(",\"gmtModified\":\"")
|
|
||||||
.append(gmtModified).append('\"');
|
|
||||||
sb.append(",\"modifier\":\"")
|
|
||||||
.append(modifier).append('\"');
|
|
||||||
sb.append(",\"isDelete\":")
|
|
||||||
.append(isDelete);
|
|
||||||
sb.append('}');
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,50 @@
|
|||||||
|
package ink.wgink.module.instantmessage.pojo.vos;
|
||||||
|
|
||||||
|
import ink.wgink.annotation.CheckEmptyAnnotation;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ClassName: NoticeSendVO
|
||||||
|
* @Description: 通知发送
|
||||||
|
* @Author: wanggeng
|
||||||
|
* @Date: 2021/10/22 12:43 下午
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
@ApiModel
|
||||||
|
public class NoticeSendVO {
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "noticeTitle", value = "通知标题")
|
||||||
|
@CheckEmptyAnnotation(name = "通知标题")
|
||||||
|
private String noticeTitle;
|
||||||
|
@ApiModelProperty(name = "noticeMsg", value = "通知内容")
|
||||||
|
@CheckEmptyAnnotation(name = "通知内容")
|
||||||
|
private String noticeMsg;
|
||||||
|
@ApiModelProperty(name = "noticeUserIds", value = "通知用户ID列表")
|
||||||
|
@CheckEmptyAnnotation(name = "通知用户ID列表")
|
||||||
|
private String noticeUserIds;
|
||||||
|
|
||||||
|
public String getNoticeTitle() {
|
||||||
|
return noticeTitle == null ? "" : noticeTitle.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNoticeTitle(String noticeTitle) {
|
||||||
|
this.noticeTitle = noticeTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNoticeMsg() {
|
||||||
|
return noticeMsg == null ? "" : noticeMsg.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNoticeMsg(String noticeMsg) {
|
||||||
|
this.noticeMsg = noticeMsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNoticeUserIds() {
|
||||||
|
return noticeUserIds == null ? "" : noticeUserIds.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNoticeUserIds(String noticeUserIds) {
|
||||||
|
this.noticeUserIds = noticeUserIds;
|
||||||
|
}
|
||||||
|
}
|
@ -2,6 +2,7 @@ package ink.wgink.module.instantmessage.service;
|
|||||||
|
|
||||||
import ink.wgink.module.instantmessage.pojo.bos.NoticeBO;
|
import ink.wgink.module.instantmessage.pojo.bos.NoticeBO;
|
||||||
import ink.wgink.module.instantmessage.pojo.bos.NoticeTargetBO;
|
import ink.wgink.module.instantmessage.pojo.bos.NoticeTargetBO;
|
||||||
|
import ink.wgink.module.instantmessage.pojo.vos.NoticeSendVO;
|
||||||
import ink.wgink.module.instantmessage.pojo.vos.NoticeVO;
|
import ink.wgink.module.instantmessage.pojo.vos.NoticeVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -18,6 +19,13 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface IMessageService {
|
public interface IMessageService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通知
|
||||||
|
*
|
||||||
|
* @param noticeSendVO
|
||||||
|
*/
|
||||||
|
void notice(NoticeSendVO noticeSendVO) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通知
|
* 通知
|
||||||
*
|
*
|
||||||
@ -61,4 +69,5 @@ public interface IMessageService {
|
|||||||
* @param serviceIds
|
* @param serviceIds
|
||||||
*/
|
*/
|
||||||
void delete(List<String> serviceIds);
|
void delete(List<String> serviceIds);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
package ink.wgink.module.instantmessage.service;
|
package ink.wgink.module.instantmessage.service;
|
||||||
|
|
||||||
import ink.wgink.module.instantmessage.pojo.bos.NoticeBO;
|
import ink.wgink.module.instantmessage.pojo.dtos.NoticeDTO;
|
||||||
import ink.wgink.module.instantmessage.pojo.bos.NoticeTargetBO;
|
|
||||||
import ink.wgink.module.instantmessage.pojo.pos.NoticePO;
|
import ink.wgink.module.instantmessage.pojo.pos.NoticePO;
|
||||||
|
import ink.wgink.module.instantmessage.pojo.vos.NoticeSendVO;
|
||||||
import ink.wgink.module.instantmessage.pojo.vos.NoticeVO;
|
import ink.wgink.module.instantmessage.pojo.vos.NoticeVO;
|
||||||
import ink.wgink.module.instantmessage.websocket.pojo.body.CountNeedToDealWithBody;
|
import ink.wgink.module.instantmessage.websocket.pojo.body.CountNeedToDealWithBody;
|
||||||
|
import ink.wgink.pojo.ListPage;
|
||||||
|
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||||
|
import ink.wgink.pojo.result.SuccessResultList;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -24,10 +27,11 @@ public interface INoticeService {
|
|||||||
/**
|
/**
|
||||||
* 保存
|
* 保存
|
||||||
*
|
*
|
||||||
* @param userId
|
* @param userDTO
|
||||||
* @param notice
|
* @param notice 通知内容
|
||||||
|
* @param isSend 是否发送
|
||||||
*/
|
*/
|
||||||
void save(String userId, NoticeVO.Notice notice) throws Exception;
|
void save(UserDTO userDTO, NoticeVO.Notice notice, boolean isSend) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新已办状态
|
* 更新已办状态
|
||||||
@ -161,6 +165,13 @@ public interface INoticeService {
|
|||||||
*/
|
*/
|
||||||
void deleteByServiceIds(List<String> serviceIds);
|
void deleteByServiceIds(List<String> serviceIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除通知
|
||||||
|
*
|
||||||
|
* @param noticeIds
|
||||||
|
*/
|
||||||
|
void remove(List<String> noticeIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通知列表
|
* 通知列表
|
||||||
*
|
*
|
||||||
@ -169,4 +180,27 @@ public interface INoticeService {
|
|||||||
*/
|
*/
|
||||||
List<NoticePO> listPO(List<String> serviceIds);
|
List<NoticePO> listPO(List<String> serviceIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通知列表
|
||||||
|
*
|
||||||
|
* @param params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<NoticeDTO> list(Map<String, Object> params);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通知分页列表
|
||||||
|
*
|
||||||
|
* @param page
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
SuccessResultList<List<NoticeDTO>> listPage(ListPage page);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送通知
|
||||||
|
*
|
||||||
|
* @param noticeSendVO
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
void notice(NoticeSendVO noticeSendVO) throws Exception;
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,11 @@ import com.alibaba.fastjson.JSONArray;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import ink.wgink.common.base.DefaultBaseService;
|
import ink.wgink.common.base.DefaultBaseService;
|
||||||
import ink.wgink.exceptions.SearchException;
|
import ink.wgink.exceptions.SearchException;
|
||||||
|
import ink.wgink.interfaces.user.IUserBaseService;
|
||||||
import ink.wgink.module.instantmessage.pojo.bos.NoticeBO;
|
import ink.wgink.module.instantmessage.pojo.bos.NoticeBO;
|
||||||
import ink.wgink.module.instantmessage.pojo.bos.NoticeTargetBO;
|
import ink.wgink.module.instantmessage.pojo.bos.NoticeTargetBO;
|
||||||
import ink.wgink.module.instantmessage.pojo.pos.NoticePO;
|
import ink.wgink.module.instantmessage.pojo.pos.NoticePO;
|
||||||
|
import ink.wgink.module.instantmessage.pojo.vos.NoticeSendVO;
|
||||||
import ink.wgink.module.instantmessage.pojo.vos.NoticeVO;
|
import ink.wgink.module.instantmessage.pojo.vos.NoticeVO;
|
||||||
import ink.wgink.module.instantmessage.service.IMessageService;
|
import ink.wgink.module.instantmessage.service.IMessageService;
|
||||||
import ink.wgink.module.instantmessage.service.INoticeService;
|
import ink.wgink.module.instantmessage.service.INoticeService;
|
||||||
@ -16,17 +18,16 @@ import ink.wgink.module.instantmessage.websocket.pojo.WebSocketClientMessage;
|
|||||||
import ink.wgink.module.instantmessage.websocket.pojo.WebSocketSession;
|
import ink.wgink.module.instantmessage.websocket.pojo.WebSocketSession;
|
||||||
import ink.wgink.module.instantmessage.websocket.pojo.body.CountNeedToDealWithBody;
|
import ink.wgink.module.instantmessage.websocket.pojo.body.CountNeedToDealWithBody;
|
||||||
import ink.wgink.module.instantmessage.websocket.pojo.body.NoticeBody;
|
import ink.wgink.module.instantmessage.websocket.pojo.body.NoticeBody;
|
||||||
|
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||||
import ink.wgink.util.BeanPropertyCheckUtil;
|
import ink.wgink.util.BeanPropertyCheckUtil;
|
||||||
|
import ink.wgink.util.UUIDUtil;
|
||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import org.apache.commons.compress.utils.Sets;
|
import org.apache.commons.compress.utils.Sets;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
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.*;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@ -46,8 +47,27 @@ public class MessageServiceImpl extends DefaultBaseService implements IMessageSe
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private INoticeService noticeService;
|
private INoticeService noticeService;
|
||||||
|
@Autowired
|
||||||
|
private IUserBaseService userBaseService;
|
||||||
private ScheduledExecutorService scheduledExecutorService = new ScheduledThreadPoolExecutor(2);
|
private ScheduledExecutorService scheduledExecutorService = new ScheduledThreadPoolExecutor(2);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void notice(NoticeSendVO noticeSendVO) throws Exception {
|
||||||
|
NoticeVO.Notice notice = new NoticeVO.Notice();
|
||||||
|
notice.setTitle(noticeSendVO.getNoticeTitle());
|
||||||
|
notice.setMsg(noticeSendVO.getNoticeMsg());
|
||||||
|
notice.setServiceId("IM_NOTICE:" + UUIDUtil.getUUID());
|
||||||
|
notice.setSystem("IM");
|
||||||
|
notice.setUserIds(Arrays.asList(noticeSendVO.getNoticeUserIds().split("\\_")));
|
||||||
|
|
||||||
|
List<NoticeVO.Notice> notices = new ArrayList<>();
|
||||||
|
notices.add(notice);
|
||||||
|
NoticeVO noticeVO = new NoticeVO();
|
||||||
|
noticeVO.setNotices(notices);
|
||||||
|
// 发送消息
|
||||||
|
saveNotice(noticeVO, true);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void notice(NoticeBO noticeBO) {
|
public void notice(NoticeBO noticeBO) {
|
||||||
notice(null, noticeBO);
|
notice(null, noticeBO);
|
||||||
@ -99,7 +119,7 @@ public class MessageServiceImpl extends DefaultBaseService implements IMessageSe
|
|||||||
scheduledExecutorService.schedule(() -> {
|
scheduledExecutorService.schedule(() -> {
|
||||||
for (WebSocketSession webSocketSession : webSocketSessions) {
|
for (WebSocketSession webSocketSession : webSocketSessions) {
|
||||||
NoticeBody noticeBody = new NoticeBody(notice.getTitle(), notice.getMsg(), notice.getTarget());
|
NoticeBody noticeBody = new NoticeBody(notice.getTitle(), notice.getMsg(), notice.getTarget());
|
||||||
WebSocketClientMessage webSocketClientMessage = new WebSocketClientMessage(MessageTypeEnum.NOTICE_TARGET_MESSAGE.getValue(),
|
WebSocketClientMessage webSocketClientMessage = new WebSocketClientMessage(MessageTypeEnum.NOTICE.getValue(),
|
||||||
true,
|
true,
|
||||||
WebSocketChannelManager.FORM_SYSTEM,
|
WebSocketChannelManager.FORM_SYSTEM,
|
||||||
webSocketSession.getUserId(),
|
webSocketSession.getUserId(),
|
||||||
@ -107,14 +127,30 @@ public class MessageServiceImpl extends DefaultBaseService implements IMessageSe
|
|||||||
// 发送通知
|
// 发送通知
|
||||||
WebSocketChannelManager.getInstance().sendText(webSocketSession.getChannel(), webSocketClientMessage);
|
WebSocketChannelManager.getInstance().sendText(webSocketSession.getChannel(), webSocketClientMessage);
|
||||||
}
|
}
|
||||||
}, 3, TimeUnit.SECONDS);
|
if (isSave) {
|
||||||
if (isSave) {
|
try {
|
||||||
// 保存通知记录
|
// 保存发送记录
|
||||||
List<String> userIds = notice.getUserIds();
|
List<String> userIds = notice.getUserIds();
|
||||||
for (String userId : userIds) {
|
List<UserDTO> userDTOs = userBaseService.listByUserIds(userIds);
|
||||||
noticeService.save(userId, notice);
|
for (UserDTO userDTO : userDTOs) {
|
||||||
|
boolean isOnline = false;
|
||||||
|
for (WebSocketSession webSocketSession : webSocketSessions) {
|
||||||
|
if (StringUtils.equals(userDTO.getUserId(), webSocketSession.getUserId())) {
|
||||||
|
isOnline = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isOnline) {
|
||||||
|
noticeService.save(userDTO, notice, true);
|
||||||
|
} else {
|
||||||
|
noticeService.save(userDTO, notice, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}, 2, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,20 +1,26 @@
|
|||||||
package ink.wgink.module.instantmessage.service.impl;
|
package ink.wgink.module.instantmessage.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
import ink.wgink.common.base.DefaultBaseService;
|
import ink.wgink.common.base.DefaultBaseService;
|
||||||
|
import ink.wgink.interfaces.user.IUserBaseService;
|
||||||
import ink.wgink.module.instantmessage.dao.INoticeDao;
|
import ink.wgink.module.instantmessage.dao.INoticeDao;
|
||||||
|
import ink.wgink.module.instantmessage.pojo.dtos.NoticeDTO;
|
||||||
import ink.wgink.module.instantmessage.pojo.pos.NoticePO;
|
import ink.wgink.module.instantmessage.pojo.pos.NoticePO;
|
||||||
|
import ink.wgink.module.instantmessage.pojo.vos.NoticeSendVO;
|
||||||
import ink.wgink.module.instantmessage.pojo.vos.NoticeVO;
|
import ink.wgink.module.instantmessage.pojo.vos.NoticeVO;
|
||||||
import ink.wgink.module.instantmessage.service.INoticeService;
|
import ink.wgink.module.instantmessage.service.INoticeService;
|
||||||
import ink.wgink.module.instantmessage.websocket.pojo.body.CountNeedToDealWithBody;
|
import ink.wgink.module.instantmessage.websocket.pojo.body.CountNeedToDealWithBody;
|
||||||
|
import ink.wgink.pojo.ListPage;
|
||||||
|
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||||
|
import ink.wgink.pojo.result.SuccessResultList;
|
||||||
import ink.wgink.util.UUIDUtil;
|
import ink.wgink.util.UUIDUtil;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
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.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When you feel like quitting. Think about why you started
|
* When you feel like quitting. Think about why you started
|
||||||
@ -31,10 +37,12 @@ public class NoticeServiceImpl extends DefaultBaseService implements INoticeServ
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private INoticeDao noticeDao;
|
private INoticeDao noticeDao;
|
||||||
|
@Autowired
|
||||||
|
private IUserBaseService userBaseService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void save(String userId, NoticeVO.Notice notice) throws Exception {
|
public void save(UserDTO userDTO, NoticeVO.Notice notice, boolean isSend) throws Exception {
|
||||||
if (StringUtils.isBlank(userId)) {
|
if (userDTO == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (StringUtils.isBlank(notice.getSystem())) {
|
if (StringUtils.isBlank(notice.getSystem())) {
|
||||||
@ -43,14 +51,16 @@ public class NoticeServiceImpl extends DefaultBaseService implements INoticeServ
|
|||||||
if (StringUtils.isBlank(notice.getServiceId())) {
|
if (StringUtils.isBlank(notice.getServiceId())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<NoticePO> noticePOs = listPO(notice.getSystem(), notice.getModule(), notice.getMenu(), notice.getServiceId(), userId);
|
List<NoticePO> noticePOs = listPO(notice.getSystem(), notice.getModule(), notice.getMenu(), notice.getServiceId(), userDTO.getUserId());
|
||||||
if (!noticePOs.isEmpty()) {
|
if (!noticePOs.isEmpty()) {
|
||||||
LOG.debug("通知已经存在");
|
LOG.debug("通知已经存在");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Map<String, Object> params = getHashMap(16);
|
Map<String, Object> params = getHashMap(16);
|
||||||
params.put("noticeId", UUIDUtil.getUUID());
|
params.put("noticeId", UUIDUtil.getUUID());
|
||||||
params.put("userId", userId);
|
params.put("userId", userDTO.getUserId());
|
||||||
|
params.put("userName", userDTO.getUserName());
|
||||||
|
params.put("userUsername", userDTO.getUserUsername());
|
||||||
params.put("noticeTitle", notice.getTitle());
|
params.put("noticeTitle", notice.getTitle());
|
||||||
params.put("noticeMsg", notice.getMsg());
|
params.put("noticeMsg", notice.getMsg());
|
||||||
params.put("noticeTarget", notice.getTarget());
|
params.put("noticeTarget", notice.getTarget());
|
||||||
@ -58,6 +68,7 @@ public class NoticeServiceImpl extends DefaultBaseService implements INoticeServ
|
|||||||
params.put("noticeModule", notice.getModule());
|
params.put("noticeModule", notice.getModule());
|
||||||
params.put("noticeMenu", notice.getMenu());
|
params.put("noticeMenu", notice.getMenu());
|
||||||
params.put("noticeServiceId", notice.getServiceId());
|
params.put("noticeServiceId", notice.getServiceId());
|
||||||
|
params.put("isSend", isSend ? 1 : 0);
|
||||||
params.put("isHandle", 0);
|
params.put("isHandle", 0);
|
||||||
setSaveInfoByUserId(params, "1");
|
setSaveInfoByUserId(params, "1");
|
||||||
noticeDao.save(params);
|
noticeDao.save(params);
|
||||||
@ -236,6 +247,14 @@ public class NoticeServiceImpl extends DefaultBaseService implements INoticeServ
|
|||||||
noticeDao.delete(params);
|
noticeDao.delete(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove(List<String> noticeIds) {
|
||||||
|
Map<String, Object> params = getHashMap(2);
|
||||||
|
params.put("noticeIds", noticeIds);
|
||||||
|
setUpdateInfo(params);
|
||||||
|
noticeDao.remove(params);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<NoticePO> listPO(List<String> serviceIds) {
|
public List<NoticePO> listPO(List<String> serviceIds) {
|
||||||
Map<String, Object> params = getHashMap(2);
|
Map<String, Object> params = getHashMap(2);
|
||||||
@ -243,6 +262,27 @@ public class NoticeServiceImpl extends DefaultBaseService implements INoticeServ
|
|||||||
return listPO(params);
|
return listPO(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<NoticeDTO> list(Map<String, Object> params) {
|
||||||
|
return noticeDao.list(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SuccessResultList<List<NoticeDTO>> listPage(ListPage page) {
|
||||||
|
PageHelper.startPage(page.getPage(), page.getRows());
|
||||||
|
List<NoticeDTO> noticeDTOs = list(page.getParams());
|
||||||
|
PageInfo<NoticeDTO> pageInfo = new PageInfo<>(noticeDTOs);
|
||||||
|
return new SuccessResultList<>(noticeDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void notice(NoticeSendVO noticeSendVO) throws Exception {
|
||||||
|
String noticeUserIdsString = noticeSendVO.getNoticeUserIds();
|
||||||
|
List<String> noticeUserIds = Arrays.asList(noticeUserIdsString.split("\\_"));
|
||||||
|
NoticeVO.Notice notice = new NoticeVO.Notice();
|
||||||
|
notice.setUserIds(noticeUserIds);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统列表
|
* 系统列表
|
||||||
*
|
*
|
||||||
@ -282,4 +322,31 @@ public class NoticeServiceImpl extends DefaultBaseService implements INoticeServ
|
|||||||
return noticeDao.listMenus(params);
|
return noticeDao.listMenus(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置用户
|
||||||
|
*
|
||||||
|
* @param noticeDTOs
|
||||||
|
*/
|
||||||
|
private void setUser(List<NoticeDTO> noticeDTOs) {
|
||||||
|
if (noticeDTOs.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Set<String> userIdSet = new HashSet<>();
|
||||||
|
for (NoticeDTO noticeDTO : noticeDTOs) {
|
||||||
|
userIdSet.add(noticeDTO.getUserId());
|
||||||
|
}
|
||||||
|
List<UserDTO> userDTOs = userBaseService.listByUserIds(new ArrayList<>(userIdSet));
|
||||||
|
if (userDTOs.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (NoticeDTO noticeDTO : noticeDTOs) {
|
||||||
|
for (UserDTO userDTO : userDTOs) {
|
||||||
|
if (StringUtils.equals(noticeDTO.getUserId(), userDTO.getUserId())) {
|
||||||
|
noticeDTO.setUserName(userDTO.getUserName());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,9 @@
|
|||||||
<result column="notice_menu" property="noticeMenu"/>
|
<result column="notice_menu" property="noticeMenu"/>
|
||||||
<result column="notice_service_id" property="noticeServiceId"/>
|
<result column="notice_service_id" property="noticeServiceId"/>
|
||||||
<result column="user_id" property="userId"/>
|
<result column="user_id" property="userId"/>
|
||||||
|
<result column="user_name" property="userName"/>
|
||||||
|
<result column="user_username" property="userUsername"/>
|
||||||
|
<result column="is_send" property="isSend"/>
|
||||||
<result column="is_handle" property="isHandle"/>
|
<result column="is_handle" property="isHandle"/>
|
||||||
<result column="gmt_create" property="gmtCreate"/>
|
<result column="gmt_create" property="gmtCreate"/>
|
||||||
<result column="creator" property="creator"/>
|
<result column="creator" property="creator"/>
|
||||||
@ -23,23 +26,46 @@
|
|||||||
<result column="is_delete" property="isDelete"/>
|
<result column="is_delete" property="isDelete"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="noticeDTO" type="ink.wgink.module.instantmessage.pojo.dtos.NoticeDTO">
|
||||||
|
<id column="id" property="id"/>
|
||||||
|
<result column="notice_id" property="noticeId"/>
|
||||||
|
<result column="notice_title" property="noticeTitle"/>
|
||||||
|
<result column="notice_msg" property="noticeMsg"/>
|
||||||
|
<result column="notice_target" property="noticeTarget"/>
|
||||||
|
<result column="notice_system" property="noticeSystem"/>
|
||||||
|
<result column="notice_module" property="noticeModule"/>
|
||||||
|
<result column="notice_menu" property="noticeMenu"/>
|
||||||
|
<result column="notice_service_id" property="noticeServiceId"/>
|
||||||
|
<result column="user_id" property="userId"/>
|
||||||
|
<result column="user_name" property="userName"/>
|
||||||
|
<result column="user_username" property="userUsername"/>
|
||||||
|
<result column="is_send" property="isSend"/>
|
||||||
|
<result column="is_handle" property="isHandle"/>
|
||||||
|
<result column="gmt_create" property="gmtCreate"/>
|
||||||
|
<result column="gmt_modified" property="gmtModified"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
<!-- 建表 -->
|
<!-- 建表 -->
|
||||||
<update id="createTable">
|
<update id="createTable">
|
||||||
CREATE TABLE IF NOT EXISTS `socket_notice` (
|
CREATE TABLE IF NOT EXISTS `im_notice` (
|
||||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`notice_id` char(36) DEFAULT NULL COMMENT '主键',
|
`notice_id` char(36) DEFAULT NULL COMMENT '主键',
|
||||||
`notice_title` varchar(255) DEFAULT NULL COMMENT '通知标题',
|
`notice_title` varchar(255) DEFAULT NULL COMMENT '通知标题',
|
||||||
`notice_msg` varchar(255) DEFAULT NULL COMMENT '通知内容',
|
`notice_msg` varchar(500) DEFAULT NULL COMMENT '通知内容',
|
||||||
`notice_target` varchar(255) DEFAULT NULL COMMENT '通知触发目标',
|
`notice_target` varchar(255) DEFAULT NULL COMMENT '通知触发目标',
|
||||||
`notice_system` varchar(255) DEFAULT NULL COMMENT '通知业务系统',
|
`notice_system` varchar(255) DEFAULT NULL COMMENT '通知业务系统',
|
||||||
`notice_module` varchar(255) DEFAULT NULL COMMENT '通知业务模块',
|
`notice_module` varchar(255) DEFAULT NULL COMMENT '通知业务模块',
|
||||||
|
`notice_menu` varchar(255) DEFAULT NULL COMMENT '通知业务菜单',
|
||||||
`notice_service_id` varchar(255) DEFAULT NULL COMMENT '通知业务ID',
|
`notice_service_id` varchar(255) DEFAULT NULL COMMENT '通知业务ID',
|
||||||
`user_id` char(36) DEFAULT NULL COMMENT '通知人',
|
`user_id` char(36) DEFAULT NULL COMMENT '通知人',
|
||||||
|
`user_username` varchar(255) DEFAULT NULL COMMENT '用户名',
|
||||||
|
`user_name` varchar(255) DEFAULT NULL COMMENT '用户昵称',
|
||||||
|
`is_send` int(1) DEFAULT '0' COMMENT '是否发送',
|
||||||
`is_handle` int(1) DEFAULT '0' COMMENT '是否处理',
|
`is_handle` int(1) DEFAULT '0' COMMENT '是否处理',
|
||||||
`gmt_create` datetime DEFAULT NULL COMMENT '创建时间',
|
`gmt_create` datetime DEFAULT NULL COMMENT '创建时间',
|
||||||
`creator` char(36) DEFAULT NULL COMMENT '创建人',
|
`creator` char(36) DEFAULT NULL COMMENT '创建人',
|
||||||
`gmt_modified` datetime DEFAULT NULL COMMENT '修改时间',
|
`gmt_modified` datetime DEFAULT NULL COMMENT '修改时间',
|
||||||
`modifier` char(36) DEFAULT NULL COMMENT '修改人',
|
`modifier` char(36) DEFAULT NULL COMMENT '修改人',
|
||||||
`is_delete` int(1) DEFAULT '0' COMMENT '是否删除',
|
`is_delete` int(1) DEFAULT '0' COMMENT '是否删除',
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY `notice_id` (`notice_id`) USING BTREE,
|
UNIQUE KEY `notice_id` (`notice_id`) USING BTREE,
|
||||||
@ -50,12 +76,12 @@
|
|||||||
KEY `notice_service_id` (`notice_service_id`) USING BTREE,
|
KEY `notice_service_id` (`notice_service_id`) USING BTREE,
|
||||||
KEY `user_id` (`user_id`) USING BTREE,
|
KEY `user_id` (`user_id`) USING BTREE,
|
||||||
KEY `is_handle` (`is_handle`) USING BTREE
|
KEY `is_handle` (`is_handle`) USING BTREE
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='小程序用户';
|
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='小程序用户';
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<!-- 保存 -->
|
<!-- 保存 -->
|
||||||
<insert id="save" parameterType="map">
|
<insert id="save" parameterType="map" flushCache="true">
|
||||||
INSERT INTO socket_notice (
|
INSERT INTO im_notice (
|
||||||
notice_id,
|
notice_id,
|
||||||
notice_title,
|
notice_title,
|
||||||
notice_msg,
|
notice_msg,
|
||||||
@ -65,6 +91,9 @@
|
|||||||
notice_menu,
|
notice_menu,
|
||||||
notice_service_id,
|
notice_service_id,
|
||||||
user_id,
|
user_id,
|
||||||
|
user_name,
|
||||||
|
user_username,
|
||||||
|
is_send,
|
||||||
is_handle,
|
is_handle,
|
||||||
gmt_create,
|
gmt_create,
|
||||||
creator,
|
creator,
|
||||||
@ -81,6 +110,9 @@
|
|||||||
#{noticeMenu},
|
#{noticeMenu},
|
||||||
#{noticeServiceId},
|
#{noticeServiceId},
|
||||||
#{userId},
|
#{userId},
|
||||||
|
#{userName},
|
||||||
|
#{userUsername},
|
||||||
|
#{isSend},
|
||||||
#{isHandle},
|
#{isHandle},
|
||||||
#{gmtCreate},
|
#{gmtCreate},
|
||||||
#{creator},
|
#{creator},
|
||||||
@ -91,9 +123,9 @@
|
|||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<!-- 更新已办状态 -->
|
<!-- 更新已办状态 -->
|
||||||
<update id="updateHandle" parameterType="map">
|
<update id="updateHandle" parameterType="map" flushCache="true">
|
||||||
UPDATE
|
UPDATE
|
||||||
socket_notice
|
im_notice
|
||||||
SET
|
SET
|
||||||
is_handle = #{isHandle},
|
is_handle = #{isHandle},
|
||||||
gmt_modified = #{gmtModified},
|
gmt_modified = #{gmtModified},
|
||||||
@ -105,9 +137,9 @@
|
|||||||
</update>
|
</update>
|
||||||
|
|
||||||
<!-- 删除 -->
|
<!-- 删除 -->
|
||||||
<delete id="delete" parameterType="map">
|
<delete id="delete" parameterType="map" flushCache="true">
|
||||||
DELETE FROM
|
DELETE FROM
|
||||||
socket_notice
|
im_notice
|
||||||
WHERE
|
WHERE
|
||||||
<if test="serviceIds != null and serviceIds.size > 0">
|
<if test="serviceIds != null and serviceIds.size > 0">
|
||||||
notice_service_id IN
|
notice_service_id IN
|
||||||
@ -117,8 +149,23 @@
|
|||||||
</if>
|
</if>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<!-- 删除 -->
|
||||||
|
<update id="remove" parameterType="map" flushCache="true">
|
||||||
|
UPDATE
|
||||||
|
im_notice
|
||||||
|
SET
|
||||||
|
is_delete = 1,
|
||||||
|
gmt_modified = #{gmtModified},
|
||||||
|
modifier = #{modifier}
|
||||||
|
WHERE
|
||||||
|
notice_id IN
|
||||||
|
<foreach collection="noticeIds" index="index" open="(" separator="," close=")">
|
||||||
|
#{noticeIds[${index}]}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
|
|
||||||
<!-- 详情 -->
|
<!-- 详情 -->
|
||||||
<select id="getPO" parameterType="map" resultMap="noticePO">
|
<select id="getPO" parameterType="map" resultMap="noticePO" useCache="false">
|
||||||
SELECT
|
SELECT
|
||||||
notice_id,
|
notice_id,
|
||||||
notice_title,
|
notice_title,
|
||||||
@ -129,6 +176,9 @@
|
|||||||
notice_menu,
|
notice_menu,
|
||||||
notice_service_id,
|
notice_service_id,
|
||||||
user_id,
|
user_id,
|
||||||
|
user_name,
|
||||||
|
user_username,
|
||||||
|
is_send,
|
||||||
is_handle,
|
is_handle,
|
||||||
gmt_create,
|
gmt_create,
|
||||||
creator,
|
creator,
|
||||||
@ -136,7 +186,7 @@
|
|||||||
modifier,
|
modifier,
|
||||||
is_delete
|
is_delete
|
||||||
FROM
|
FROM
|
||||||
socket_notice
|
im_notice
|
||||||
WHERE
|
WHERE
|
||||||
is_delete = 0
|
is_delete = 0
|
||||||
<if test="noticeId != null and noticeId != ''">
|
<if test="noticeId != null and noticeId != ''">
|
||||||
@ -166,7 +216,7 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<select id="listPO" parameterType="map" resultMap="noticePO">
|
<select id="listPO" parameterType="map" resultMap="noticePO" useCache="true">
|
||||||
SELECT
|
SELECT
|
||||||
notice_id,
|
notice_id,
|
||||||
notice_title,
|
notice_title,
|
||||||
@ -177,6 +227,9 @@
|
|||||||
notice_menu,
|
notice_menu,
|
||||||
notice_service_id,
|
notice_service_id,
|
||||||
user_id,
|
user_id,
|
||||||
|
user_name,
|
||||||
|
user_username,
|
||||||
|
is_send,
|
||||||
is_handle,
|
is_handle,
|
||||||
gmt_create,
|
gmt_create,
|
||||||
creator,
|
creator,
|
||||||
@ -184,7 +237,7 @@
|
|||||||
modifier,
|
modifier,
|
||||||
is_delete
|
is_delete
|
||||||
FROM
|
FROM
|
||||||
socket_notice
|
im_notice
|
||||||
WHERE
|
WHERE
|
||||||
is_delete = 0
|
is_delete = 0
|
||||||
<if test="noticeSystem != null and noticeSystem != ''">
|
<if test="noticeSystem != null and noticeSystem != ''">
|
||||||
@ -224,12 +277,82 @@
|
|||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 列表 -->
|
||||||
|
<select id="list" parameterType="map" resultMap="noticeDTO" useCache="true">
|
||||||
|
SELECT
|
||||||
|
notice_id,
|
||||||
|
notice_title,
|
||||||
|
notice_msg,
|
||||||
|
notice_target,
|
||||||
|
notice_system,
|
||||||
|
notice_module,
|
||||||
|
notice_menu,
|
||||||
|
notice_service_id,
|
||||||
|
user_id,
|
||||||
|
user_name,
|
||||||
|
user_username,
|
||||||
|
is_send,
|
||||||
|
is_handle,
|
||||||
|
LEFT(gmt_create, 19) gmt_create,
|
||||||
|
LEFT(gmt_modified, 19) gmt_modified
|
||||||
|
FROM
|
||||||
|
im_notice
|
||||||
|
WHERE
|
||||||
|
is_delete = 0
|
||||||
|
<if test="keywords != null and keywords != ''">
|
||||||
|
AND (
|
||||||
|
user_name LIKE CONCAT('%', #{keywords}, '%')
|
||||||
|
OR
|
||||||
|
user_username LIKE CONCAT('%', #{keywords}, '%')
|
||||||
|
OR
|
||||||
|
notice_title LIKE CONCAT('%', #{keywords}, '%')
|
||||||
|
OR
|
||||||
|
notice_msg LIKE CONCAT('%', #{keywords}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="noticeSystem != null and noticeSystem != ''">
|
||||||
|
AND
|
||||||
|
notice_system = #{noticeSystem}
|
||||||
|
</if>
|
||||||
|
<if test="noticeModule != null and noticeModule != ''">
|
||||||
|
AND
|
||||||
|
notice_module = #{noticeModule}
|
||||||
|
</if>
|
||||||
|
<if test="noticeMenu != null and noticeMenu">
|
||||||
|
AND
|
||||||
|
notice_menu = #{noticeMenu}
|
||||||
|
</if>
|
||||||
|
<if test="noticeServiceId != null and noticeServiceId != ''">
|
||||||
|
AND
|
||||||
|
notice_service_id = #{noticeServiceId}
|
||||||
|
</if>
|
||||||
|
<if test="userId != null and userId != ''">
|
||||||
|
AND
|
||||||
|
user_id = #{userId}
|
||||||
|
</if>
|
||||||
|
<if test="isHandle != null">
|
||||||
|
AND
|
||||||
|
is_handle = #{isHandle}
|
||||||
|
</if>
|
||||||
|
<if test="serviceId != null and serviceId != ''">
|
||||||
|
AND
|
||||||
|
notice_service_id = #{serviceId}
|
||||||
|
</if>
|
||||||
|
<if test="serviceIds != null and serviceIds.size > 0">
|
||||||
|
AND
|
||||||
|
notice_service_id IN
|
||||||
|
<foreach collection="serviceIds" index="index" open="(" separator="," close=")">
|
||||||
|
#{serviceIds[${index}]}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
<!-- 系统列表 -->
|
<!-- 系统列表 -->
|
||||||
<select id="listSystems" parameterType="map" resultType="java.lang.String">
|
<select id="listSystems" parameterType="map" resultType="java.lang.String" useCache="true">
|
||||||
SELECT
|
SELECT
|
||||||
notice_system
|
notice_system
|
||||||
FROM
|
FROM
|
||||||
socket_notice
|
im_notice
|
||||||
WHERE
|
WHERE
|
||||||
is_delete = 0
|
is_delete = 0
|
||||||
<if test="userId != null and userId != ''">
|
<if test="userId != null and userId != ''">
|
||||||
@ -241,16 +364,16 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 模块列表 -->
|
<!-- 模块列表 -->
|
||||||
<select id="listModules" parameterType="map" resultType="java.lang.String">
|
<select id="listModules" parameterType="map" resultType="java.lang.String" useCache="true">
|
||||||
SELECT
|
SELECT
|
||||||
notice_module
|
notice_module
|
||||||
FROM
|
FROM
|
||||||
socket_notice
|
im_notice
|
||||||
WHERE
|
WHERE
|
||||||
is_delete = 0
|
is_delete = 0
|
||||||
<if test="userId != null and userId != ''">
|
<if test="userId != null and userId != ''">
|
||||||
AND
|
AND
|
||||||
user_id = #{userId}
|
user_id = #{userId}``
|
||||||
</if>
|
</if>
|
||||||
<if test="noticeSystem != null and noticeSystem != ''">
|
<if test="noticeSystem != null and noticeSystem != ''">
|
||||||
AND
|
AND
|
||||||
@ -261,11 +384,11 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 菜单列表 -->
|
<!-- 菜单列表 -->
|
||||||
<select id="listMenus" parameterType="map" resultType="java.lang.String">
|
<select id="listMenus" parameterType="map" resultType="java.lang.String" useCache="true">
|
||||||
SELECT
|
SELECT
|
||||||
notice_menu
|
notice_menu
|
||||||
FROM
|
FROM
|
||||||
socket_notice
|
im_notice
|
||||||
WHERE
|
WHERE
|
||||||
is_delete = 0
|
is_delete = 0
|
||||||
<if test="userId != null and userId != ''">
|
<if test="userId != null and userId != ''">
|
||||||
@ -285,11 +408,11 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 统计 -->
|
<!-- 统计 -->
|
||||||
<select id="count" parameterType="map" resultType="java.lang.Integer">
|
<select id="count" parameterType="map" resultType="java.lang.Integer" useCache="false">
|
||||||
SELECT
|
SELECT
|
||||||
COUNT(*)
|
COUNT(*)
|
||||||
FROM
|
FROM
|
||||||
socket_notice
|
im_notice
|
||||||
WHERE
|
WHERE
|
||||||
is_delete = 0
|
is_delete = 0
|
||||||
<if test="userId != null and userId != ''">
|
<if test="userId != null and userId != ''">
|
||||||
|
@ -0,0 +1,273 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
<head>
|
||||||
|
<base th:href="${#request.getContextPath() + '/'}">
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="renderer" content="webkit">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||||
|
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||||
|
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||||
|
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="layui-fluid layui-anim layui-anim-fadein">
|
||||||
|
<div class="layui-row">
|
||||||
|
<div class="layui-col-md12">
|
||||||
|
<div class="layui-card">
|
||||||
|
<div class="layui-card-body">
|
||||||
|
<div class="test-table-reload-btn" style="margin-bottom: 10px;">
|
||||||
|
<div class="layui-inline">
|
||||||
|
<input type="text" id="keywords" class="layui-input search-item search-item-width-100" placeholder="输入关键字">
|
||||||
|
</div>
|
||||||
|
创建时间
|
||||||
|
<div class="layui-inline">
|
||||||
|
<input type="text" id="startTime" class="layui-input search-item search-item-width-100" placeholder="开始时间" readonly>
|
||||||
|
</div>
|
||||||
|
<div class="layui-inline">
|
||||||
|
<input type="text" id="endTime" class="layui-input search-item search-item-width-100" placeholder="结束时间" readonly>
|
||||||
|
</div>
|
||||||
|
<button type="button" id="search" class="layui-btn layui-btn-sm">
|
||||||
|
<i class="fa fa-lg fa-search"></i> 搜索
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
|
||||||
|
<!-- 表头按钮组 -->
|
||||||
|
<script type="text/html" id="headerToolBar">
|
||||||
|
<div class="layui-btn-group">
|
||||||
|
<button type="button" class="layui-btn layui-btn-danger layui-btn-sm" lay-event="removeEvent">
|
||||||
|
<i class="fa fa-lg fa-trash"></i> 删除
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||||
|
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
|
||||||
|
<script>
|
||||||
|
layui.config({
|
||||||
|
base: 'assets/layuiadmin/'
|
||||||
|
}).extend({
|
||||||
|
index: 'lib/index'
|
||||||
|
}).use(['index', 'table', 'laydate', 'common'], function() {
|
||||||
|
var $ = layui.$;
|
||||||
|
var $win = $(window);
|
||||||
|
var table = layui.table;
|
||||||
|
var admin = layui.admin;
|
||||||
|
var laydate = layui.laydate;
|
||||||
|
var common = layui.common;
|
||||||
|
var resizeTimeout = null;
|
||||||
|
var tableUrl = 'api/websocket/notice/listpage';
|
||||||
|
|
||||||
|
// 初始化表格
|
||||||
|
function initTable() {
|
||||||
|
table.render({
|
||||||
|
elem: '#dataTable',
|
||||||
|
id: 'dataTable',
|
||||||
|
url: top.restAjax.path(tableUrl, []),
|
||||||
|
width: admin.screen() > 1 ? '100%' : '',
|
||||||
|
height: $win.height() - 90,
|
||||||
|
limit: 20,
|
||||||
|
limits: [20, 40, 60, 80, 100, 200],
|
||||||
|
toolbar: '#headerToolBar',
|
||||||
|
request: {
|
||||||
|
pageName: 'page',
|
||||||
|
limitName: 'rows'
|
||||||
|
},
|
||||||
|
cols: [
|
||||||
|
[
|
||||||
|
{type:'checkbox', fixed: 'left'},
|
||||||
|
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||||
|
{field: 'noticeTitle', width: 180, title: '通知标题', align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
var rowData = row[this.field];
|
||||||
|
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
return rowData;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{field: 'noticeMsg', width: 180, title: '通知内容', align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
var rowData = row[this.field];
|
||||||
|
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
return rowData;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{field: 'noticeTarget', width: 180, title: '通知触发目标', align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
var rowData = row[this.field];
|
||||||
|
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
return rowData;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{field: 'noticeSystem', width: 180, title: '通知业务系统', align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
var rowData = row[this.field];
|
||||||
|
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
return rowData;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{field: 'noticeModule', width: 180, title: '通知业务模块', align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
var rowData = row[this.field];
|
||||||
|
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
return rowData;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{field: 'noticeServiceId', width: 180, title: '通知业务ID', align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
var rowData = row[this.field];
|
||||||
|
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
return rowData;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{field: 'userName', width: 180, title: '通知人', align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
var rowData = row[this.field];
|
||||||
|
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
return rowData;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{field: 'isSend', width: 180, title: '发送状态', align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
var rowData = row[this.field];
|
||||||
|
if(typeof(rowData) === 'undefined' || rowData == null) {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
if(rowData == 0) {
|
||||||
|
return '<span class="layui-btn layui-btn-xs layui-btn-danger">未发送</span>';
|
||||||
|
}
|
||||||
|
if(rowData == 1) {
|
||||||
|
return '<span class="layui-btn layui-btn-xs">已发送</span>';
|
||||||
|
}
|
||||||
|
return rowData;
|
||||||
|
return rowData;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{field: 'isHandle', width: 100, title: '是否处理', align:'center',
|
||||||
|
// 处理状态是用户是否查看该通知
|
||||||
|
templet: function(row) {
|
||||||
|
var rowData = row[this.field];
|
||||||
|
if(typeof(rowData) === 'undefined' || rowData == null) {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
if(rowData == 0) {
|
||||||
|
return '<span class="layui-btn layui-btn-xs layui-btn-danger">未处理</span>';
|
||||||
|
}
|
||||||
|
if(rowData == 1) {
|
||||||
|
return '<span class="layui-btn layui-btn-xs">已处理</span>';
|
||||||
|
}
|
||||||
|
return '错误';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{field: 'gmtCreate', width: 180, title: '创建时间', align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
var rowData = row[this.field];
|
||||||
|
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
return rowData;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{field: 'gmtModified', width: 180, title: '修改时间', align:'center',
|
||||||
|
templet: function(row) {
|
||||||
|
var rowData = row[this.field];
|
||||||
|
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
return rowData;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
|
],
|
||||||
|
page: true,
|
||||||
|
parseData: function(data) {
|
||||||
|
return {
|
||||||
|
'code': 0,
|
||||||
|
'msg': '',
|
||||||
|
'count': data.total,
|
||||||
|
'data': data.rows
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 重载表格
|
||||||
|
function reloadTable(currentPage) {
|
||||||
|
table.reload('dataTable', {
|
||||||
|
where: {
|
||||||
|
keywords: $('#keywords').val(),
|
||||||
|
startTime: $('#startTime').val(),
|
||||||
|
endTime: $('#endTime').val()
|
||||||
|
},
|
||||||
|
page: {
|
||||||
|
curr: currentPage
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 初始化日期
|
||||||
|
function initDate() {
|
||||||
|
// 日期选择
|
||||||
|
laydate.render({
|
||||||
|
elem: '#startTime',
|
||||||
|
format: 'yyyy-MM-dd'
|
||||||
|
});
|
||||||
|
laydate.render({
|
||||||
|
elem: '#endTime',
|
||||||
|
format: 'yyyy-MM-dd'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 删除
|
||||||
|
function removeData(ids) {
|
||||||
|
top.dialog.msg(top.dataMessage.delete, {
|
||||||
|
time: 0,
|
||||||
|
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
|
||||||
|
shade: 0.3,
|
||||||
|
yes: function (index) {
|
||||||
|
top.dialog.close(index);
|
||||||
|
var layIndex;
|
||||||
|
top.restAjax.delete(top.restAjax.path('api/notice/remove/{ids}', [ids]), {}, null, function (code, data) {
|
||||||
|
top.dialog.msg(top.dataMessage.deleteSuccess, {time: 1000});
|
||||||
|
reloadTable();
|
||||||
|
}, function (code, data) {
|
||||||
|
top.dialog.msg(data.msg);
|
||||||
|
}, function () {
|
||||||
|
layIndex = top.dialog.msg(top.dataMessage.deleting, {icon: 16, time: 0, shade: 0.3});
|
||||||
|
}, function () {
|
||||||
|
top.dialog.close(layIndex);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
initTable();
|
||||||
|
initDate();
|
||||||
|
// 事件 - 页面变化
|
||||||
|
$win.on('resize', function() {
|
||||||
|
clearTimeout(resizeTimeout);
|
||||||
|
resizeTimeout = setTimeout(function() {
|
||||||
|
reloadTable();
|
||||||
|
}, 500);
|
||||||
|
});
|
||||||
|
// 事件 - 搜索
|
||||||
|
$(document).on('click', '#search', function() {
|
||||||
|
reloadTable(1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,129 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
<head>
|
||||||
|
<base th:href="${#request.getContextPath() + '/'}">
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="renderer" content="webkit">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||||
|
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
|
||||||
|
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
|
||||||
|
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="layui-fluid layui-anim layui-anim-fadein">
|
||||||
|
<div class="layui-card">
|
||||||
|
<blockquote class="layui-elem-quote layui-quote-nm">用户客户端在线的情况下会直接通知,不在线时只保存记录</blockquote>
|
||||||
|
<div class="layui-card-body" style="padding: 15px;">
|
||||||
|
<form class="layui-form layui-form-pane" lay-filter="dataForm">
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">通知标题</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="text" id="noticeTitle" name="noticeTitle" class="layui-input" value="" placeholder="请输入通知标题" maxlength="255" lay-verify="required">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">通知人</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="hidden" id="noticeUserIds" name="noticeUserIds">
|
||||||
|
<input type="text" id="noticeUserNames" name="noticeUserNames" class="layui-input" value="" placeholder="请选择通知人" lay-verify="required" readonly style="cursor:pointer;">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item layui-form-text">
|
||||||
|
<label class="layui-form-label">通知内容</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<textarea name="noticeMsg" placeholder="请输入通知内容" class="layui-textarea" rows="10" lay-verify="required" maxlength="200"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">发送通知</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||||
|
<script>
|
||||||
|
layui.config({
|
||||||
|
base: 'assets/layuiadmin/' //静态资源所在路径
|
||||||
|
}).extend({
|
||||||
|
index: 'lib/index' //主入口模块
|
||||||
|
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
|
||||||
|
var $ = layui.$;
|
||||||
|
var form = layui.form;
|
||||||
|
var laytpl = layui.laytpl;
|
||||||
|
var laydate = layui.laydate;
|
||||||
|
|
||||||
|
function closeBox() {
|
||||||
|
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化内容
|
||||||
|
function initData() {
|
||||||
|
}
|
||||||
|
initData();
|
||||||
|
|
||||||
|
// 提交表单
|
||||||
|
form.on('submit(submitForm)', function(formData) {
|
||||||
|
top.dialog.confirm(top.dataMessage.commit, function(index) {
|
||||||
|
top.dialog.close(index);
|
||||||
|
var loadLayerIndex;
|
||||||
|
top.restAjax.post(top.restAjax.path('api/websocket/message/notice', []), formData.field, null, function(code, data) {
|
||||||
|
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
|
||||||
|
time: 0,
|
||||||
|
btn: [top.dataMessage.button.yes],
|
||||||
|
shade: 0.3,
|
||||||
|
yes: function(index) {
|
||||||
|
top.dialog.close(index);
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, function(code, data) {
|
||||||
|
top.dialog.msg(data.msg);
|
||||||
|
}, function() {
|
||||||
|
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
|
||||||
|
}, function() {
|
||||||
|
top.dialog.close(loadLayerIndex);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#noticeUserNames').on('click', function() {
|
||||||
|
top.dialog.dialogData.selectedUserIds = $('#noticeUserIds').val();
|
||||||
|
top.dialog.open({
|
||||||
|
url: top.restAjax.path('route/department/user/select-user', []),
|
||||||
|
title: '选择用户',
|
||||||
|
width: '500px',
|
||||||
|
height: '500px',
|
||||||
|
closeBtn: 0,
|
||||||
|
onClose: function() {
|
||||||
|
var selectedUsers = top.dialog.dialogData.selectedDepartmentUsers;
|
||||||
|
// 这里写处理逻辑
|
||||||
|
var noticeUserIds = '';
|
||||||
|
var noticeUserNames = '';
|
||||||
|
if(selectedUsers && selectedUsers.length > 0) {
|
||||||
|
for(var i = 0, item; item = selectedUsers[i++]; ) {
|
||||||
|
if(noticeUserIds.length > 0) {
|
||||||
|
noticeUserIds +='_';
|
||||||
|
noticeUserNames += ',';
|
||||||
|
}
|
||||||
|
noticeUserIds += item.userId;
|
||||||
|
noticeUserNames += item.userName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$('#noticeUserIds').val(noticeUserIds);
|
||||||
|
$('#noticeUserNames').val(noticeUserNames);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
$('.close').on('click', function() {
|
||||||
|
closeBox();
|
||||||
|
});
|
||||||
|
|
||||||
|
// 校验
|
||||||
|
form.verify({
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user