bug修复,项目管理接口逻辑完善

This commit is contained in:
mi9688
2024-10-31 17:51:50 +08:00
parent 502a785d3b
commit 318cee69c1
8 changed files with 99 additions and 97 deletions

View File

@ -1,5 +1,7 @@
package com.fastbee.ggroup.domain.vo;
import com.fastbee.common.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ -13,7 +15,8 @@ public class GGroupSiteVo {
private String type; // 对应 gs.type
private String space; // 对应 gs.space
private String spaceValue; // 对应 gs.space
private String areaCode;// 对应 gs.area_code
private String areaCode;// 对应 站点行政区划代码
private String fullAreaCode;//站点行政区划完整代码
// Getter 和 Setter

View File

@ -83,7 +83,8 @@ public class GGroupsServiceImpl implements IGGroupsService
.select(GSiteGroups::getId, GSiteGroups::getParentId, GSiteGroups::getSiteId)
// .select(GGroups::getName)//起个别名
// .selectAs(GGroups::getName, "parentName")
.select(GSites::getName, GSites::getIcon, GSites::getType, GSites::getSpace, GSites::getSpaceValue)
.select(GSites::getName, GSites::getIcon, GSites::getType, GSites::getSpace, GSites::getSpaceValue,
GSites::getAreaCode,GSites::getFullAreaCode)
.leftJoin(GGroups.class, GGroups::getId, GSiteGroups::getParentId)
.leftJoin(GSites.class, GSites::getId, GSiteGroups::getSiteId)
.eq(GSiteGroups::getParentId, gGroups.getParentId())
@ -175,7 +176,8 @@ public class GGroupsServiceImpl implements IGGroupsService
public List<GGroupSiteVo> selectGGroupsAllListSites(GGroups gGroups) {
MPJLambdaWrapper<GSiteGroups> gSiteGroupsMPJLambdaWrapper = new MPJLambdaWrapper<GSiteGroups>()
.select(GSiteGroups::getId, GSiteGroups::getParentId, GSiteGroups::getSiteId)
.select(GSites::getName, GSites::getIcon, GSites::getType, GSites::getSpace, GSites::getSpaceValue,GSites::getAreaCode)
.select(GSites::getName, GSites::getIcon, GSites::getType, GSites::getSpace,
GSites::getSpaceValue,GSites::getAreaCode,GSites::getFullAreaCode)
.leftJoin(GGroups.class, GGroups::getId, GSiteGroups::getParentId)
.leftJoin(GSites.class, GSites::getId, GSiteGroups::getSiteId)
.in(!ProjectHolder.getProjectInfo().getProjectIdList().isEmpty(),GGroups::getProjectId,ProjectHolder.getProjectInfo().getProjectIdList());

View File

@ -3,6 +3,8 @@ package com.fastbee.ggroup.service.impl;
import java.util.List;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@ -62,7 +64,7 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
@Override
public List<GSites> selectGSitesList(GSitesSelectDto gSites) {
return new LambdaQueryChainWrapper<>(gSitesMapper)
.select(GSites::getId, GSites::getName, GSites::getIcon, GSites::getType)
.select(GSites::getId, GSites::getName, GSites::getIcon, GSites::getType,GSites::getAreaCode,GSites::getFullAreaCode)
.eq(GSites::getProjectId, gSites.getProjectId())
.list();
}
@ -149,9 +151,9 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
JSONArray jsonArray = JSONUtil.parseArray(coordinates);
//判断数组每个元素必须为经度或纬度
for (Object o : jsonArray) {
if(isLongitudeOrLatitude(o.toString())){
/* if(isLongitudeOrLatitude(o.toString())){
throw new ServiceException("coordinates数组元素必须为经度或纬度");
}
}*/
}
int startIndex = space.indexOf("/profile/upload/");
@ -161,25 +163,26 @@ public class GSitesServiceImpl extends ServiceImpl<GSiteGroupsMapper,GSiteGroups
}
/**
* 判断字符串是不是经度或者纬度
* @param str 经纬度字符串
* @return true or false
* @return true false
*/
private boolean isLongitudeOrLatitude(String str) {
String regex = "^[-+]?\\d{1,3}\\.\\d+$";
double value = Double.parseDouble(str);
//满足经度值
if (value >= -180 && value <= 180) {
return true;
}
//满足纬度值
else if (value >= -90 && value <= 90) {
return true;
}
return false;
String regex = "^[-+]?\\d{1,3}(\\.\\d+)?$"; // 修改了正则表达式的格式,允许有或无小数部分
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(str);
// 如果字符串匹配正则表达式且值的范围在经纬度范围内,则返回 true
return matcher.matches() && isValueInRange(str);
}
private boolean isValueInRange(String str) {
double value = Double.parseDouble(str);
return value >= -180 && value <= 180; // 经度范围
// 如果需要判断纬度则再添加一行判断逻辑else if (value >= -90 && value <= 90) return true; 或者根据需要合并到一行判断中。
}
/**
* 修改站点