|
@@ -39,10 +39,7 @@ import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.Serializable;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.Collection;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -156,6 +153,11 @@ public class MapServiceImpl extends SuperServiceImpl<MapMapper, Map> implements
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 管理端查看地图详情
|
|
|
+ * @param pkId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public MapVo data(String pkId) {
|
|
|
MapVo mapVo = new MapVo();
|
|
|
Map map = mapMapper.selectById(pkId);
|
|
@@ -187,7 +189,11 @@ public class MapServiceImpl extends SuperServiceImpl<MapMapper, Map> implements
|
|
|
BeanUtils.copyProperties(knowledge,knowledgeVo);
|
|
|
String photo = (String) userService.querySexAndPhoto(knowledge.getCreateBy()).get("photo");
|
|
|
knowledgeVo.setAuthorHead(photo);
|
|
|
- knowledgeVo.setAttachmentType(knowledge.getAttachmentName());
|
|
|
+ // 有文件,截取文件名后缀
|
|
|
+ String attachmentName = knowledge.getAttachmentName();
|
|
|
+ String[] strArray = attachmentName.split("\\.");
|
|
|
+ int suffixIndex = strArray.length - 1;
|
|
|
+ knowledgeVo.setAttachmentType(strArray[suffixIndex]);
|
|
|
mapContentVo.setKnowledgeVo(knowledgeVo);
|
|
|
}
|
|
|
return mapContentVo;
|
|
@@ -199,6 +205,10 @@ public class MapServiceImpl extends SuperServiceImpl<MapMapper, Map> implements
|
|
|
return mapVo;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 管理端删除地图
|
|
|
+ * @param entities
|
|
|
+ */
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public void delete(Collection<Serializable> entities) {
|
|
@@ -212,10 +222,16 @@ public class MapServiceImpl extends SuperServiceImpl<MapMapper, Map> implements
|
|
|
this.getRepository().deleteBatchIds(entities);
|
|
|
}
|
|
|
|
|
|
- public List<HashMap<String, Object>> listOfType(Integer type) {
|
|
|
- List<Map> mapList = mapMapper.selectList(new LambdaQueryWrapper<Map>().eq(Map::getType, type));
|
|
|
- List<HashMap<String, Object>> result = mapList.stream().map(map -> {
|
|
|
- HashMap<String, Object> hashMap = new HashMap<>();
|
|
|
+ /**
|
|
|
+ * PC端根据地图类型字典值获取知识地图列表数据
|
|
|
+ * @param type
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<java.util.Map<String, Object>> listOfType(Integer type) {
|
|
|
+ List<Map> mapList = mapMapper.selectList(new LambdaQueryWrapper<Map>().eq(Map::getType, type).orderByAsc(Map::getCreateTime));
|
|
|
+ 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();
|
|
|
//权限判断
|
|
@@ -224,31 +240,62 @@ public class MapServiceImpl extends SuperServiceImpl<MapMapper, Map> implements
|
|
|
if (Arrays.asList(groupIds).contains(deptId)){
|
|
|
// 阅读权限为1,部门下全体员工可见
|
|
|
if (map.getGroupPurview() == 1){
|
|
|
- hashMap.put("pkId", map.getPkId());
|
|
|
- hashMap.put("name", map.getName());
|
|
|
- } else if (map.getGroupPurview() == 2){
|
|
|
+ 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){
|
|
|
- hashMap.put("pkId", map.getPkId());
|
|
|
- hashMap.put("name", map.getName());
|
|
|
+ mapResult.put("pkId", map.getPkId());
|
|
|
+ mapResult.put("name", map.getName());
|
|
|
+ listResult.add(mapResult);
|
|
|
}
|
|
|
- } else {
|
|
|
- return null;
|
|
|
}
|
|
|
- } else {
|
|
|
- return null;
|
|
|
}
|
|
|
- return hashMap;
|
|
|
- }).collect(Collectors.toList());
|
|
|
- return result;
|
|
|
+ });
|
|
|
+ return listResult;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * PC端根据知识地图ID获取知识地图配置的学习路径列表数据(加入权限判断)
|
|
|
+ * @param mapId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
public List<HashMap<String, Object>> routes(String mapId) {
|
|
|
- List<MapRoute> mapRouteList = mapRouteMapper.selectList(new LambdaQueryWrapper<MapRoute>().eq(MapRoute::getMapId, 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);
|
|
|
+ } 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 null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * PC端根据知识地图ID获取知识地图配置的学习路径列表数据(方法封装)
|
|
|
+ * @param mapId
|
|
|
+ * @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());
|