|
@@ -28,7 +28,6 @@ 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 +39,7 @@ import java.io.Serializable;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.CompletableFuture;
|
|
|
import java.util.concurrent.ThreadPoolExecutor;
|
|
|
+import java.util.concurrent.atomic.AtomicInteger;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -124,25 +124,29 @@ public class MapServiceImpl extends SuperServiceImpl<MapMapper, Map> implements
|
|
|
mapContentMapper.deleteBatchIds(Arrays.asList(mapById.getPkId()));
|
|
|
mapLearningMapper.deleteBatchIds(Arrays.asList(mapById.getPkId()));
|
|
|
List<MapRouteDto> routes = mapDto.getRoutes();
|
|
|
+ //排序处理
|
|
|
+ AtomicInteger sortRoute = new AtomicInteger(1);
|
|
|
routes.forEach(route -> {
|
|
|
MapRoute mapRoute = new MapRoute();
|
|
|
BeanUtils.copyProperties(route, mapRoute);
|
|
|
mapRoute.setPkId(IdGenerator.getIdStr());
|
|
|
mapRoute.setMapId(mapById.getPkId());
|
|
|
mapRoute.setUpdateBy(userService.queryLoginUser());
|
|
|
+ mapRoute.setSort(sortRoute.getAndIncrement());
|
|
|
mapRouteMapper.insert(mapRoute);
|
|
|
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();
|
|
|
+ //排序处理
|
|
|
+ AtomicInteger sortMapContent = new AtomicInteger(1);
|
|
|
contents.forEach(content -> {
|
|
|
MapContent mapContent = new MapContent();
|
|
|
BeanUtils.copyProperties(content, mapContent);
|
|
|
mapContent.setPkId(IdGenerator.getIdStr());
|
|
|
mapContent.setMapId(mapRouteById.getMapId());
|
|
|
mapContent.setRouteId(mapRouteById.getPkId());
|
|
|
+ mapContent.setSort(sortMapContent.getAndIncrement());
|
|
|
mapContent.setUpdateBy(userService.queryLoginUser());
|
|
|
mapContentMapper.insert(mapContent);
|
|
|
});
|
|
@@ -510,15 +514,19 @@ public class MapServiceImpl extends SuperServiceImpl<MapMapper, Map> implements
|
|
|
knowledgeVo.setAttachmentType(strArray[suffixIndex]);
|
|
|
}
|
|
|
//添加分类信息
|
|
|
+ List<String> category = new ArrayList<>();
|
|
|
KnowledgeCategoryAdminVo knowledgeCategoryAdminVo = knowledgeCategoryService.findAllParentByCategoryId(knowledge.getCategoryId());
|
|
|
String name3 = knowledgeCategoryAdminVo.getName();
|
|
|
- knowledgeVo.setCategory(name3);
|
|
|
+ category.add(name3);
|
|
|
+ knowledgeVo.setCategory(category);
|
|
|
if (knowledgeCategoryAdminVo.getParents() != null){
|
|
|
String name2 = knowledgeCategoryAdminVo.getParents().getName();
|
|
|
- knowledgeVo.setCategory(name2 + " " + name3);
|
|
|
+ category.add(0,name2);
|
|
|
+ knowledgeVo.setCategory(category);
|
|
|
if (knowledgeCategoryAdminVo.getParents().getParents() != null){
|
|
|
String name1 = knowledgeCategoryAdminVo.getParents().getParents().getName();
|
|
|
- knowledgeVo.setCategory(name1 + " " +name2 + " " + name3);
|
|
|
+ category.add(0,name1);
|
|
|
+ knowledgeVo.setCategory(category);
|
|
|
}
|
|
|
}
|
|
|
return knowledgeVo;
|