Merge remote-tracking branch 'origin/master'
This commit is contained in:
+36
@@ -0,0 +1,36 @@
|
||||
package com.jero.common.constant.enums;
|
||||
|
||||
/**
|
||||
* @description
|
||||
* @date 2022/1/21 15:22
|
||||
* @auth zhn
|
||||
*/
|
||||
public enum MessageTypeEnum {
|
||||
READ("订阅通知","1"),
|
||||
WARN("预警信息","2"),
|
||||
PUSH("转发推送","3");
|
||||
|
||||
String name;
|
||||
String value;
|
||||
|
||||
private MessageTypeEnum(String name, String value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
+57
-24
@@ -1,11 +1,11 @@
|
||||
package com.jero.modules.system.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
@@ -13,6 +13,9 @@ import com.jero.common.util.oConvertUtils;
|
||||
import com.jero.modules.system.entity.SysAnnouncementSend;
|
||||
import com.jero.modules.system.model.AnnouncementSendModel;
|
||||
import com.jero.modules.system.service.ISysAnnouncementSendService;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -23,14 +26,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Title: Controller
|
||||
@@ -39,13 +39,15 @@ import lombok.extern.slf4j.Slf4j;
|
||||
* @Date: 2019-02-21
|
||||
* @Version: V1.0
|
||||
*/
|
||||
|
||||
@Api(tags="消息")
|
||||
@RestController
|
||||
@RequestMapping("/sys/sysAnnouncementSend")
|
||||
@Slf4j
|
||||
public class SysAnnouncementSendController {
|
||||
@Autowired
|
||||
private ISysAnnouncementSendService sysAnnouncementSendService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
* @param sysAnnouncementSend
|
||||
@@ -81,7 +83,7 @@ public class SysAnnouncementSendController {
|
||||
result.setResult(pageList);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param sysAnnouncementSend
|
||||
@@ -99,7 +101,7 @@ public class SysAnnouncementSendController {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param sysAnnouncementSend
|
||||
@@ -118,10 +120,10 @@ public class SysAnnouncementSendController {
|
||||
result.success("修改成功!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
* @param id
|
||||
@@ -139,10 +141,10 @@ public class SysAnnouncementSendController {
|
||||
result.success("删除成功!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
@@ -159,7 +161,7 @@ public class SysAnnouncementSendController {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
* @param id
|
||||
@@ -177,7 +179,7 @@ public class SysAnnouncementSendController {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @功能:更新用户系统消息阅读状态
|
||||
* @param json
|
||||
@@ -198,7 +200,7 @@ public class SysAnnouncementSendController {
|
||||
result.setSuccess(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @功能:获取我的消息
|
||||
* @return
|
||||
@@ -239,4 +241,35 @@ public class SysAnnouncementSendController {
|
||||
result.setMessage("全部已读");
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @功能:标记已读
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/read")
|
||||
public Result<SysAnnouncementSend> read(String ids) {
|
||||
Result<SysAnnouncementSend> result = new Result<SysAnnouncementSend>();
|
||||
List<SysAnnouncementSend> list = new ArrayList<>();
|
||||
for (String id : ids.split(",")) {
|
||||
SysAnnouncementSend sysAnnouncementSend = new SysAnnouncementSend();
|
||||
sysAnnouncementSend.setId(id);
|
||||
sysAnnouncementSend.setReadFlag("1");
|
||||
list.add(sysAnnouncementSend);
|
||||
}
|
||||
sysAnnouncementSendService.updateBatchById(list);
|
||||
result.setSuccess(true);
|
||||
result.setMessage("标记已读");
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* @功能:查询所有的未读消息
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/getMessageUnreadList")
|
||||
public Result<?> getMessageUnreadList() {
|
||||
Result<SysAnnouncementSend> result = new Result<SysAnnouncementSend>();
|
||||
List<AnnouncementSendModel> messageUnreadList = sysAnnouncementSendService.getMessageUnreadList();
|
||||
result.OK(messageUnreadList);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
+10
-1
@@ -38,6 +38,11 @@ public class SysAnnouncement implements Serializable {
|
||||
*/
|
||||
@Excel(name = "内容", width = 30)
|
||||
private java.lang.String msgContent;
|
||||
|
||||
/**
|
||||
* 详细内容
|
||||
*/
|
||||
private java.lang.String msgContentInfo;
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
@@ -63,7 +68,7 @@ public class SysAnnouncement implements Serializable {
|
||||
@Excel(name = "优先级", width = 15, dicCode = "priority")
|
||||
@Dict(dicCode = "priority")
|
||||
private java.lang.String priority;
|
||||
|
||||
|
||||
/**
|
||||
* 消息类型1:通知公告2:系统消息
|
||||
*/
|
||||
@@ -144,4 +149,8 @@ public class SysAnnouncement implements Serializable {
|
||||
* 摘要
|
||||
*/
|
||||
private java.lang.String msgAbstract;
|
||||
/**
|
||||
* 文档id
|
||||
*/
|
||||
private java.lang.String documentId;
|
||||
}
|
||||
|
||||
+4
-2
@@ -22,10 +22,12 @@ public interface SysAnnouncementSendMapper extends BaseMapper<SysAnnouncementSen
|
||||
/**
|
||||
* @功能:获取我的消息
|
||||
* @param announcementSendModel
|
||||
* @param pageSize
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param pageNo
|
||||
* @return
|
||||
*/
|
||||
public List<AnnouncementSendModel> getMyAnnouncementSendList(Page<AnnouncementSendModel> page,@Param("announcementSendModel") AnnouncementSendModel announcementSendModel);
|
||||
|
||||
public List<AnnouncementSendModel> getMessageUnreadList(@Param("userId") String userId);
|
||||
|
||||
}
|
||||
|
||||
+11
-5
@@ -27,6 +27,12 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||
* @return
|
||||
*/
|
||||
public SysUser getUserByName(@Param("username") String username);
|
||||
/**
|
||||
* 通过用户账号查询用户信息(批量)
|
||||
* @param usernames
|
||||
* @return
|
||||
*/
|
||||
public List<SysUser> getUserListByNames(@Param("usernames") String usernames);
|
||||
|
||||
/**
|
||||
* 根据部门Id查询用户信息
|
||||
@@ -58,22 +64,22 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||
* @return
|
||||
*/
|
||||
IPage<SysUser> getUserByRoleId(Page page, @Param("roleId") String roleId, @Param("username") String username);
|
||||
|
||||
|
||||
/**
|
||||
* 根据用户名设置部门ID
|
||||
* @param username
|
||||
* @param departId
|
||||
*/
|
||||
void updateUserDepart(@Param("username") String username,@Param("orgCode") String orgCode);
|
||||
|
||||
|
||||
/**
|
||||
* 根据手机号查询用户信息
|
||||
* @param phone
|
||||
* @return
|
||||
*/
|
||||
public SysUser getUserByPhone(@Param("phone") String phone);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据邮箱查询用户信息
|
||||
* @param email
|
||||
@@ -132,7 +138,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||
|
||||
/** 更新空字符串为null【此写法有sql注入风险,禁止随便用】 */
|
||||
int updateNullByEmptyString(@Param("fieldName") String fieldName);
|
||||
|
||||
|
||||
/**
|
||||
* 根据部门Ids,查询部门下用户信息
|
||||
* @param departIds
|
||||
|
||||
+9
-7
@@ -6,6 +6,7 @@
|
||||
<result column="id" property="id" jdbcType="VARCHAR"/>
|
||||
<result column="titile" property="titile" jdbcType="VARCHAR"/>
|
||||
<result column="msg_content" property="msgContent" jdbcType="VARCHAR"/>
|
||||
<result column="msg_content_info" property="msgContentInfo" jdbcType="VARCHAR"/>
|
||||
<result column="start_time" property="startTime" jdbcType="TIMESTAMP"/>
|
||||
<result column="end_time" property="endTime" jdbcType="TIMESTAMP"/>
|
||||
<result column="sender" property="sender" jdbcType="VARCHAR"/>
|
||||
@@ -25,16 +26,17 @@
|
||||
<result column="bus_id" property="busId" jdbcType="VARCHAR"/>
|
||||
<result column="open_type" property="openType" jdbcType="VARCHAR"/>
|
||||
<result column="open_page" property="openPage" jdbcType="VARCHAR"/>
|
||||
<result column="document_id" property="documentId" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="querySysCementListByUserId" parameterType="String" resultMap="SysAnnouncement">
|
||||
select * from sys_announcement
|
||||
where send_status = '1'
|
||||
and del_flag = '0'
|
||||
and msg_category = #{msgCategory}
|
||||
select * from sys_announcement
|
||||
where send_status = '1'
|
||||
and del_flag = '0'
|
||||
and msg_category = #{msgCategory}
|
||||
and id IN ( select annt_id from sys_announcement_send where user_id = #{userId} and read_flag = '0')
|
||||
order by create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
+36
-8
@@ -1,13 +1,14 @@
|
||||
<?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.jero.modules.system.mapper.SysAnnouncementSendMapper">
|
||||
|
||||
|
||||
<resultMap id="AnnouncementSendModel" type="com.jero.modules.system.model.AnnouncementSendModel" >
|
||||
<result column="id" property="id" jdbcType="VARCHAR"/>
|
||||
<result column="annt_id" property="anntId" jdbcType="VARCHAR"/>
|
||||
<result column="user_id" property="userId" jdbcType="VARCHAR"/>
|
||||
<result column="titile" property="titile" jdbcType="VARCHAR"/>
|
||||
<result column="msg_content" property="msgContent" jdbcType="VARCHAR"/>
|
||||
<result column="msg_content_info" property="msgContentInfo" jdbcType="VARCHAR"/>
|
||||
<result column="sender" property="sender" jdbcType="VARCHAR"/>
|
||||
<result column="priority" property="priority" jdbcType="VARCHAR"/>
|
||||
<result column="msg_category" property="msgCategory" jdbcType="VARCHAR"/>
|
||||
@@ -15,13 +16,14 @@
|
||||
<result column="bus_id" property="busId" jdbcType="VARCHAR"/>
|
||||
<result column="open_type" property="openType" jdbcType="VARCHAR"/>
|
||||
<result column="open_page" property="openPage" jdbcType="VARCHAR"/>
|
||||
<result column="document_id" property="documentId" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="queryByUserId" parameterType="String" resultType="String">
|
||||
select sas.annt_id from sys_announcement_send sas
|
||||
select sas.annt_id from sys_announcement_send sas
|
||||
where sas.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getMyAnnouncementSendList" parameterType="Object" resultMap="AnnouncementSendModel">
|
||||
select
|
||||
sas.id,
|
||||
@@ -30,6 +32,7 @@
|
||||
sas.read_flag,
|
||||
sa.titile as titile,
|
||||
sa.msg_content as msg_content,
|
||||
sa.msg_content_info as msg_content_info,
|
||||
sa.sender as sender,
|
||||
sa.priority as priority,
|
||||
sa.msg_category,
|
||||
@@ -37,11 +40,11 @@
|
||||
sa.bus_id as bus_id,
|
||||
sa.open_type as open_type,
|
||||
sa.open_page as open_page,
|
||||
sa.msg_abstract
|
||||
sa.msg_abstract,
|
||||
sa.document_id as document_id
|
||||
from sys_announcement_send sas
|
||||
left join sys_announcement sa ON sas.annt_id = sa.id
|
||||
where sa.send_status = '1'
|
||||
and sa.del_flag = '0'
|
||||
where sa.del_flag = '0'
|
||||
and sas.user_id = #{announcementSendModel.userId}
|
||||
<if test="announcementSendModel.titile !=null and announcementSendModel.titile != ''">
|
||||
and sa.titile LIKE concat(concat('%',#{announcementSendModel.titile}),'%')
|
||||
@@ -63,5 +66,30 @@
|
||||
</if>
|
||||
order by sas.read_flag,sa.send_time desc
|
||||
</select>
|
||||
<select id="getMessageUnreadList" parameterType="Object" resultMap="AnnouncementSendModel">
|
||||
select
|
||||
sas.id,
|
||||
sas.annt_id,
|
||||
sas.user_id,
|
||||
sas.read_flag,
|
||||
sa.titile as titile,
|
||||
sa.msg_content as msg_content,
|
||||
sa.msg_content_info as msg_content_info,
|
||||
sa.sender as sender,
|
||||
sa.priority as priority,
|
||||
sa.msg_category,
|
||||
sa.send_time as send_time,
|
||||
sa.bus_id as bus_id,
|
||||
sa.open_type as open_type,
|
||||
sa.open_page as open_page,
|
||||
sa.msg_abstract,
|
||||
sa.document_id as document_id
|
||||
from sys_announcement_send sas
|
||||
left join sys_announcement sa ON sas.annt_id = sa.id
|
||||
where sa.del_flag = '0'
|
||||
and sas.read_flag = '0'
|
||||
and sas.user_id = #{userId}
|
||||
order by sas.read_flag,sa.send_time desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
+12
-3
@@ -6,6 +6,15 @@
|
||||
<select id="getUserByName" resultType="com.jero.modules.system.entity.SysUser">
|
||||
select * from sys_user where username = #{username} and del_flag = 0
|
||||
</select>
|
||||
<!-- 根据用户名查询(批量) -->
|
||||
<select id="getUserListByNames" resultType="com.jero.modules.system.entity.SysUser">
|
||||
select * from sys_user
|
||||
where username in
|
||||
<foreach collection="usernames.split(',')" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
and del_flag = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据部门Id查询 -->
|
||||
<select id="getUserByDepId" resultType="com.jero.modules.system.entity.SysUser">
|
||||
@@ -55,7 +64,7 @@
|
||||
and username = #{username}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 修改用户部门code -->
|
||||
<update id="updateUserDepart">
|
||||
UPDATE sys_user SET org_code = #{orgCode} where username = #{username}
|
||||
@@ -65,7 +74,7 @@
|
||||
<select id="getUserByPhone" resultType="com.jero.modules.system.entity.SysUser">
|
||||
select * from sys_user where phone = #{phone} and del_flag = 0
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 根据邮箱查询用户信息 -->
|
||||
<select id="getUserByEmail" resultType="com.jero.modules.system.entity.SysUser">
|
||||
select * from sys_user where email = #{email} and del_flag = 0
|
||||
@@ -171,4 +180,4 @@
|
||||
and username != #{username}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
+7
-1
@@ -20,7 +20,7 @@ import lombok.Data;
|
||||
@Data
|
||||
public class AnnouncementSendModel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private java.lang.String id;
|
||||
@@ -32,6 +32,8 @@ public class AnnouncementSendModel implements Serializable {
|
||||
private java.lang.String titile;
|
||||
/**内容*/
|
||||
private java.lang.String msgContent;
|
||||
/**详细内容*/
|
||||
private java.lang.String msgContentInfo;
|
||||
/**发布人*/
|
||||
private java.lang.String sender;
|
||||
/**优先级(L低,M中,H高)*/
|
||||
@@ -76,5 +78,9 @@ public class AnnouncementSendModel implements Serializable {
|
||||
* 摘要
|
||||
*/
|
||||
private java.lang.String msgAbstract;
|
||||
/**
|
||||
* 文档id
|
||||
*/
|
||||
private java.lang.String documentId;
|
||||
|
||||
}
|
||||
|
||||
+3
-1
@@ -17,7 +17,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
public interface ISysAnnouncementSendService extends IService<SysAnnouncementSend> {
|
||||
|
||||
public List<String> queryByUserId(String userId);
|
||||
|
||||
|
||||
/**
|
||||
* @功能:获取我的消息
|
||||
* @param announcementSendModel
|
||||
@@ -25,4 +25,6 @@ public interface ISysAnnouncementSendService extends IService<SysAnnouncementSen
|
||||
*/
|
||||
public Page<AnnouncementSendModel> getMyAnnouncementSendPage(Page<AnnouncementSendModel> page,AnnouncementSendModel announcementSendModel);
|
||||
|
||||
List<AnnouncementSendModel> getMessageUnreadList();
|
||||
|
||||
}
|
||||
|
||||
+9
-1
@@ -4,10 +4,12 @@ import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.modules.system.entity.SysAnnouncementSend;
|
||||
import com.jero.modules.system.mapper.SysAnnouncementSendMapper;
|
||||
import com.jero.modules.system.model.AnnouncementSendModel;
|
||||
import com.jero.modules.system.service.ISysAnnouncementSendService;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -24,7 +26,7 @@ public class SysAnnouncementSendServiceImpl extends ServiceImpl<SysAnnouncementS
|
||||
|
||||
@Resource
|
||||
private SysAnnouncementSendMapper sysAnnouncementSendMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public List<String> queryByUserId(String userId) {
|
||||
return sysAnnouncementSendMapper.queryByUserId(userId);
|
||||
@@ -36,4 +38,10 @@ public class SysAnnouncementSendServiceImpl extends ServiceImpl<SysAnnouncementS
|
||||
return page.setRecords(sysAnnouncementSendMapper.getMyAnnouncementSendList(page, announcementSendModel));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AnnouncementSendModel> getMessageUnreadList() {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
return sysAnnouncementSendMapper.getMessageUnreadList(sysUser.getId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-4
@@ -32,10 +32,10 @@ public class SysAnnouncementServiceImpl extends ServiceImpl<SysAnnouncementMappe
|
||||
|
||||
@Resource
|
||||
private SysAnnouncementMapper sysAnnouncementMapper;
|
||||
|
||||
|
||||
@Resource
|
||||
private SysAnnouncementSendMapper sysAnnouncementSendMapper;
|
||||
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void saveAnnouncement(SysAnnouncement sysAnnouncement) {
|
||||
@@ -46,7 +46,7 @@ public class SysAnnouncementServiceImpl extends ServiceImpl<SysAnnouncementMappe
|
||||
sysAnnouncementMapper.insert(sysAnnouncement);
|
||||
// 2.插入用户通告阅读标记表记录
|
||||
String userId = sysAnnouncement.getUserIds();
|
||||
String[] userIds = userId.substring(0, (userId.length()-1)).split(",");
|
||||
String[] userIds = userId.split(",");
|
||||
String anntId = sysAnnouncement.getId();
|
||||
Date refDate = new Date();
|
||||
for(int i=0;i<userIds.length;i++) {
|
||||
@@ -59,7 +59,7 @@ public class SysAnnouncementServiceImpl extends ServiceImpl<SysAnnouncementMappe
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @功能:编辑消息信息
|
||||
*/
|
||||
|
||||
+69
-11
@@ -6,7 +6,9 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.constant.enums.CutEnum;
|
||||
import com.jero.common.constant.enums.MessageTypeEnum;
|
||||
import com.jero.common.constant.enums.ModuleEnum;
|
||||
import com.jero.common.constant.enums.YesOrNoEnum;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
@@ -25,7 +27,14 @@ import com.jero.modules.oss.entity.OSSFile;
|
||||
import com.jero.modules.oss.service.IOSSFileService;
|
||||
import com.jero.modules.subscribe.entity.OnlCgformSubscribe;
|
||||
import com.jero.modules.subscribe.service.IOnlCgformSubscribeService;
|
||||
import com.jero.modules.system.entity.SysAnnouncement;
|
||||
import com.jero.modules.system.entity.SysAnnouncementSend;
|
||||
import com.jero.modules.system.entity.SysDictItem;
|
||||
import com.jero.modules.system.entity.SysUser;
|
||||
import com.jero.modules.system.mapper.SysUserMapper;
|
||||
import com.jero.modules.system.service.ISysAnnouncementSendService;
|
||||
import com.jero.modules.system.service.ISysAnnouncementService;
|
||||
import com.jero.modules.system.service.impl.SysBaseApiImpl;
|
||||
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
|
||||
import com.jero.modules.tag.entity.OnlCgformArea;
|
||||
import com.jero.modules.tag.service.impl.OnlCgformAreaServiceImpl;
|
||||
@@ -96,6 +105,10 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
private IOnlCgformSubscribeService iOnlCgformSubscribeService;
|
||||
@Autowired
|
||||
private IBussLogEOService iBussLogEOService;
|
||||
@Autowired
|
||||
private ISysAnnouncementService sysAnnouncementService;
|
||||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
|
||||
@Value(value = "${jero.path.upload}")
|
||||
private String uploadpath;
|
||||
@@ -648,7 +661,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
|
||||
|
||||
//处理修改代替标准,发送通知
|
||||
sendMessage(map, dataList);
|
||||
sendMessage(map, dataList, fieldList, fieldDateList, fieldFileList, fieldPullList,cut);
|
||||
|
||||
|
||||
//字段
|
||||
@@ -745,6 +758,20 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
List<OnlCgformField> fieldFileList,
|
||||
List<OnlCgformField> fieldPullList,
|
||||
String cut) {
|
||||
StringBuilder sb = getUpdateInfo(map, dataList, fieldList, fieldDateList, fieldFileList, fieldPullList, cut);
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
if (StringUtils.isNotBlank(sb)) {
|
||||
String content = sb.substring(0, sb.length() - 1);
|
||||
BussLogEO bussLogEO = new BussLogEO();
|
||||
bussLogEO.setDocumentId((String) map.get("id"));
|
||||
bussLogEO.setContent(content);
|
||||
bussLogEO.setCreateBy(sysUser.getRealname());
|
||||
iBussLogEOService.add(bussLogEO);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private StringBuilder getUpdateInfo(Map<String, Object> map, List<Map<String, Object>> dataList, List<OnlCgformField> fieldList, List<OnlCgformField> fieldDateList, List<OnlCgformField> fieldFileList, List<OnlCgformField> fieldPullList, String cut) {
|
||||
Map<String, Object> mapTemp = new HashMap<>();
|
||||
mapCopy(map, mapTemp);
|
||||
//时间类型的字段
|
||||
@@ -860,15 +887,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
}
|
||||
}
|
||||
});
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
if (StringUtils.isNotBlank(sb)) {
|
||||
String content = sb.substring(0, sb.length() - 1);
|
||||
BussLogEO bussLogEO = new BussLogEO();
|
||||
bussLogEO.setDocumentId((String) map.get("id"));
|
||||
bussLogEO.setContent(content);
|
||||
bussLogEO.setCreateBy(sysUser.getRealname());
|
||||
iBussLogEOService.add(bussLogEO);
|
||||
}
|
||||
return sb;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -876,7 +895,43 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
*
|
||||
* @param map
|
||||
*/
|
||||
private void sendMessage(Map<String, Object> map, List<Map<String, Object>> dataList) {
|
||||
private void sendMessage(Map<String, Object> map,
|
||||
List<Map<String, Object>> dataList,
|
||||
List<OnlCgformField> fieldList,
|
||||
List<OnlCgformField> fieldDateList,
|
||||
List<OnlCgformField> fieldFileList,
|
||||
List<OnlCgformField> fieldPullList,
|
||||
String cut) {
|
||||
//修改的内容
|
||||
StringBuilder sb = getUpdateInfo(map, dataList, fieldList, fieldDateList, fieldFileList, fieldPullList, cut);
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String serialNumber = (String) dataList.get(0).get("serial_number");
|
||||
//只要修改了标准,就需要向订阅用户发送消息(内容为-->XXX对“GB 7258 进行了修改请及时查看”)
|
||||
//1.先判断是否订阅
|
||||
LambdaQueryWrapper<OnlCgformSubscribe> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(OnlCgformSubscribe::getDocumentId, (String)map.get("id"));
|
||||
List<OnlCgformSubscribe> onlCgformSubscribeList = iOnlCgformSubscribeService.list(lambdaQueryWrapper);
|
||||
List<String> userNameList = new ArrayList<>();
|
||||
if(onlCgformSubscribeList.size() != 0){
|
||||
for (OnlCgformSubscribe onlCgformSubscribe : onlCgformSubscribeList) {
|
||||
userNameList.add(onlCgformSubscribe.getCreateBy());
|
||||
}
|
||||
List<SysUser> userList = sysUserMapper.getUserListByNames(StringUtils.join(userNameList, ","));
|
||||
List<String> userIdList = userList.stream().map(SysUser::getId).collect(Collectors.toList());
|
||||
|
||||
SysAnnouncement sysAnnouncement = new SysAnnouncement();
|
||||
sysAnnouncement.setDelFlag("0");
|
||||
sysAnnouncement.setSendStatus("0");
|
||||
sysAnnouncement.setSendTime(new Date());
|
||||
sysAnnouncement.setDocumentId((String) dataList.get(0).get("id"));
|
||||
sysAnnouncement.setMsgCategory(MessageTypeEnum.READ.getValue());//消息类型
|
||||
sysAnnouncement.setMsgType(CommonConstant.MSG_TYPE_UESR);//指定用户
|
||||
sysAnnouncement.setMsgContent(sysUser.getRealname()+"对"+serialNumber+"进行了修改请及时查看");
|
||||
sysAnnouncement.setMsgContentInfo(sysUser.getRealname()+"修改标准"+serialNumber+"中"+sb.toString());
|
||||
sysAnnouncement.setUserIds(StringUtils.join(userIdList,","));
|
||||
//111111111111111111111111111111111
|
||||
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
|
||||
}
|
||||
//处理修改代替标准,发送通知
|
||||
//修改时前端传参
|
||||
String replaceStandard = (String) map.get("replace_standard");
|
||||
@@ -1186,13 +1241,16 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
if (idList.size() == 0) {
|
||||
return;
|
||||
}
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
LambdaQueryWrapper<OnlCgformCollection> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(OnlCgformCollection::getDocumentId, idList);
|
||||
wrapper.eq(OnlCgformCollection::getCreateBy,sysUser.getUsername());
|
||||
List<OnlCgformCollection> collectList = iOnlCgformCollectionService.list(wrapper);
|
||||
List<String> collectIdList = collectList.stream().map(OnlCgformCollection::getDocumentId).collect(Collectors.toList());
|
||||
//订阅
|
||||
LambdaQueryWrapper<OnlCgformSubscribe> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(OnlCgformSubscribe::getDocumentId, idList);
|
||||
lambdaQueryWrapper.eq(OnlCgformSubscribe::getCreateBy,sysUser.getUsername());
|
||||
List<OnlCgformSubscribe> subscribeList = iOnlCgformSubscribeService.list(lambdaQueryWrapper);
|
||||
List<String> subscribeIdList = subscribeList.stream().map(OnlCgformSubscribe::getDocumentId).collect(Collectors.toList());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user