Commit 9d9c8934 by chamberone

fix: 调整新建区划接口,可以不传边界

1 parent 4a4201c3
......@@ -8,9 +8,9 @@ import org.springframework.web.bind.annotation.RequestParam;
@FeignClient(url = "${SaaS.url}", name = "saasService")
public interface ISaaSRemoteService {
@PostMapping("/v1/area/add")
@PostMapping("/v1/bsh/area/add")
public String addArea(@RequestParam String ak, @RequestParam String name, @RequestParam String layerId,
@RequestParam String region, @RequestParam String coordType);
@RequestParam String center);
@PostMapping("/v1/area/delById")
public String deleteArea(@RequestParam String ak, @RequestParam String id);
......
......@@ -144,10 +144,8 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
@Transactional
@Override
public Result<?> businessServiceBlockAdd(String layerId, String teamId) throws BusinessException {
String layerName;
// 获取layerName
String layerName;
MapLayerEntity layer1 = mapLayerDao.getByLayerId(layerId);
if (layer1 == null) {
MapLayerCustomizeEntity layer2 = mapLayerCustomizeDao.getByLayerId(layerId);
......@@ -165,7 +163,7 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
throw new BusinessException("关联小队不存在");
}
// 重复检查layerId+teamId
// 重复检查layerId+teamId 注意:1个小队可以对应多个图层
MapBlockInfoEntity existBlock = mapBlockInfoDao.findByTeamIdAndLayerId(teamId, layerId);
if (null != existBlock) {
return Result.failure("区块已存在");
......@@ -174,15 +172,15 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
// 同步到saas,返回blockId
// 获取小队出发点,初始化区块
OrgGroupEntity group = orgGroupDao.getByGroupId(team.getGroupId());
String region = RegionUtils.constructRegion(group.getX(), group.getY());
String center = RegionUtils.constructCenter(group.getX(), group.getY());
// 获取saas图层id
String saasLayerId = getSaaSLayerId(team.getBranchId(), layerId);
if (StringUtils.isEmpty(saasLayerId)) {
return Result.failure("图层未配置");
return Result.failure(team.getTeamName() + " 图层未配置");
}
String result = saasRemoteService.addArea(ak, team.getTeamName(), saasLayerId, region, "gcj02mc");
log.info("params:{} {} {} {} result:{}", team.getTeamName(), saasLayerId, region, result);
String result = saasRemoteService.addArea(ak, team.getTeamName(), saasLayerId, center);
log.info("params:{} {} {} {} result:{}", team.getTeamName(), saasLayerId, center, result);
Result<String> saasResult = TypeUtils.convertResult(result);
if (!ResultEnum.SUCCESS.getCode().equals(saasResult.getCode())) {
return Result.failure("区块已存在或者裁剪为空");
......
......@@ -15,6 +15,13 @@ public class RegionUtils {
return gson.toJson(region);
}
public static String constructCenter(String x, String y) {
// 经纬度转墨卡托坐标
double xx = Double.parseDouble(x);
double yy = Double.parseDouble(y);
return gcj02LngToMercator(xx) + "," + gcj02LatToMercator(yy);
}
public static RegionDTO convertXyToRegion(double x, double y) {
// 经纬度转墨卡托坐标
double xx = gcj02LngToMercator(x);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!