Commit b1625a2a by chamberone

feat: 调整服务范围相关数据结构

1 parent 5639abe7
...@@ -14,7 +14,7 @@ public class MapBlockInfoEntity { ...@@ -14,7 +14,7 @@ public class MapBlockInfoEntity {
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id; private Integer id;
@Column(name = "area_ids", length = 1024, nullable = false) @Column(name = "area_ids", length = 1024)
private String areaIds; private String areaIds;
@Column(name = "area_name", length = 50, nullable = false) @Column(name = "area_name", length = 50, nullable = false)
...@@ -47,11 +47,14 @@ public class MapBlockInfoEntity { ...@@ -47,11 +47,14 @@ public class MapBlockInfoEntity {
@Column(name = "layer_name", length = 50, nullable = false) @Column(name = "layer_name", length = 50, nullable = false)
private String layerName; private String layerName;
@Column(name = "saas_layercode", length = 50, nullable = false) @Column(name = "saas_layercode", length = 50)
private String saasLayercode; private String saasLayercode;
@Column(name = "saas_layer_id", length = 50, nullable = false) @Column(name = "saas_layer_id", length = 50)
private String saasLayerName; private String saasLayerName;
@Column(name = "saas_url", length = 512)
private String saasUrl;
@Column(nullable = false) @Column(nullable = false)
private Boolean status; private Boolean status;
......
...@@ -38,6 +38,10 @@ public class BusinessBlockServiceImpl implements BusinessBlockService { ...@@ -38,6 +38,10 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
String ak; String ak;
@Value("${SaaS.url}") @Value("${SaaS.url}")
String url; String url;
@Value("${SaaS.userAccount}")
String userAccount;
@Value("${SaaS.userPassword}")
String password;
@Autowired @Autowired
private OrgTeamDao orgTeamDao; private OrgTeamDao orgTeamDao;
@Autowired @Autowired
...@@ -170,31 +174,31 @@ public class BusinessBlockServiceImpl implements BusinessBlockService { ...@@ -170,31 +174,31 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
// 重复检查layerId+teamId 注意:1个小队可以对应多个图层 // 重复检查layerId+teamId 注意:1个小队可以对应多个图层
MapBlockInfoEntity existBlock = mapBlockInfoDao.findByTeamIdAndLayerId(teamId, layerId); MapBlockInfoEntity existBlock = mapBlockInfoDao.findByTeamIdAndLayerId(teamId, layerId);
if (null != existBlock) { if (null != existBlock) {
return Result.failure("区块已存在"); return Result.failure("该工作队图层服务范围已存在");
} }
// 同步到saas,返回blockId // // 同步到saas,返回blockId
// 获取小队出发点,初始化区块 // // 获取小队出发点,初始化区块
OrgGroupEntity group = orgGroupDao.getByGroupId(team.getGroupId()); // OrgGroupEntity group = orgGroupDao.getByGroupId(team.getGroupId());
String center = RegionUtils.constructCenter(group.getX(), group.getY()); // String center = RegionUtils.constructCenter(group.getX(), group.getY());
// 获取saas图层id // // 获取saas图层id
String saasLayerId = getSaaSLayerId(team.getBranchId(), layerId); // String saasLayerId = getSaaSLayerId(team.getBranchId(), layerId);
if (StringUtils.isEmpty(saasLayerId)) { // if (StringUtils.isEmpty(saasLayerId)) {
return Result.failure(team.getTeamName() + " 图层未配置"); // return Result.failure(team.getTeamName() + " 图层未配置");
} // }
//
String result = saasRemoteService.addArea(ak, team.getTeamName(), saasLayerId, center); // String result = saasRemoteService.addArea(ak, team.getTeamName(), saasLayerId, center);
log.info("params:{} {} {} {} result:{}", team.getTeamName(), saasLayerId, center, result); // log.info("params:{} {} {} {} result:{}", team.getTeamName(), saasLayerId, center, result);
Result<String> saasResult = TypeUtils.convertResult(result); // Result<String> saasResult = TypeUtils.convertResult(result);
if (!ResultEnum.SUCCESS.getCode().equals(saasResult.getCode())) { // if (!ResultEnum.SUCCESS.getCode().equals(saasResult.getCode())) {
return Result.failure("区块已存在或者裁剪为空"); // return Result.failure("区块已存在或者裁剪为空");
} // }
String blockId = saasResult.getResult(); // String blockId = saasResult.getResult();
String blockName = String.format("%s_%s", layerName, team.getTeamName()); //区块名称 String blockName = String.format("%s_%s", layerName, team.getTeamName()); //区块名称
MapBlockInfoEntity block = new MapBlockInfoEntity(); MapBlockInfoEntity block = new MapBlockInfoEntity();
block.setAreaIds(blockId); // block.setAreaIds(blockId);
block.setAreaName(blockName); block.setAreaName(blockName);
block.setBranchId(team.getBranchId()); block.setBranchId(team.getBranchId());
block.setGroupId(team.getGroupId()); block.setGroupId(team.getGroupId());
...@@ -262,10 +266,6 @@ public class BusinessBlockServiceImpl implements BusinessBlockService { ...@@ -262,10 +266,6 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
throw new BusinessException("区块不存在"); throw new BusinessException("区块不存在");
} }
// TODO 根据当前block转换成分部,再转换成对应账号信息
String userAccount = "sMvf3yZWA69lKcvlgKcOHQ==";
String password = "qjOHxpQPXLnJP+Jq1CZGBQ==";
// 跳转SaaS url // 跳转SaaS url
// 获取saas图层id // 获取saas图层id
String saasLayerId = getSaaSLayerId(block.getBranchId(), block.getLayerId()); String saasLayerId = getSaaSLayerId(block.getBranchId(), block.getLayerId());
......
...@@ -63,6 +63,8 @@ sentry: ...@@ -63,6 +63,8 @@ sentry:
SaaS: SaaS:
url: https://pea-test.bshg.com.cn url: https://pea-test.bshg.com.cn
ak: 64e1cde3f9144bfb850b7d37c51af559 ak: 64e1cde3f9144bfb850b7d37c51af559
userAccount: sMvf3yZWA69lKcvlgKcOHQ==
userPassword: qjOHxpQPXLnJP+Jq1CZGBQ==
bean: bean:
server: https://bean-test.bshg.com.cn server: https://bean-test.bshg.com.cn
app-key: eDZEhTCxAcM9paRfwPjAM7RGkfmbf15S_PEA app-key: eDZEhTCxAcM9paRfwPjAM7RGkfmbf15S_PEA
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!