|
@@ -8,29 +8,27 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.redxun.common.base.db.BaseDao;
|
|
|
import com.redxun.common.base.db.BaseService;
|
|
|
import com.redxun.common.base.db.PageHelper;
|
|
|
+import com.redxun.common.base.entity.IUser;
|
|
|
import com.redxun.common.base.search.QueryFilter;
|
|
|
import com.redxun.common.service.impl.SuperServiceImpl;
|
|
|
import com.redxun.common.tool.IdGenerator;
|
|
|
+import com.redxun.common.utils.ContextUtil;
|
|
|
import com.redxun.knowledge.common.UserService;
|
|
|
import com.redxun.knowledge.entity.dao.Knowledge;
|
|
|
import com.redxun.knowledge.entity.vo.DicVo;
|
|
|
+import com.redxun.knowledge.entity.vo.KnowledgeCategoryAdminVo;
|
|
|
+import com.redxun.knowledge.map.entity.dao.*;
|
|
|
import com.redxun.knowledge.map.entity.dao.Map;
|
|
|
-import com.redxun.knowledge.map.entity.dao.MapContent;
|
|
|
-import com.redxun.knowledge.map.entity.dao.MapGroupPurviewUser;
|
|
|
-import com.redxun.knowledge.map.entity.dao.MapRoute;
|
|
|
import com.redxun.knowledge.map.entity.dto.MapContentDto;
|
|
|
import com.redxun.knowledge.map.entity.dto.MapDto;
|
|
|
import com.redxun.knowledge.map.entity.dto.MapRouteDto;
|
|
|
-import com.redxun.knowledge.map.entity.vo.KnowledgeVo;
|
|
|
-import com.redxun.knowledge.map.entity.vo.MapContentVo;
|
|
|
-import com.redxun.knowledge.map.entity.vo.MapRouteVo;
|
|
|
-import com.redxun.knowledge.map.entity.vo.MapVo;
|
|
|
-import com.redxun.knowledge.map.mapper.MapContentMapper;
|
|
|
-import com.redxun.knowledge.map.mapper.MapGroupPurviewUserMapper;
|
|
|
-import com.redxun.knowledge.map.mapper.MapMapper;
|
|
|
-import com.redxun.knowledge.map.mapper.MapRouteMapper;
|
|
|
+import com.redxun.knowledge.map.entity.vo.*;
|
|
|
+import com.redxun.knowledge.map.mapper.*;
|
|
|
import com.redxun.knowledge.service.CommonServiceImpl;
|
|
|
+import com.redxun.knowledge.service.KnowledgeCategoryServiceImpl;
|
|
|
import com.redxun.knowledge.service.KnowledgeServiceImpl;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
+import org.owasp.esapi.util.CollectionsUtil;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -40,6 +38,8 @@ import org.springframework.util.CollectionUtils;
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.Serializable;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.CompletableFuture;
|
|
|
+import java.util.concurrent.ThreadPoolExecutor;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -60,6 +60,9 @@ public class MapServiceImpl extends SuperServiceImpl<MapMapper, Map> implements
|
|
|
@Autowired
|
|
|
private MapGroupPurviewUserMapper mapGroupPurviewUserMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private MapLearningMapper mapLearningMapper;
|
|
|
+
|
|
|
@Autowired
|
|
|
private UserService userService;
|
|
|
|
|
@@ -69,13 +72,20 @@ public class MapServiceImpl extends SuperServiceImpl<MapMapper, Map> implements
|
|
|
@Autowired
|
|
|
private KnowledgeServiceImpl knowledgeService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ThreadPoolExecutor threadPoolExecutor;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private KnowledgeCategoryServiceImpl knowledgeCategoryService;
|
|
|
+
|
|
|
@Override
|
|
|
public BaseDao<Map> getRepository() {
|
|
|
return mapMapper;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 添加地图
|
|
|
+ * 添加地图或修改地图
|
|
|
+ *
|
|
|
* @param mapDto
|
|
|
* @return
|
|
|
*/
|
|
@@ -84,24 +94,35 @@ public class MapServiceImpl extends SuperServiceImpl<MapMapper, Map> implements
|
|
|
// 向地图表中添加数据
|
|
|
Map map = new Map();
|
|
|
BeanUtils.copyProperties(mapDto, map);
|
|
|
- if (mapDto.getPkId() == null){
|
|
|
+ if (mapDto.getPkId() == null) {
|
|
|
map.setPkId(IdGenerator.getIdStr());
|
|
|
+ map.setUpdateBy(userService.queryLoginUser());
|
|
|
+ mapMapper.insert(map);
|
|
|
+ } else {
|
|
|
+ mapMapper.updateById(map);
|
|
|
}
|
|
|
- map.setUpdateBy(userService.queryLoginUser());
|
|
|
- mapMapper.insert(map);
|
|
|
Map mapById = mapMapper.selectById(map.getPkId());
|
|
|
//向可阅读者表中添加数据
|
|
|
List<String> purviewUsers = mapDto.getPurviewUsers();
|
|
|
- purviewUsers.forEach(purviewUser -> {
|
|
|
- MapGroupPurviewUser mapGroupPurviewUser = new MapGroupPurviewUser();
|
|
|
- mapGroupPurviewUser.setPkId(IdGenerator.getIdStr());
|
|
|
- mapGroupPurviewUser.setMapId(mapById.getPkId());
|
|
|
- mapGroupPurviewUser.setUserId(purviewUser);
|
|
|
- mapGroupPurviewUser.setUpdateBy(userService.queryLoginUser());
|
|
|
- mapGroupPurviewUserMapper.insert(mapGroupPurviewUser);
|
|
|
- });
|
|
|
+ if (!CollectionUtils.isEmpty(purviewUsers)){
|
|
|
+ mapGroupPurviewUserMapper.deleteBatchIds(Arrays.asList(mapById.getPkId()));
|
|
|
+ purviewUsers.forEach(purviewUser -> {
|
|
|
+ MapGroupPurviewUser mapGroupPurviewUser = new MapGroupPurviewUser();
|
|
|
+ mapGroupPurviewUser.setPkId(IdGenerator.getIdStr());
|
|
|
+ mapGroupPurviewUser.setMapId(mapById.getPkId());
|
|
|
+ mapGroupPurviewUser.setUserId(purviewUser);
|
|
|
+ mapGroupPurviewUser.setUpdateBy(userService.queryLoginUser());
|
|
|
+ mapGroupPurviewUserMapper.insert(mapGroupPurviewUser);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ mapGroupPurviewUserMapper.deleteBatchIds(Arrays.asList(mapById.getPkId()));
|
|
|
+ }
|
|
|
+
|
|
|
// 向学习路径表中添加数据
|
|
|
if (!CollectionUtils.isEmpty(mapDto.getRoutes())) {
|
|
|
+ mapRouteMapper.deleteBatchIds(Arrays.asList(mapById.getPkId()));
|
|
|
+ mapContentMapper.deleteBatchIds(Arrays.asList(mapById.getPkId()));
|
|
|
+ mapLearningMapper.deleteBatchIds(Arrays.asList(mapById.getPkId()));
|
|
|
List<MapRouteDto> routes = mapDto.getRoutes();
|
|
|
routes.forEach(route -> {
|
|
|
MapRoute mapRoute = new MapRoute();
|
|
@@ -113,6 +134,8 @@ public class MapServiceImpl extends SuperServiceImpl<MapMapper, Map> implements
|
|
|
MapRoute mapRouteById = mapRouteMapper.selectById(mapRoute.getPkId());
|
|
|
// 向学习内容表中添加数据
|
|
|
if (!CollectionUtils.isEmpty(route.getContents())) {
|
|
|
+ mapContentMapper.deleteBatchIds(Arrays.asList(mapById.getPkId()));
|
|
|
+ mapLearningMapper.deleteBatchIds(Arrays.asList(mapById.getPkId()));
|
|
|
List<MapContentDto> contents = route.getContents();
|
|
|
contents.forEach(content -> {
|
|
|
MapContent mapContent = new MapContent();
|
|
@@ -123,15 +146,22 @@ public class MapServiceImpl extends SuperServiceImpl<MapMapper, Map> implements
|
|
|
mapContent.setUpdateBy(userService.queryLoginUser());
|
|
|
mapContentMapper.insert(mapContent);
|
|
|
});
|
|
|
+ } else {
|
|
|
+ mapContentMapper.deleteBatchIds(Arrays.asList(mapById.getPkId()));
|
|
|
+ mapLearningMapper.deleteBatchIds(Arrays.asList(mapById.getPkId()));
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
+ } else {
|
|
|
+ mapRouteMapper.deleteBatchIds(Arrays.asList(mapById.getPkId()));
|
|
|
+ mapContentMapper.deleteBatchIds(Arrays.asList(mapById.getPkId()));
|
|
|
+ mapLearningMapper.deleteBatchIds(Arrays.asList(mapById.getPkId()));
|
|
|
}
|
|
|
return mapById.getPkId();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 分页查询地图列表
|
|
|
+ *
|
|
|
* @param queryFilter
|
|
|
* @return
|
|
|
*/
|
|
@@ -143,33 +173,32 @@ public class MapServiceImpl extends SuperServiceImpl<MapMapper, Map> implements
|
|
|
records.forEach(e -> {
|
|
|
String typeName = e.getTypeName();
|
|
|
dicVoList.forEach(dicVo -> {
|
|
|
- if (dicVo.getValue().equals(typeName)){
|
|
|
+ if (dicVo.getValue().equals(typeName)) {
|
|
|
e.setTypeName(dicVo.getName());
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
return page;
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 管理端查看地图详情
|
|
|
+ *
|
|
|
* @param pkId
|
|
|
* @return
|
|
|
*/
|
|
|
public MapVo data(String pkId) {
|
|
|
MapVo mapVo = new MapVo();
|
|
|
Map map = mapMapper.selectById(pkId);
|
|
|
- BeanUtils.copyProperties(map,mapVo);
|
|
|
+ BeanUtils.copyProperties(map, mapVo);
|
|
|
List<DicVo> dicVoList = commonService.queryDic("KNOWLEDGE_MAP");
|
|
|
dicVoList.forEach(dicVo -> {
|
|
|
- if (map.getType().toString().equals(dicVo.getValue())){
|
|
|
+ if (map.getType().toString().equals(dicVo.getValue())) {
|
|
|
mapVo.setTypeName(dicVo.getName());
|
|
|
}
|
|
|
});
|
|
|
List<MapRoute> mapRouteList = mapRouteMapper.selectList(new LambdaQueryWrapper<MapRoute>().eq(MapRoute::getMapId, mapVo.getPkId()).orderByAsc(MapRoute::getSort));
|
|
|
- if (!CollectionUtils.isEmpty(mapRouteList)){
|
|
|
+ if (!CollectionUtils.isEmpty(mapRouteList)) {
|
|
|
List<MapRouteVo> mapRouteVoList = mapRouteList.stream().map(mapRoute -> {
|
|
|
MapRouteVo mapRouteVo = new MapRouteVo();
|
|
|
BeanUtils.copyProperties(mapRoute, mapRouteVo);
|
|
@@ -179,14 +208,14 @@ public class MapServiceImpl extends SuperServiceImpl<MapMapper, Map> implements
|
|
|
mapRouteVoList.forEach(mapRouteVo -> {
|
|
|
List<MapContent> mapContentList = mapContentMapper.selectList(new LambdaQueryWrapper<MapContent>().
|
|
|
eq(MapContent::getRouteId, mapRouteVo.getPkId()).orderByAsc(MapContent::getSort));
|
|
|
- if (!CollectionUtils.isEmpty(mapContentList)){
|
|
|
+ if (!CollectionUtils.isEmpty(mapContentList)) {
|
|
|
List<MapContentVo> mapContentVoList = mapContentList.stream().map(mapContent -> {
|
|
|
MapContentVo mapContentVo = new MapContentVo();
|
|
|
BeanUtils.copyProperties(mapContent, mapContentVo);
|
|
|
- if (mapContent.getKnowledgeId() != null){
|
|
|
+ if (mapContent.getKnowledgeId() != null) {
|
|
|
KnowledgeVo knowledgeVo = new KnowledgeVo();
|
|
|
Knowledge knowledge = knowledgeService.get(mapContent.getKnowledgeId());
|
|
|
- BeanUtils.copyProperties(knowledge,knowledgeVo);
|
|
|
+ BeanUtils.copyProperties(knowledge, knowledgeVo);
|
|
|
String photo = (String) userService.querySexAndPhoto(knowledge.getCreateBy()).get("photo");
|
|
|
knowledgeVo.setAuthorHead(photo);
|
|
|
// 有文件,截取文件名后缀
|
|
@@ -195,6 +224,11 @@ public class MapServiceImpl extends SuperServiceImpl<MapMapper, Map> implements
|
|
|
int suffixIndex = strArray.length - 1;
|
|
|
knowledgeVo.setAttachmentType(strArray[suffixIndex]);
|
|
|
mapContentVo.setKnowledgeVo(knowledgeVo);
|
|
|
+ //添加分类信息
|
|
|
+ KnowledgeCategoryAdminVo knowledgeCategoryAdminVo = knowledgeCategoryService.findAllParentByCategoryId(knowledge.getCategoryId());
|
|
|
+ mapContentVo.getKnowledgeVo().setKnowledgeCategoryAdminVo(knowledgeCategoryAdminVo);
|
|
|
+ } else {
|
|
|
+ mapContentVo.setKnowledgeVo(null);
|
|
|
}
|
|
|
return mapContentVo;
|
|
|
}).collect(Collectors.toList());
|
|
@@ -207,6 +241,7 @@ public class MapServiceImpl extends SuperServiceImpl<MapMapper, Map> implements
|
|
|
|
|
|
/**
|
|
|
* 管理端删除地图
|
|
|
+ *
|
|
|
* @param entities
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -218,12 +253,15 @@ public class MapServiceImpl extends SuperServiceImpl<MapMapper, Map> implements
|
|
|
mapRouteMapper.deleteBatchIds(entities);
|
|
|
//删除可查看员工表中数据
|
|
|
mapGroupPurviewUserMapper.deleteBatchIds(entities);
|
|
|
+ //删除学习记录表中数据
|
|
|
+ mapLearningMapper.deleteBatchIds(entities);
|
|
|
//删除地图表中数据
|
|
|
this.getRepository().deleteBatchIds(entities);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* PC端根据地图类型字典值获取知识地图列表数据
|
|
|
+ *
|
|
|
* @param type
|
|
|
* @return
|
|
|
*/
|
|
@@ -232,29 +270,10 @@ public class MapServiceImpl extends SuperServiceImpl<MapMapper, Map> implements
|
|
|
List<java.util.Map<String, Object>> listResult = new ArrayList<>();
|
|
|
mapList.forEach(map -> {
|
|
|
java.util.Map<String, Object> mapResult = new HashMap<>();
|
|
|
- //当前登录用户的部门Id
|
|
|
- String deptId = userService.queryLoginUserDeptId();
|
|
|
- //权限判断
|
|
|
- String[] groupIds = map.getGroupId().split(",");
|
|
|
- //是否包含当前用户的部门Id,如果包含 判断该用户是否可见
|
|
|
- if (Arrays.asList(groupIds).contains(deptId)){
|
|
|
- // 阅读权限为1,部门下全体员工可见
|
|
|
- if (map.getGroupPurview() == 1){
|
|
|
- mapResult.put("pkId", map.getPkId());
|
|
|
- mapResult.put("name", map.getName());
|
|
|
- listResult.add(mapResult);
|
|
|
- } else {
|
|
|
- QueryWrapper<MapGroupPurviewUser> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("MAP_ID",map.getPkId());
|
|
|
- queryWrapper.eq("USER_ID",userService.queryLoginUser());
|
|
|
- // 查询结果>0,说明该员工可见
|
|
|
- Integer count = mapGroupPurviewUserMapper.selectCount(queryWrapper);
|
|
|
- if (count > 0){
|
|
|
- mapResult.put("pkId", map.getPkId());
|
|
|
- mapResult.put("name", map.getName());
|
|
|
- listResult.add(mapResult);
|
|
|
- }
|
|
|
- }
|
|
|
+ if (hasRole(map.getPkId())) {
|
|
|
+ mapResult.put("pkId", map.getPkId());
|
|
|
+ mapResult.put("name", map.getName());
|
|
|
+ listResult.add(mapResult);
|
|
|
}
|
|
|
});
|
|
|
return listResult;
|
|
@@ -262,46 +281,187 @@ public class MapServiceImpl extends SuperServiceImpl<MapMapper, Map> implements
|
|
|
|
|
|
/**
|
|
|
* PC端根据知识地图ID获取知识地图配置的学习路径列表数据(加入权限判断)
|
|
|
+ *
|
|
|
* @param mapId
|
|
|
* @return
|
|
|
*/
|
|
|
public List<HashMap<String, Object>> routes(String mapId) {
|
|
|
+ if (hasRole(mapId)) {
|
|
|
+ List<MapRoute> mapRouteList = mapRouteMapper.selectList(new LambdaQueryWrapper<MapRoute>().eq(MapRoute::getMapId, mapId).orderByAsc(MapRoute::getSort));
|
|
|
+ List<HashMap<String, Object>> result = mapRouteList.stream().map(mapRoute -> {
|
|
|
+ HashMap<String, Object> hashMap = new HashMap<>();
|
|
|
+ hashMap.put("pkId", mapRoute.getPkId());
|
|
|
+ hashMap.put("name", mapRoute.getName());
|
|
|
+ return hashMap;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 设置地图学习内容学习状态-PC端
|
|
|
+ *
|
|
|
+ * @param pkId
|
|
|
+ */
|
|
|
+ public void updateLearningState(String pkId) {
|
|
|
+ String mapId = mapContentMapper.selectById(pkId).getMapId();
|
|
|
+ if (hasRole(mapId)) {
|
|
|
+ if (mapContentMapper.selectById(pkId) != null) {
|
|
|
+ MapLearning mapLearning = new MapLearning();
|
|
|
+ mapLearning.setPkId(IdGenerator.getIdStr());
|
|
|
+ mapLearning.setMapId(mapId);
|
|
|
+ mapLearning.setRouteId(mapContentMapper.selectById(pkId).getRouteId());
|
|
|
+ mapLearning.setContentId(pkId);
|
|
|
+ mapLearning.setUserId(userService.queryLoginUser());
|
|
|
+ mapLearningMapper.insert(mapLearning);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * PC端根据知识地图ID获取知识地图详情数据
|
|
|
+ *
|
|
|
+ * @param pkId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public MapPcVo info(String pkId) {
|
|
|
+ if (hasRole(pkId)) {
|
|
|
+ String userId = userService.queryLoginUser();
|
|
|
+ CompletableFuture<MapPcVo> mapPcVoCompletableFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
+ MapPcVo mapPcVo = mapMapper.info(pkId);
|
|
|
+ return mapPcVo;
|
|
|
+ }, threadPoolExecutor);
|
|
|
+ CompletableFuture<Void> titleCompletableFuture = mapPcVoCompletableFuture.thenAcceptAsync(mapPcVo -> {
|
|
|
+ List<DicVo> dicVoList = commonService.queryDic("KNOWLEDGE_MAP");
|
|
|
+ // 地图名称显示处理
|
|
|
+ Integer type = mapPcVo.getType();
|
|
|
+ dicVoList.forEach(dicVo -> {
|
|
|
+ if (dicVo.getValue().equals(type.toString())) {
|
|
|
+ mapPcVo.setTitle(dicVo.getName() + "-" + mapPcVo.getName());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }, threadPoolExecutor);
|
|
|
+ CompletableFuture<Void> knowledgeCountCompletableFuture = mapPcVoCompletableFuture.thenAcceptAsync(mapPcVo -> {
|
|
|
+ //地图收录知识数量
|
|
|
+ Integer knowledgeCount = mapContentMapper.
|
|
|
+ selectCount(new LambdaQueryWrapper<MapContent>().eq(MapContent::getMapId, pkId));
|
|
|
+ mapPcVo.setContentTotal(knowledgeCount);
|
|
|
+ }, threadPoolExecutor);
|
|
|
+ //查看相关知识
|
|
|
+ CompletableFuture<Void> knowledgeCompletableFuture = mapPcVoCompletableFuture.thenAcceptAsync(mapPcVo -> {
|
|
|
+ List<MapRouteVo> routes = mapPcVo.getRoutes();
|
|
|
+ routes.forEach(route -> {
|
|
|
+ List<MapContentVo> contents = route.getContents();
|
|
|
+ contents.forEach(content -> {
|
|
|
+ //查看知识
|
|
|
+ if (content.getKnowledgeId() != null) {
|
|
|
+ KnowledgeVo knowledgeVo = new KnowledgeVo();
|
|
|
+ Knowledge knowledge = knowledgeService.get(content.getKnowledgeId());
|
|
|
+ BeanUtils.copyProperties(knowledge, knowledgeVo);
|
|
|
+ String photo = (String) userService.querySexAndPhoto(knowledge.getCreateBy()).get("photo");
|
|
|
+ knowledgeVo.setAuthorHead(photo);
|
|
|
+ // 有文件,截取文件名后缀
|
|
|
+ String attachmentName = knowledge.getAttachmentName();
|
|
|
+ String[] strArray = attachmentName.split("\\.");
|
|
|
+ int suffixIndex = strArray.length - 1;
|
|
|
+ knowledgeVo.setAttachmentType(strArray[suffixIndex]);
|
|
|
+ content.setKnowledgeVo(knowledgeVo);
|
|
|
+ //添加分类信息
|
|
|
+ KnowledgeCategoryAdminVo knowledgeCategoryAdminVo = knowledgeCategoryService.findAllParentByCategoryId(knowledge.getCategoryId());
|
|
|
+ content.getKnowledgeVo().setKnowledgeCategoryAdminVo(knowledgeCategoryAdminVo);
|
|
|
+ } else {
|
|
|
+ content.setKnowledgeVo(null);
|
|
|
+ }
|
|
|
+ //设置学习内容状态
|
|
|
+ if (updateState(userId, pkId, route.getPkId(), content.getPkId()) > 0) {
|
|
|
+ content.setState(1);
|
|
|
+ } else {
|
|
|
+ content.setState(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
+ //设置学习路径状态
|
|
|
+ if (contents.stream().allMatch(e -> e.getState() == 1)) {
|
|
|
+ route.setState(1);
|
|
|
+ } else {
|
|
|
+ route.setState(0);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }, threadPoolExecutor);
|
|
|
+ CompletableFuture.allOf(mapPcVoCompletableFuture,
|
|
|
+ titleCompletableFuture,
|
|
|
+ knowledgeCountCompletableFuture,
|
|
|
+ knowledgeCompletableFuture).join();
|
|
|
+ return mapPcVoCompletableFuture.join();
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ //变更学习状态(逻辑变更)
|
|
|
+ public Integer updateState(String userId, String mapId, String routeId, String contentId) {
|
|
|
+ QueryWrapper<MapLearning> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("USER_ID", userId);
|
|
|
+ queryWrapper.eq("MAP_ID", mapId);
|
|
|
+ queryWrapper.eq("ROUTE_ID", routeId);
|
|
|
+ queryWrapper.eq("CONTENT_ID", contentId);
|
|
|
+ Integer count = mapLearningMapper.selectCount(queryWrapper);
|
|
|
+ return count;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 权限判断方法(知识地图PC端使用)
|
|
|
+ * @param mapId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public boolean hasRole(String mapId) {
|
|
|
//权限判断
|
|
|
Map map = mapMapper.selectById(mapId);
|
|
|
//当前登录用户的部门Id
|
|
|
String deptId = userService.queryLoginUserDeptId();
|
|
|
+ //地图对应的部门权限
|
|
|
String[] groupIds = map.getGroupId().split(",");
|
|
|
//包含登录人的部门
|
|
|
if (Arrays.asList(groupIds).contains(deptId)) {
|
|
|
if (map.getGroupPurview() == 1) {
|
|
|
- return routesInfo(mapId);
|
|
|
+ return true;
|
|
|
} else {
|
|
|
QueryWrapper<MapGroupPurviewUser> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq("MAP_ID", map.getPkId());
|
|
|
queryWrapper.eq("USER_ID", userService.queryLoginUser());
|
|
|
// 查询结果>0,说明该员工可见
|
|
|
Integer count = mapGroupPurviewUserMapper.selectCount(queryWrapper);
|
|
|
- if (count > 0) {
|
|
|
- return routesInfo(mapId);
|
|
|
- }
|
|
|
+ return count > 0;
|
|
|
}
|
|
|
}
|
|
|
- return null;
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * PC端根据知识地图ID获取知识地图配置的学习路径列表数据(方法封装)
|
|
|
- * @param mapId
|
|
|
+ * 根据搜索条件(地图名称、所属组织、地图类型、操作人和操作时间)分页查询地图列表数据
|
|
|
+ * @param filter
|
|
|
+ * @param params
|
|
|
* @return
|
|
|
*/
|
|
|
- private List<HashMap<String, Object>> routesInfo(String mapId) {
|
|
|
- List<MapRoute> mapRouteList = mapRouteMapper.selectList(new LambdaQueryWrapper<MapRoute>().eq(MapRoute::getMapId, mapId).orderByAsc(MapRoute::getSort));
|
|
|
- List<HashMap<String, Object>> result = mapRouteList.stream().map(mapRoute -> {
|
|
|
- HashMap<String, Object> hashMap = new HashMap<>();
|
|
|
- hashMap.put("pkId", mapRoute.getPkId());
|
|
|
- hashMap.put("name", mapRoute.getName());
|
|
|
- return hashMap;
|
|
|
- }).collect(Collectors.toList());
|
|
|
- return result;
|
|
|
+ public IPage<OsUserVo> queryGroupUsers(QueryFilter filter, java.util.Map params) {
|
|
|
+ String groupIds = (String)params.get("groupIds");
|
|
|
+ if (StringUtils.isNotEmpty(groupIds)) {
|
|
|
+ if ("curOrg".equals(groupIds)) {
|
|
|
+ IUser user = ContextUtil.getCurrentUser();
|
|
|
+ if (user != null) {
|
|
|
+ groupIds = user.getDeptId();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ String[] groupIdList = groupIds.split(",");
|
|
|
+ params.put("groupIdList", Arrays.asList(groupIdList));
|
|
|
+ }
|
|
|
+
|
|
|
+ IPage<OsUserVo> osUserIPage = mapMapper.queryGroupUsers(filter.getPage(), params);
|
|
|
+ List<OsUserVo> osUsers = osUserIPage.getRecords();
|
|
|
+ osUsers.forEach(e -> e.setGroupSummary(mapGroupPurviewUserMapper.findGroupSummary(e.getUserId())));
|
|
|
+ return osUserIPage;
|
|
|
}
|
|
|
+
|
|
|
}
|