文档库推送信息处理
This commit is contained in:
+23
-3
@@ -1397,9 +1397,12 @@ public class SysUserController {
|
|||||||
//获取当前组织下数据
|
//获取当前组织下数据
|
||||||
List<SysDepartTreeModel> departTreeModelList = sysDepartService.queryTreeListByDepartId(departId);
|
List<SysDepartTreeModel> departTreeModelList = sysDepartService.queryTreeListByDepartId(departId);
|
||||||
if (StringUtils.isNotEmpty(departId)) {
|
if (StringUtils.isNotEmpty(departId)) {
|
||||||
|
List<String> departIds = new ArrayList<>();
|
||||||
|
departIds.add(departId);
|
||||||
|
List<SysUser> sysUserList = sysUserService.getUserListByDepIds(departIds);
|
||||||
String json = sysPushVO.getJson();
|
String json = sysPushVO.getJson();
|
||||||
List<SysDepartUserTreeModel> allJson = JSONObject.parseArray(json, SysDepartUserTreeModel.class);
|
List<SysDepartUserTreeModel> allJson = JSONObject.parseArray(json, SysDepartUserTreeModel.class);
|
||||||
dealwithTree(departId, departTreeModelList, allJson);
|
dealwithTree(departId, departTreeModelList, allJson,sysUserList);
|
||||||
result.setResult(allJson);
|
result.setResult(allJson);
|
||||||
} else {
|
} else {
|
||||||
List<SysDepartUserTreeModel> departUserTreeModelList = new ArrayList<>();
|
List<SysDepartUserTreeModel> departUserTreeModelList = new ArrayList<>();
|
||||||
@@ -1441,8 +1444,12 @@ public class SysUserController {
|
|||||||
* @param departId 当前选中组织ID
|
* @param departId 当前选中组织ID
|
||||||
* @param departTreeModelList 当前组织下数据
|
* @param departTreeModelList 当前组织下数据
|
||||||
* @param json 其他组织数据
|
* @param json 其他组织数据
|
||||||
|
* @param sysUserList 用户信息
|
||||||
*/
|
*/
|
||||||
private void dealwithTree(String departId, List<SysDepartTreeModel> departTreeModelList, List<SysDepartUserTreeModel> json) {
|
private void dealwithTree(String departId,
|
||||||
|
List<SysDepartTreeModel> departTreeModelList,
|
||||||
|
List<SysDepartUserTreeModel> json,
|
||||||
|
List<SysUser> sysUserList) {
|
||||||
for (SysDepartUserTreeModel sysDepartUserTreeModel : json) {
|
for (SysDepartUserTreeModel sysDepartUserTreeModel : json) {
|
||||||
String id = sysDepartUserTreeModel.getId();
|
String id = sysDepartUserTreeModel.getId();
|
||||||
if (id.equals(departId)) {
|
if (id.equals(departId)) {
|
||||||
@@ -1453,6 +1460,19 @@ public class SysUserController {
|
|||||||
BeanUtils.copyProperties(sysDepartTreeModel, target);
|
BeanUtils.copyProperties(sysDepartTreeModel, target);
|
||||||
treeList.add(target);
|
treeList.add(target);
|
||||||
}
|
}
|
||||||
|
if(CollectionUtils.isNotEmpty(sysUserList)){
|
||||||
|
for (SysUser sysUser : sysUserList) {
|
||||||
|
//复制
|
||||||
|
SysDepartUserTreeModel target = new SysDepartUserTreeModel();
|
||||||
|
BeanUtils.copyProperties(sysUser, target);
|
||||||
|
target.setKey(sysUser.getId());
|
||||||
|
target.setTitle(sysUser.getRealname()+"("+sysUser.getUsername()+")");
|
||||||
|
target.setChildren(null);
|
||||||
|
target.setIsLeaf(true);
|
||||||
|
treeList.add(target);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
sysDepartUserTreeModel.setChildren(treeList);
|
sysDepartUserTreeModel.setChildren(treeList);
|
||||||
break;
|
break;
|
||||||
@@ -1460,7 +1480,7 @@ public class SysUserController {
|
|||||||
List<SysDepartUserTreeModel> children = sysDepartUserTreeModel.getChildren();
|
List<SysDepartUserTreeModel> children = sysDepartUserTreeModel.getChildren();
|
||||||
if (CollectionUtils.isNotEmpty(children)) {
|
if (CollectionUtils.isNotEmpty(children)) {
|
||||||
//复制
|
//复制
|
||||||
dealwithTree(departId, departTreeModelList, children);
|
dealwithTree(departId, departTreeModelList, children,sysUserList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-12
@@ -69,18 +69,6 @@
|
|||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getUserListByDepIds" resultType="com.jero.modules.system.entity.SysUser">
|
|
||||||
select * from sys_user where del_flag = 0
|
|
||||||
<if test="departIds!=null and departIds.size()>0">
|
|
||||||
and id in (select dru.user_id from sys_depart_role dr, sys_depart_role_user dru where dr.id = dru.drole_id and dr.depart_id in
|
|
||||||
<foreach collection="departIds" index="index" item="id" open="(" separator="," close=")">
|
|
||||||
#{id}
|
|
||||||
</foreach>
|
|
||||||
)
|
|
||||||
</if>
|
|
||||||
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!-- 根据角色Id查询 -->
|
<!-- 根据角色Id查询 -->
|
||||||
<select id="getUserByRoleId" resultType="com.jero.modules.system.entity.SysUser">
|
<select id="getUserByRoleId" resultType="com.jero.modules.system.entity.SysUser">
|
||||||
select * from sys_user where del_flag = 0 and id in (select user_id from sys_user_role where role_id=#{roleId})
|
select * from sys_user where del_flag = 0 and id in (select user_id from sys_user_role where role_id=#{roleId})
|
||||||
|
|||||||
+24
-15
@@ -49,6 +49,7 @@ import com.jero.modules.system.entity.SysDictItem;
|
|||||||
import com.jero.modules.system.entity.SysUser;
|
import com.jero.modules.system.entity.SysUser;
|
||||||
import com.jero.modules.system.mapper.SysUserMapper;
|
import com.jero.modules.system.mapper.SysUserMapper;
|
||||||
import com.jero.modules.system.service.ISysAnnouncementService;
|
import com.jero.modules.system.service.ISysAnnouncementService;
|
||||||
|
import com.jero.modules.system.service.ISysDepartService;
|
||||||
import com.jero.modules.system.service.ISysUserService;
|
import com.jero.modules.system.service.ISysUserService;
|
||||||
import com.jero.modules.system.service.impl.SysCategoryServiceImpl;
|
import com.jero.modules.system.service.impl.SysCategoryServiceImpl;
|
||||||
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
|
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
|
||||||
@@ -94,16 +95,7 @@ import java.io.OutputStream;
|
|||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
@@ -143,6 +135,8 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ISysUserService sysUserService;
|
private ISysUserService sysUserService;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
private ISysDepartService sysDepartService;
|
||||||
|
@Autowired
|
||||||
private JeroElasticsearchTemplate jeroElasticsearchTemplate;
|
private JeroElasticsearchTemplate jeroElasticsearchTemplate;
|
||||||
@Resource
|
@Resource
|
||||||
private WebSocket webSocket;
|
private WebSocket webSocket;
|
||||||
@@ -2995,24 +2989,39 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
// if(StringUtils.isBlank(documentIds)){
|
// if(StringUtils.isBlank(documentIds)){
|
||||||
// return "请选择文档";
|
// return "请选择文档";
|
||||||
// }
|
// }
|
||||||
|
Set<String> allDepartIds = new HashSet<>();
|
||||||
|
//查询当前部门下所有部门
|
||||||
|
if(StringUtils.isNotEmpty(departIds)){
|
||||||
|
String[] departIdArr = departIds.split(",");
|
||||||
|
for (String departId : departIdArr) {
|
||||||
|
List<String> subDepIdsByDepId = sysDepartService.getSubDepIdsByDepId(departId);
|
||||||
|
allDepartIds.addAll(subDepIdsByDepId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
List<String> userIdList = new ArrayList<>();
|
List<String> userIdList = new ArrayList<>();
|
||||||
List<String> thirdIdList = new ArrayList<>();
|
List<String> thirdIdList = new ArrayList<>();
|
||||||
if (StringUtils.isNotBlank(departIds)) {
|
if (StringUtils.isNotBlank(departIds)) {
|
||||||
//查询部门下的人员
|
//查询部门下的人员
|
||||||
List<SysUser> userList = sysUserService.getUserListByDepIds(Arrays.asList(departIds.split(",")));
|
List<SysUser> userList = sysUserService.getUserListByDepIds(new ArrayList<>(allDepartIds));
|
||||||
if (userList.size() != 0) {
|
if (userList.size() != 0) {
|
||||||
userIdList = userList.stream().map(SysUser::getId).collect(Collectors.toList());
|
userIdList = userList.stream().map(SysUser::getId).distinct().collect(Collectors.toList());
|
||||||
thirdIdList = userList.stream().map(SysUser::getThirdId).collect(Collectors.toList());
|
thirdIdList = userList.stream().map(SysUser::getThirdId).distinct().collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
userIdList.addAll(Arrays.asList(userIds.split(",")));
|
// userIdList.addAll(Arrays.asList(userIds.split(",")));
|
||||||
//查询文档
|
//查询文档
|
||||||
List<Map<String, Object>> mapList = bussDocumentLibraryEOMapper.selectMapsAll(documentIds);
|
List<Map<String, Object>> mapList = bussDocumentLibraryEOMapper.selectMapsAll(documentIds);
|
||||||
List<String> serialNumberList = new ArrayList<>();
|
List<String> serialNumberList = new ArrayList<>();
|
||||||
List<String> hrefList = new ArrayList<>();
|
List<String> hrefList = new ArrayList<>();
|
||||||
for (Map<String, Object> map : mapList) {
|
for (Map<String, Object> map : mapList) {
|
||||||
serialNumberList.add((String) map.get("serial_number"));
|
serialNumberList.add((String) map.get("serial_number"));
|
||||||
|
// String href = "<a href='/docManage/library/detail?id:" + idTemp +
|
||||||
|
// "&title:" + title +
|
||||||
|
// "&serial_number:" + serialNumber + "'" + " target='_blank'>" + serialNumber + "</a>";
|
||||||
|
|
||||||
String href = "<a href='/docManage/library/detail?id:" + (String) map.get("id") +
|
String href = "<a href='/docManage/library/detail?id:" + (String) map.get("id") +
|
||||||
"&title:" + (String) map.get("title") +
|
"&title:" + (String) map.get("title") +
|
||||||
"&serial_number:" + (String) map.get("serial_number") + "'" + " target='_blank'>" + (String) map.get("serial_number") + "</a>,";
|
"&serial_number:" + (String) map.get("serial_number") + "'" + " target='_blank'>" + (String) map.get("serial_number") + "</a>,";
|
||||||
@@ -3022,7 +3031,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
|
|
||||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
String content = sysUser.getRealname() + "向内推送了" + StringUtils.join(serialNumberList, ",") + ",请注意查看。";
|
String content = sysUser.getRealname() + "向内推送了" + StringUtils.join(serialNumberList, ",") + ",请注意查看。";
|
||||||
String contentInfo = sysUser.getRealname() + "向内推送了" + StringUtils.join(serialNumberList, ",") + ",请注意查看。";
|
String contentInfo = sysUser.getRealname() + "向内推送了" + StringUtils.join(hrefList, ",") + ",请注意查看。";
|
||||||
//封装消息的实体类
|
//封装消息的实体类
|
||||||
SysAnnouncement sysAnnouncement = getSysAnnouncement(userIdList, content, contentInfo);
|
SysAnnouncement sysAnnouncement = getSysAnnouncement(userIdList, content, contentInfo);
|
||||||
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
|
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
|
||||||
|
|||||||
Reference in New Issue
Block a user