项目管理添加与机构关联逻辑,bug修复等

This commit is contained in:
mi9688
2024-10-18 18:18:58 +08:00
parent a5c5d88b46
commit a8faa7cdeb
16 changed files with 668 additions and 25 deletions

View File

@ -1,7 +1,6 @@
package com.fastbee.ggroup.service.impl;
import cn.hutool.extra.ssh.JschUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.fastbee.common.exception.ServiceException;
@ -15,9 +14,6 @@ import com.fastbee.ggroup.mapper.GGroupsMapper;
import com.fastbee.ggroup.mapper.GSiteGroupsMapper;
import com.fastbee.ggroup.mapper.GSitesMapper;
import com.fastbee.ggroup.service.IGGroupsService;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.yulichang.query.MPJLambdaQueryWrapper;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -31,7 +27,7 @@ import java.util.stream.Collectors;
* 组Service业务层处理
*
* @author kerwincui
* @date 2024-09-27
* @date 2024-09-27
*/
@Service
public class GGroupsServiceImpl implements IGGroupsService
@ -39,8 +35,6 @@ public class GGroupsServiceImpl implements IGGroupsService
@Autowired
private GGroupsMapper gGroupsMapper;
@Autowired
private GSitesMapper gSitesMapper;
@Autowired
private GSiteGroupsMapper gSiteGroupsMapper;
@ -74,7 +68,6 @@ public class GGroupsServiceImpl implements IGGroupsService
GGroups::getOrderNum, GGroups::getSpace)
.in(GGroups::getProjectId, ProjectHolder.getProjectInfo().getProjectIdList())
.list();
return buildTree(list);
}
@ -94,7 +87,6 @@ public class GGroupsServiceImpl implements IGGroupsService
.leftJoin(GSites.class, GSites::getId, GSiteGroups::getSiteId)
.eq(GSiteGroups::getParentId, gGroups.getParentId())
.like(StringUtils.isNotBlank(gGroups.getName()), GGroups::getName, gGroups.getName());
;
return gSiteGroupsMapper.selectJoinList(GGroupSiteVo.class,gSiteGroupsMPJLambdaWrapper);
}
@ -165,7 +157,11 @@ public class GGroupsServiceImpl implements IGGroupsService
*/
@Override
public int insertGGroups(GGroups gGroups)
{ //同一个父节点下组名不能重复
{
//判断所属项目
//同一个父节点下组名不能重复
GGroups duplicateName=gGroupsMapper.selectOne(new LambdaQueryWrapper<GGroups>()
.select(GGroups::getId)
.eq(GGroups::getName, gGroups.getName().trim())
@ -239,15 +235,13 @@ public class GGroupsServiceImpl implements IGGroupsService
.in(GGroups::getProjectId, ProjectHolder.getProjectInfo().getProjectIdList())
.list();
System.err.println(ProjectHolder.getProjectInfo());
ProjectHolder.getProjectInfo().getProjectIdList().forEach(System.err::println);
list.forEach(System.err::println);
List<GGroups> gGroupsList = buildTreeSite(list);
List<List<GGroups>> listList = gGroupsList.stream().map(gGroups1 -> {
//组的树状结构外层数组元素套一层数组
return gGroupsList.stream().map(gGroups1 -> {
List<GGroups> list1 = new ArrayList<>();
list1.add(gGroups1);
return list1;
}).collect(Collectors.toList());
//组的树状结构
return listList;
}
}

View File

@ -94,7 +94,7 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
}
//未上传站点地图json数据
if(StringUtils.isBlank(gGroupSiteDto.getIcon())){
throw new ServiceException("上传站点地图json数据");
throw new ServiceException("选择站点图标");
}
//设置坐标值等信息
getReadJsonFileContent(gSites);
@ -116,9 +116,14 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
//TODO 路径优化
//发起http请求获取json数据
String space = gSites.getSpace();
if(Objects.isNull(space)){
if(StringUtils.isBlank(space)){
throw new ServiceException("请上传站点地图json数据");
}
//判断space是否是完整url还是相对url
if(!(space.contains("http://") || space.contains("https://"))){
//如果是相对url则代表未修改
return;
}
String jsonData = HttpUtil.get(space);
System.err.println("获取到json:"+jsonData);