Commit c140a1dc by chamberone

feat: 图层同步saas

1 parent 4598058a
......@@ -14,4 +14,6 @@ public interface MapBlockInfoDao extends JpaRepository<MapBlockInfoEntity, Integ
MapBlockInfoEntity findByBlockId(String blockId);
List<MapBlockInfoEntity> findByLayerId(String layerId);
}
......@@ -9,6 +9,7 @@ public class MapLayerCustomize {
private Integer id;
private String branchId;
private String layerId;
private String saasLayerId;
private String layer;
private String layerDescribe;
private Integer status;
......
package com.dituhui.pea.order.service.impl;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -12,6 +13,7 @@ import com.dituhui.pea.order.dto.BusinessCustomLayerRespDTO;
import com.dituhui.pea.order.dto.BusinessCustomLayersRespDTO;
import com.dituhui.pea.order.entity.*;
import com.dituhui.pea.order.feign.ISaaSRemoteService;
import com.dituhui.pea.order.feign.dto.LayerDTO;
import com.dituhui.pea.order.service.BusinessLayerService;
import com.dituhui.pea.order.utils.TypeUtils;
import lombok.extern.slf4j.Slf4j;
......@@ -42,6 +44,8 @@ public class BusinessLayerServiceImpl implements BusinessLayerService {
private SkillInfoMPDao skillInfoMPDao;
@Autowired
private ISaaSRemoteService saasRemoteService;
@Autowired
private MapBlockInfoDao mapBlockInfoDao;
@Override
public Result<?> businessLayerUniversal() {
......@@ -145,7 +149,6 @@ public class BusinessLayerServiceImpl implements BusinessLayerService {
throw new BusinessException("分部参数错误,请联系管理员/研发");
}
/* TODO
// 同步创建saas图层,返回layerId
String result = saasRemoteService.addLayer(ak, layerName, 1, 1);
......@@ -154,15 +157,14 @@ public class BusinessLayerServiceImpl implements BusinessLayerService {
if (!ResultEnum.SUCCESS.getCode().equals(saasResult.getCode())) {
return Result.failure(saasResult.getMessage());
}
*/
String saasLayerId = saasResult.getResult().getId();// 存入pea
// TODO 临时生成,正式使用^
//String layerId = saasResult.getResult().getId();// 存入pea
String layerId = UUID.randomUUID().toString().replace("-", "");
// 入库保存
MapLayerCustomize m = new MapLayerCustomize();
m.setLayerId(layerId);
m.setSaasLayerId(saasLayerId);
m.setLayer(layerName);
m.setLayerDescribe(layerDesc);
m.setBranchId(branchId);
......@@ -203,20 +205,23 @@ public class BusinessLayerServiceImpl implements BusinessLayerService {
throw new BusinessException("图层不存在");
}
// 更新状态为删除状态
layer.setStatus(0);
mapLayerCustomizeMPDao.updateById(layer);
/* TODO
// 检查下面是否还有区块
List<MapBlockInfoEntity> blocks = mapBlockInfoDao.findByLayerId(layerId);
if (CollectionUtils.isNotEmpty(blocks)) {
return Result.failure("该图层下面还有区块");
}
// 同步创建saas图层,返回layerId
String result = saasRemoteService.deleteLayer(ak, layerId);
// 同步删除saas图层
String result = saasRemoteService.deleteLayer(ak, layer.getSaasLayerId());
log.info("deleteLayer params:{} result:{}", layerId, result);
Result<Boolean> saasResult = TypeUtils.convertResult(result);
if (!ResultEnum.SUCCESS.getCode().equals(saasResult.getCode())) {
return Result.failure(saasResult.getMessage());
}
*/
// 更新状态为删除状态
layer.setStatus(0);
mapLayerCustomizeMPDao.updateById(layer);
return Result.success(null);
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!