Commit ade2dc57 by 王力

Merge branch 'dev_layer0727' into 'develop'

Dev layer0727

See merge request !287
2 parents 83c1f046 fa1eaee7
...@@ -17,12 +17,12 @@ public class BusinessBlockController { ...@@ -17,12 +17,12 @@ public class BusinessBlockController {
/** /**
* 获取服务区块列表 * 获取服务区块列表
* *
* @param levelType 组织层级类型 * @param levelType 组织层级类型
* @param levelValue 组织层级值 * @param levelValue 组织层级值
* @param page 分页-页数 * @param page 分页-页数
* @param size 分页-页大小 * @param size 分页-页大小
* @param layerId 图层ID(筛选项) * @param layerId 图层ID(筛选项)
* @param teamId 小队ID(筛选项) * @param teamId 小队ID(筛选项)
* @return * @return
*/ */
@GetMapping("/business/service/block/list") @GetMapping("/business/service/block/list")
...@@ -30,19 +30,20 @@ public class BusinessBlockController { ...@@ -30,19 +30,20 @@ public class BusinessBlockController {
@RequestParam long page, @RequestParam long size, @RequestParam long page, @RequestParam long size,
@RequestParam(required = false) String layerId, @RequestParam(required = false) String layerId,
@RequestParam(required = false) String teamId) { @RequestParam(required = false) String teamId) {
Result<?> res=null; Result<?> res = null;
try{ try {
res = businessBlockService.businessServerBlocks(levelType, levelValue, page, size, layerId, teamId); res = businessBlockService.businessServerBlocks(levelType, levelValue, page, size, layerId, teamId);
} catch (BusinessException e){ } catch (BusinessException e) {
return Result.failed(e.getMessage()); return Result.failed(e.getMessage());
} }
return res; return res;
} }
/** /**
* 新增服务区块 * 新增服务区块
* *
* @param layerId 图层ID * @param layerId 图层ID
* @param teamId 小队ID * @param teamId 小队ID
* @return * @return
*/ */
...@@ -50,9 +51,9 @@ public class BusinessBlockController { ...@@ -50,9 +51,9 @@ public class BusinessBlockController {
public Result<?> businessServiceBlockAdd(@RequestParam String layerId, @RequestParam String teamId) { public Result<?> businessServiceBlockAdd(@RequestParam String layerId, @RequestParam String teamId) {
// 新增服务范围 // 新增服务范围
Result<?> res = null; Result<?> res = null;
try{ try {
res = businessBlockService.businessServiceBlockAdd(layerId, teamId); res = businessBlockService.businessServiceBlockAdd(layerId, teamId);
} catch (BusinessException e){ } catch (BusinessException e) {
return Result.failed(e.getMessage()); return Result.failed(e.getMessage());
} }
return res; return res;
...@@ -61,16 +62,16 @@ public class BusinessBlockController { ...@@ -61,16 +62,16 @@ public class BusinessBlockController {
/** /**
* 新增服务区块 * 新增服务区块
* *
* @param id 服务区块ID * @param id 服务区块ID
* @return * @return
*/ */
@PostMapping("/business/service/block/remove") @PostMapping("/business/service/block/remove")
public Result<?> businessServiceBlockRemove(@RequestParam String id) { public Result<?> businessServiceBlockRemove(@RequestParam String id) {
// 删除服务范围 // 删除服务范围
Result<?> res = null; Result<?> res = null;
try{ try {
res = businessBlockService.businessServiceBlockRemove(id); res = businessBlockService.businessServiceBlockRemove(id);
} catch (BusinessException e){ } catch (BusinessException e) {
return Result.failed(e.getMessage()); return Result.failed(e.getMessage());
} }
return res; return res;
...@@ -79,17 +80,37 @@ public class BusinessBlockController { ...@@ -79,17 +80,37 @@ public class BusinessBlockController {
/** /**
* 获取跳转saas绘制服务返回的url * 获取跳转saas绘制服务返回的url
* *
* @param id 服务区块ID * @param id 服务区块ID
* @return * @return
*/ */
@GetMapping("/saas/baseData/layer/getUrl") @GetMapping("/saas/baseData/layer/getUrl")
public Result<?> saasBaseDataLayerUrl(@RequestParam String id) { public Result<?> saasBaseDataLayerUrl(@RequestParam String id) {
Result<?> res=null; Result<?> res = null;
try{ try {
res = businessBlockService.saasBaseDataLayerUrl(id); res = businessBlockService.saasBaseDataLayerUrl(id);
} catch (BusinessException e){ } catch (BusinessException e) {
return Result.failed(e.getMessage());
}
return res;
}
/**
* 获取图层列表
*
* @param levelType 组织层级类型
* @param levelValue 组织层级值
* @return
*/
@GetMapping("/business/layer/list")
public Result<?> businessSeverLayers(@RequestParam String levelType, @RequestParam String levelValue) {
Result<?> res = null;
try {
res = businessBlockService.businessServerLayers(levelType, levelValue);
} catch (BusinessException e) {
return Result.failed(e.getMessage()); return Result.failed(e.getMessage());
} }
return res; return res;
} }
} }
...@@ -3,7 +3,11 @@ package com.dituhui.pea.order.dao; ...@@ -3,7 +3,11 @@ package com.dituhui.pea.order.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dituhui.pea.order.entity.MapLayerCustomize; import com.dituhui.pea.order.entity.MapLayerCustomize;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
@Mapper @Mapper
public interface MapLayerCustomizeMPDao extends BaseMapper<MapLayerCustomize> { public interface MapLayerCustomizeMPDao extends BaseMapper<MapLayerCustomize> {
@Select("select * from map_layer_customize where layer_id=#{layerId}")
MapLayerCustomize getByLayerId(String layerId);
} }
...@@ -2,8 +2,13 @@ package com.dituhui.pea.order.dao; ...@@ -2,8 +2,13 @@ package com.dituhui.pea.order.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dituhui.pea.order.entity.MapLayer; import com.dituhui.pea.order.entity.MapLayer;
import com.dituhui.pea.order.entity.MapLayerCustomize;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
@Mapper @Mapper
public interface MapLayerMPDao extends BaseMapper<MapLayer> { public interface MapLayerMPDao extends BaseMapper<MapLayer> {
@Select("select * from MapLayer where layer_id=#{layerId}")
MapLayer getByLayerId(String layerId);
} }
...@@ -3,7 +3,10 @@ package com.dituhui.pea.order.dao; ...@@ -3,7 +3,10 @@ package com.dituhui.pea.order.dao;
import com.dituhui.pea.order.entity.OrgTeam; import com.dituhui.pea.order.entity.OrgTeam;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
@Mapper @Mapper
public interface OrgTeamMPDao extends BaseMapper<OrgTeam> { public interface OrgTeamMPDao extends BaseMapper<OrgTeam> {
@Select("select * from org_team where team_id=#{teamId}")
OrgTeam getByTeamId(String teamId);
} }
...@@ -11,4 +11,6 @@ public interface BusinessBlockService { ...@@ -11,4 +11,6 @@ public interface BusinessBlockService {
Result<?> businessServiceBlockRemove(String blockId); Result<?> businessServiceBlockRemove(String blockId);
Result<?> saasBaseDataLayerUrl(String blockId); Result<?> saasBaseDataLayerUrl(String blockId);
Result<?> businessServerLayers(String levelType, String levelValue);
} }
...@@ -6,13 +6,9 @@ import com.dituhui.pea.common.BusinessException; ...@@ -6,13 +6,9 @@ import com.dituhui.pea.common.BusinessException;
import com.dituhui.pea.common.Result; import com.dituhui.pea.common.Result;
import com.dituhui.pea.order.common.ListUtils; import com.dituhui.pea.order.common.ListUtils;
import com.dituhui.pea.order.common.TimeUtils; import com.dituhui.pea.order.common.TimeUtils;
import com.dituhui.pea.order.dao.MapBlockInfoMPDao; import com.dituhui.pea.order.dao.*;
import com.dituhui.pea.order.dao.OrgGroupMPDao;
import com.dituhui.pea.order.dao.OrgTeamMPDao;
import com.dituhui.pea.order.dto.BusinessServerBlocksRespDTO; import com.dituhui.pea.order.dto.BusinessServerBlocksRespDTO;
import com.dituhui.pea.order.entity.MapBlockInfo; import com.dituhui.pea.order.entity.*;
import com.dituhui.pea.order.entity.OrgGroup;
import com.dituhui.pea.order.entity.OrgTeam;
import com.dituhui.pea.order.service.BusinessBlockService; import com.dituhui.pea.order.service.BusinessBlockService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -35,6 +31,12 @@ public class BusinessBlockServiceImpl implements BusinessBlockService { ...@@ -35,6 +31,12 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
@Autowired @Autowired
private OrgGroupMPDao orgGroupMPDao; private OrgGroupMPDao orgGroupMPDao;
@Autowired
private MapLayerMPDao mapLayerMPDao;
@Autowired
private MapLayerCustomizeMPDao mapLayerCustomizeMPDao;
@Override @Override
public Result<?> businessServerBlocks(String levelType, String levelValue, long page, long size, String layerId, String teamId) { public Result<?> businessServerBlocks(String levelType, String levelValue, long page, long size, String layerId, String teamId) {
BusinessServerBlocksRespDTO resp = new BusinessServerBlocksRespDTO(); BusinessServerBlocksRespDTO resp = new BusinessServerBlocksRespDTO();
...@@ -57,7 +59,7 @@ public class BusinessBlockServiceImpl implements BusinessBlockService { ...@@ -57,7 +59,7 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
// 获得teamId与team的映射 // 获得teamId与team的映射
Map<String, OrgTeam> teamMapping = new HashMap<>(); Map<String, OrgTeam> teamMapping = new HashMap<>();
for(OrgTeam t: teams){ for (OrgTeam t : teams) {
teamMapping.put(t.getTeamId(), t); teamMapping.put(t.getTeamId(), t);
} }
...@@ -78,7 +80,7 @@ public class BusinessBlockServiceImpl implements BusinessBlockService { ...@@ -78,7 +80,7 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
mapBlockInfoMPDao.selectPage(pg, lqwBlock); mapBlockInfoMPDao.selectPage(pg, lqwBlock);
List<BusinessServerBlocksRespDTO.Block> blocks = new ArrayList<>(); List<BusinessServerBlocksRespDTO.Block> blocks = new ArrayList<>();
for(MapBlockInfo b: pg.getRecords()){ for (MapBlockInfo b : pg.getRecords()) {
BusinessServerBlocksRespDTO.Block block = new BusinessServerBlocksRespDTO.Block(); BusinessServerBlocksRespDTO.Block block = new BusinessServerBlocksRespDTO.Block();
OrgTeam team = teamMapping.get(b.getTeamId()); OrgTeam team = teamMapping.get(b.getTeamId());
...@@ -109,14 +111,34 @@ public class BusinessBlockServiceImpl implements BusinessBlockService { ...@@ -109,14 +111,34 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
} }
@Override @Override
public Result<?> businessServiceBlockAdd(String layerId, String teamId) { public Result<?> businessServiceBlockAdd(String layerId, String teamId) throws BusinessException {
return null; MapLayerCustomize layer = mapLayerCustomizeMPDao.getByLayerId(layerId);
if (layer == null) {
throw new BusinessException("图层标签不存在");
}
OrgTeam team = orgTeamMPDao.getByTeamId(teamId);
if (team == null) {
throw new BusinessException("关联小队不存在");
}
MapBlockInfo block = new MapBlockInfo();
block.setBlockId(UUID.randomUUID().toString().replace("-", ""));
block.setBlockName(team.getTeamName()); //默认使用team name;
block.setBranchId(team.getBranchId());
block.setGroupId(team.getGroupId());
block.setTeamId(teamId);
block.setLayer(layerId);
block.setLayer(layer.getLayer());
block.setStatus(1);
mapBlockInfoMPDao.insert(block);
return Result.success(null);
} }
@Override @Override
public Result<?> businessServiceBlockRemove(String blockId) throws BusinessException{ public Result<?> businessServiceBlockRemove(String blockId) throws BusinessException {
MapBlockInfo block = mapBlockInfoMPDao.getByBlockId(blockId); MapBlockInfo block = mapBlockInfoMPDao.getByBlockId(blockId);
if(block == null) { if (block == null) {
throw new BusinessException("区块不存在"); throw new BusinessException("区块不存在");
} }
block.setStatus(0); block.setStatus(0);
...@@ -125,9 +147,9 @@ public class BusinessBlockServiceImpl implements BusinessBlockService { ...@@ -125,9 +147,9 @@ 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); MapBlockInfo block = mapBlockInfoMPDao.getByBlockId(blockId);
if(block == null) { if (block == null) {
throw new BusinessException("区块不存在"); throw new BusinessException("区块不存在");
} }
// 跳转规则: TODO // 跳转规则: TODO
...@@ -135,4 +157,40 @@ public class BusinessBlockServiceImpl implements BusinessBlockService { ...@@ -135,4 +157,40 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
res.put("url", "https://pea-test.bshg.com.cn/mlAutoLogin?userAccount=WVyjhzcOeIUc5rl74hdaqw==&password=qjOHxpQPXLnJP+Jq1CZGBQ==&jump=basedata&navHidden=true"); res.put("url", "https://pea-test.bshg.com.cn/mlAutoLogin?userAccount=WVyjhzcOeIUc5rl74hdaqw==&password=qjOHxpQPXLnJP+Jq1CZGBQ==&jump=basedata&navHidden=true");
return Result.success(res); return Result.success(res);
} }
@Override
public Result<?> businessServerLayers(String levelType, String levelValue) {
List<Map<String, String>> items = new ArrayList<>();
// 获取通用图层
List<MapLayer> layers = mapLayerMPDao.selectList(null);
for(MapLayer r: layers){
Map<String, String> m = new HashMap<>();
m.put("layerId", r.getLayerId());
m.put("layerName", r.getLayer());
items.add(m);
}
// 获取自定义图层(只有branch才能创建自定义图层)
LambdaQueryWrapper<OrgGroup> lqw = new LambdaQueryWrapper<>();
lqw.eq(levelType.equals("cluster"), OrgGroup::getClusterId, levelValue);
lqw.eq(levelType.equals("branch"), OrgGroup::getBranchId, levelValue);
lqw.eq(levelType.equals("group"), OrgGroup::getGroupId, levelValue);
Set<String> branchIds = orgGroupMPDao.selectList(lqw).stream().map(OrgGroup::getBranchId).collect(Collectors.toSet());
if (branchIds.isEmpty()) {
return Result.success(items);
}
LambdaQueryWrapper<MapLayerCustomize> lqwLayer = new LambdaQueryWrapper<>();
lqwLayer.eq(MapLayerCustomize::getDisabled, 1);
lqwLayer.in(MapLayerCustomize::getBranchId, new ArrayList<>(branchIds));
List<MapLayerCustomize> layerCustomizes = mapLayerCustomizeMPDao.selectList(lqwLayer);
for(MapLayerCustomize r: layerCustomizes) {
Map<String, String> m = new HashMap<>();
m.put("layerId", r.getLayerId());
m.put("layerName", r.getLayer());
items.add(m);
}
return Result.success(items);
}
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!