Commit 731bda9a by wangli

mp2jpa

1 parent f3f8f699
...@@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.persistence.EntityManager;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -48,6 +49,9 @@ public class BusinessBlockServiceImpl implements BusinessBlockService { ...@@ -48,6 +49,9 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
@Autowired @Autowired
private MapLayerCustomizeDao mapLayerCustomizeDao; private MapLayerCustomizeDao mapLayerCustomizeDao;
@Autowired
private EntityManager entityManager;
@Value("${SaaS.ak}") @Value("${SaaS.ak}")
String ak; String ak;
...@@ -159,7 +163,7 @@ public class BusinessBlockServiceImpl implements BusinessBlockService { ...@@ -159,7 +163,7 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
} }
// 重复检查layerId+teamId // 重复检查layerId+teamId
MapBlockInfo existBlock = mapBlockInfoMPDao.getByTeamIdAndLayerId(teamId, layerId); MapBlockInfoEntity existBlock = mapBlockInfoDao.findByTeamIdAndLayerId(teamId, layerId);
if (null != existBlock) { if (null != existBlock) {
return Result.failure("区块已存在"); return Result.failure("区块已存在");
} }
...@@ -224,13 +228,13 @@ public class BusinessBlockServiceImpl implements BusinessBlockService { ...@@ -224,13 +228,13 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
@Override @Override
public Result<?> businessServiceBlockRemove(String blockId) throws BusinessException { public Result<?> businessServiceBlockRemove(String blockId) throws BusinessException {
MapBlockInfo block = mapBlockInfoMPDao.getByBlockId(blockId); MapBlockInfoEntity block = mapBlockInfoDao.findByBlockId(blockId);
if (block == null) { if (block == null) {
throw new BusinessException("区块不存在"); throw new BusinessException("区块不存在");
} }
block.setStatus(0); block.setStatus(false);
mapBlockInfoMPDao.updateById(block); entityManager.merge(block);
// 同步删除saas区块 // 同步删除saas区块
String result = saasRemoteService.deleteArea(ak, blockId); String result = saasRemoteService.deleteArea(ak, blockId);
log.info("params:{} result:{}", blockId, result); log.info("params:{} result:{}", blockId, result);
...@@ -244,7 +248,7 @@ public class BusinessBlockServiceImpl implements BusinessBlockService { ...@@ -244,7 +248,7 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
@Override @Override
public Result<?> saasBaseDataLayerUrl(String blockId) throws BusinessException { public Result<?> saasBaseDataLayerUrl(String blockId) throws BusinessException {
MapBlockInfo block = mapBlockInfoMPDao.getByBlockId(blockId); MapBlockInfoEntity block = mapBlockInfoDao.findByBlockId(blockId);
if (block == null) { if (block == null) {
throw new BusinessException("区块不存在"); throw new BusinessException("区块不存在");
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!