Commit c140a1dc by chamberone

feat: 图层同步saas

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