Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 4a0a8788
authored
Jul 28, 2023
by
chamberone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 创建服务范围同步saas区块
1 parent
1562e890
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
3 deletions
project-order/src/main/java/com/dituhui/pea/order/feign/ISaaSRemoteService.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/BusinessBlockServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/utils/TypeUtils.java
project-order/src/main/resources/application.yaml
project-order/src/main/java/com/dituhui/pea/order/feign/ISaaSRemoteService.java
View file @
4a0a878
...
...
@@ -8,8 +8,8 @@ import org.springframework.web.bind.annotation.RequestParam;
public
interface
ISaaSRemoteService
{
@PostMapping
(
"/v1/area/add"
)
public
String
addArea
(
@RequestParam
String
ak
,
@RequestParam
String
sign
,
@RequestParam
String
name
,
@RequestParam
String
layer_code
,
@RequestParam
String
region
,
@RequestParam
String
coord_t
ype
);
public
String
addArea
(
@RequestParam
String
ak
,
@RequestParam
String
name
,
@RequestParam
String
layerId
,
@RequestParam
String
region
,
@RequestParam
String
coordT
ype
);
@PostMapping
(
"/v1/area/delById"
)
public
String
deleteArea
(
@RequestParam
String
ak
,
@RequestParam
String
layerCode
,
@RequestParam
String
id
);
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/BusinessBlockServiceImpl.java
View file @
4a0a878
...
...
@@ -4,15 +4,20 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.dituhui.pea.common.BusinessException
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.common.ResultEnum
;
import
com.dituhui.pea.order.common.ListUtils
;
import
com.dituhui.pea.order.common.TimeUtils
;
import
com.dituhui.pea.order.dao.*
;
import
com.dituhui.pea.order.dto.BusinessServerBlocksRespDTO
;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.feign.ISaaSRemoteService
;
import
com.dituhui.pea.order.service.BusinessBlockService
;
import
com.dituhui.pea.order.utils.TypeUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
...
...
@@ -36,6 +41,12 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
@Autowired
private
MapLayerCustomizeMPDao
mapLayerCustomizeMPDao
;
@Autowired
private
ISaaSRemoteService
saasRemoteService
;
@Value
(
"${SaaS.ak}"
)
String
ak
;
@Override
public
Result
<?>
businessServerBlocks
(
String
levelType
,
String
levelValue
,
long
page
,
long
size
,
String
layerId
,
String
teamId
)
{
...
...
@@ -133,8 +144,19 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
throw
new
BusinessException
(
"关联小队不存在"
);
}
// 同步到saas,返回blockId
// 获取小队出发点,初始化区块 TODO
String
region
=
"{points:[{\"x\":1.3720127240270969E7,\"y\":3692634.103416302},{\"x\":1.37245800199027E7,\"y\":3692634.103416302},{\"x\":1.3720127240270969E7,\"y\":3744947.448648849},{\"x\":1.3720127240270969E7,\"y\":3692634.103416302}]}"
;
String
result
=
saasRemoteService
.
addArea
(
ak
,
team
.
getTeamName
(),
layerId
,
region
,
"gcj02mc"
);
log
.
info
(
"params:{} {} {} result:{}"
,
team
.
getTeamName
(),
layerId
,
region
,
result
);
Result
<
String
>
saasResult
=
TypeUtils
.<
String
>
convertResult
(
result
);
if
(!
ResultEnum
.
SUCCESS
.
getCode
().
equals
(
saasResult
.
getCode
()))
{
return
Result
.
failure
(
"区块已存在或者裁剪为空"
);
}
String
blockId
=
saasResult
.
getResult
();
MapBlockInfo
block
=
new
MapBlockInfo
();
block
.
setBlockId
(
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
)
);
block
.
setBlockId
(
blockId
);
block
.
setBlockName
(
team
.
getTeamName
());
//默认使用team name;
block
.
setBranchId
(
team
.
getBranchId
());
block
.
setGroupId
(
team
.
getGroupId
());
...
...
project-order/src/main/java/com/dituhui/pea/order/utils/TypeUtils.java
0 → 100644
View file @
4a0a878
package
com
.
dituhui
.
pea
.
order
.
utils
;
import
java.lang.reflect.Type
;
import
org.apache.commons.lang3.StringUtils
;
import
com.dituhui.pea.common.Result
;
import
com.google.gson.Gson
;
import
com.google.gson.reflect.TypeToken
;
public
class
TypeUtils
{
private
final
static
Gson
gson
=
new
Gson
();
public
static
<
T
>
Result
<
T
>
convertResult
(
String
text
)
{
if
(
StringUtils
.
isEmpty
(
text
))
{
return
null
;
}
Type
type
=
new
TypeToken
<
Result
<
T
>>()
{
}.
getType
();
Result
<
T
>
t
=
gson
.
fromJson
(
text
,
type
);
return
t
;
}
}
project-order/src/main/resources/application.yaml
View file @
4a0a878
...
...
@@ -58,4 +58,5 @@ sentry:
SaaS
:
url
:
https://pea-test.bshg.com.cn
ak
:
64e1cde3f9144bfb850b7d37c51af559
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment