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 63344de1
authored
Oct 17, 2023
by
huangjinxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:1:图层派单优先级相关添加
2:分单基础类
1 parent
927d130d
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
525 additions
and
1 deletions
project-interface/src/main/java/com/dituhui/pea/common/SaasWebResult.java
project-interface/src/main/java/com/dituhui/pea/pojo/fendan/APIAddressMatchResult.java
project-interface/src/main/java/com/dituhui/pea/pojo/fendan/FenDanEsResult.java
project-interface/src/main/java/com/dituhui/pea/pojo/fendan/FendanDTO.java
project-order/src/main/java/com/dituhui/pea/order/common/CapacityUtils.java
project-order/src/main/java/com/dituhui/pea/order/common/SaasUtils.java
project-order/src/main/java/com/dituhui/pea/order/controller/BusinessLayerController.java
project-order/src/main/java/com/dituhui/pea/order/dao/SkillInfoDao.java
project-order/src/main/java/com/dituhui/pea/order/dto/BusinessCustomLayerRespDTO.java
project-order/src/main/java/com/dituhui/pea/order/dto/BusinessCustomLayerUpdateReqDTO.java
project-order/src/main/java/com/dituhui/pea/order/entity/MapLayerCustomizeEntity.java
project-order/src/main/java/com/dituhui/pea/order/feign/ISaaSRemoteService.java
project-order/src/main/java/com/dituhui/pea/order/service/BusinessLayerService.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/BusinessLayerServiceImpl.java
project-interface/src/main/java/com/dituhui/pea/common/SaasWebResult.java
0 → 100644
View file @
63344de
package
com
.
dituhui
.
pea
.
common
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
java.io.Serializable
;
/**
* WEB接口响应封装对象
*/
public
class
SaasWebResult
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
String
code
;
//响应状态码
private
Object
result
;
//响应内容
private
Object
info
;
//其他信息
private
String
message
;
// 返回消息
/**
* 统计数据不做返回
*/
@JsonIgnore
private
Object
logBeans
;
public
Object
getInfo
()
{
return
info
;
}
public
void
setInfo
(
Object
info
)
{
this
.
info
=
info
;
}
/**
* 构造函数
*
* @param code 状态码
* @param result 响应内容
*/
public
SaasWebResult
(
String
code
,
Object
result
)
{
this
.
code
=
code
;
this
.
result
=
result
;
}
public
SaasWebResult
(
String
code
,
Object
result
,
String
message
)
{
this
.
code
=
code
;
this
.
result
=
result
;
this
.
message
=
message
;
}
/**
* 存在统计数据
*
* @param code
* @param result
* @param logBeans 统计数据
*/
public
SaasWebResult
(
String
code
,
Object
result
,
Object
logBeans
)
{
this
.
code
=
code
;
this
.
result
=
result
;
this
.
logBeans
=
logBeans
;
}
/**
* @return 状态码
*/
public
String
getCode
()
{
return
code
;
}
/**
* 状态码
*
* @param code
*/
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
/**
* @return 结果
*/
public
Object
getResult
()
{
return
result
;
}
/**
* 结果
*
* @param result
*/
public
void
setResult
(
Object
result
)
{
this
.
result
=
result
;
}
/**
* 统计数据
* @return
*/
public
Object
getLogBeans
()
{
return
logBeans
;
}
/**
* @param logBeans required "? extends LogBean" or "List<? extends LogBean>"
*/
public
void
setLogBeans
(
Object
logBeans
)
{
this
.
logBeans
=
logBeans
;
}
@Override
public
String
toString
()
{
return
"WebResult{"
+
"code='"
+
code
+
'\''
+
", result="
+
result
+
", info="
+
info
+
", message='"
+
message
+
'\''
+
", logBeans="
+
logBeans
+
'}'
;
}
}
project-interface/src/main/java/com/dituhui/pea/pojo/fendan/APIAddressMatchResult.java
0 → 100644
View file @
63344de
package
com
.
dituhui
.
pea
.
pojo
.
fendan
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
java.io.Serializable
;
/**
* 地址解析返回结果
*/
public
class
APIAddressMatchResult
implements
Serializable
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
/**
* ID
*/
private
String
id
;
/**
* x坐标
*/
private
double
x
;
/**
* y坐标
*/
private
double
y
;
/**
* 结果类型:1代表成功,2代表地址解析失败,3代表点查面失败
*/
private
int
resultType
;
/**
* 结果内容
*/
@JsonIgnore
private
String
resultInfo
;
/**
* 省
*/
private
String
province
;
/**
* 市
*/
private
String
city
;
/**
* 区
*/
private
String
county
;
/**
* ADMINCODE
*/
private
String
admincode
;
/**
* town
*/
private
String
town
;
/**
* 区号
*/
private
String
aCode
;
/**
* 评分
*/
@JsonIgnore
private
double
score
=
0
;
/**
* 逆地址解析的地址
*/
private
String
address
;
private
String
village
;
public
String
getAddress
()
{
return
address
;
}
public
void
setAddress
(
String
address
)
{
this
.
address
=
address
;
}
public
int
getResultType
()
{
return
resultType
;
}
public
void
setResultType
(
int
resultType
)
{
this
.
resultType
=
resultType
;
}
public
String
getResultInfo
()
{
return
resultInfo
;
}
public
void
setResultInfo
(
String
resultInfo
)
{
this
.
resultInfo
=
resultInfo
;
}
public
String
getProvince
()
{
return
province
;
}
public
void
setProvince
(
String
province
)
{
this
.
province
=
province
;
}
public
String
getCity
()
{
return
city
;
}
public
void
setCity
(
String
city
)
{
this
.
city
=
city
;
}
public
String
getCounty
()
{
return
county
;
}
public
void
setCounty
(
String
county
)
{
this
.
county
=
county
;
}
public
String
getTown
()
{
return
town
;
}
public
void
setTown
(
String
town
)
{
this
.
town
=
town
;
}
public
String
getaCode
()
{
return
aCode
;
}
public
void
setaCode
(
String
aCode
)
{
this
.
aCode
=
aCode
;
}
public
String
getAdmincode
()
{
return
admincode
;
}
public
void
setAdmincode
(
String
admincode
)
{
this
.
admincode
=
admincode
;
}
public
double
getScore
()
{
return
score
;
}
public
void
setScore
(
double
score
)
{
this
.
score
=
score
;
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
double
getX
()
{
return
x
;
}
public
void
setX
(
double
x
)
{
this
.
x
=
x
;
}
public
double
getY
()
{
return
y
;
}
public
void
setY
(
double
y
)
{
this
.
y
=
y
;
}
public
String
getVillage
()
{
return
village
;
}
public
void
setVillage
(
String
village
)
{
this
.
village
=
village
;
}
public
APIAddressMatchResult
(
String
id
)
{
this
.
id
=
id
;
}
@Override
public
String
toString
()
{
return
"APIAddressMatchResult{"
+
"id='"
+
id
+
'\''
+
", x="
+
x
+
", y="
+
y
+
", resultType="
+
resultType
+
", resultInfo='"
+
resultInfo
+
'\''
+
", province='"
+
province
+
'\''
+
", city='"
+
city
+
'\''
+
", county='"
+
county
+
'\''
+
", village='"
+
village
+
'\''
+
", admincode='"
+
admincode
+
'\''
+
", score="
+
score
+
'}'
;
}
public
APIAddressMatchResult
()
{
}
}
project-interface/src/main/java/com/dituhui/pea/pojo/fendan/FenDanEsResult.java
0 → 100644
View file @
63344de
package
com
.
dituhui
.
pea
.
pojo
.
fendan
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
import
java.util.Map
;
/**
* FenDanResult 加上es扩展字段
*
* @author guoping
*/
@Data
public
class
FenDanEsResult
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 地址解析
*/
private
APIAddressMatchResult
addressResult
;
/**
* 分单面列表
*/
private
List
<
Map
<
String
,
Object
>>
areaResults
;
@JsonIgnore
public
String
statusCode
=
"S001"
;
// 状态码,默认成功
}
project-interface/src/main/java/com/dituhui/pea/pojo/fendan/FendanDTO.java
0 → 100644
View file @
63344de
package
com
.
dituhui
.
pea
.
pojo
.
fendan
;
import
lombok.Data
;
@Data
public
class
FendanDTO
{
/**
* 经纬度
*/
private
String
xy
;
/**
* 区划样式
*/
private
Boolean
isShowStyle
=
false
;
/**
* 需要行政区划
*/
private
Boolean
needDistrict
=
false
;
}
project-order/src/main/java/com/dituhui/pea/order/common/CapacityUtils.java
View file @
63344de
...
...
@@ -5,6 +5,7 @@ import com.dituhui.pea.order.dao.SkillInfoDao;
import
com.dituhui.pea.order.entity.MapBlockInfoEntity
;
import
com.dituhui.pea.order.entity.SkillInfoEntity
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
...
...
@@ -37,4 +38,24 @@ public class CapacityUtils {
return
layers
;
}
/**
* 根据服务品牌,产品类型,服务类型匹配查询匹配图层
*
* @param brand
* @param type
* @param skillCode
* @return
*/
public
List
<
String
>
getLayersBySkillCode
(
String
brand
,
String
type
,
String
skillCode
)
{
List
<
String
>
layers
=
new
ArrayList
<>();
List
<
SkillInfoEntity
>
entitys
=
skillInfoDao
.
getByBrandAndTypeAndsAndSkillCode
(
brand
,
type
,
skillCode
);
if
(
CollectionUtils
.
isNotEmpty
(
entitys
))
{
for
(
SkillInfoEntity
entity
:
entitys
)
{
layers
.
add
(
entity
.
getLayerId
());
}
}
return
layers
;
}
}
project-order/src/main/java/com/dituhui/pea/order/common/SaasUtils.java
View file @
63344de
package
com
.
dituhui
.
pea
.
order
.
common
;
import
com.alibaba.fastjson.JSONObject
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.common.SaasWebResult
;
import
com.dituhui.pea.order.dto.SaasFendanDTO
;
import
com.dituhui.pea.order.dto.SaasXyFendanDTO
;
import
com.dituhui.pea.order.feign.ISaaSRemoteService
;
import
com.dituhui.pea.pojo.fendan.FenDanEsResult
;
import
com.dituhui.pea.pojo.fendan.FendanDTO
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
lombok.experimental.Accessors
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
@Component
@Slf4j
...
...
@@ -69,6 +76,33 @@ public class SaasUtils {
return
blocks
;
}
/**
* 根据提供的地址信息,获取对应的片区图层
*/
public
List
<
BlockInfo
>
queryBlocksByXy
(
FendanDTO
fendanDTO
)
{
long
t
=
System
.
currentTimeMillis
();
log
.
info
(
"===> queryBlocksByXySingleT({})"
,
t
);
SaasWebResult
webResult
=
saasRemoteService
.
single
(
ak
,
String
.
valueOf
(
t
),
fendanDTO
);
log
.
info
(
"queryBlocksByXySingle返回结果: ===> {}"
,
webResult
.
getResult
());
List
<
BlockInfo
>
blocks
=
new
ArrayList
<>();
if
(!
webResult
.
getCode
().
equals
(
"S001"
))
{
return
blocks
;
}
//调用saas分单接口
FenDanEsResult
fenDanEsResult
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
webResult
.
getResult
()),
FenDanEsResult
.
class
);
if
(
ObjectUtils
.
isEmpty
(
fenDanEsResult
))
{
return
blocks
;
}
for
(
Map
<
String
,
Object
>
areaMap
:
fenDanEsResult
.
getAreaResults
())
{
if
(
areaMap
.
containsKey
(
"id"
)
&&
areaMap
.
containsKey
(
"areaName"
))
{
blocks
.
add
(
new
BlockInfo
()
.
setBlockId
(
areaMap
.
get
(
"id"
).
toString
())
.
setBlockName
(
areaMap
.
get
(
"areaName"
).
toString
()));
}
}
return
blocks
;
}
public
List
<
BlockInfo
>
queryBlocksByAddress
(
String
address
)
{
// 根据坐标 查询分单接口,获得区块、图层列表 ===> 查询map_block_info表,根据优先级,确定 工作队;
...
...
project-order/src/main/java/com/dituhui/pea/order/controller/BusinessLayerController.java
View file @
63344de
...
...
@@ -106,7 +106,7 @@ public class BusinessLayerController {
// 自定义图层修改
Result
<?>
res
=
null
;
try
{
res
=
businessLayerService
.
businessCustomLayerUpdate
(
reqDTO
.
getLayerId
(),
reqDTO
.
getLayerDesc
(),
reqDTO
.
getSkills
()
);
res
=
businessLayerService
.
businessCustomLayerUpdate
(
reqDTO
);
}
catch
(
BusinessException
e
)
{
return
Result
.
failed
(
e
.
getMessage
());
}
...
...
project-order/src/main/java/com/dituhui/pea/order/dao/SkillInfoDao.java
View file @
63344de
...
...
@@ -9,6 +9,10 @@ import java.util.List;
public
interface
SkillInfoDao
extends
JpaRepository
<
SkillInfoEntity
,
Long
>
{
List
<
SkillInfoEntity
>
findAll
();
Page
<
SkillInfoEntity
>
findAll
(
Pageable
pageable
);
SkillInfoEntity
getByBrandAndTypeAndSkill
(
String
brand
,
String
type
,
String
skill
);
List
<
SkillInfoEntity
>
getByBrandAndTypeAndsAndSkillCode
(
String
brand
,
String
type
,
String
skillCode
);
}
project-order/src/main/java/com/dituhui/pea/order/dto/BusinessCustomLayerRespDTO.java
View file @
63344de
...
...
@@ -12,4 +12,10 @@ public class BusinessCustomLayerRespDTO {
private
String
branchId
;
private
String
branchName
;
private
List
<
String
>
skills
;
/**
* 派单优先级(1-10,数值越小表示优先级越高,默认10)
*/
private
Integer
priority
;
}
project-order/src/main/java/com/dituhui/pea/order/dto/BusinessCustomLayerUpdateReqDTO.java
View file @
63344de
...
...
@@ -9,4 +9,10 @@ public class BusinessCustomLayerUpdateReqDTO {
private
String
layerId
;
private
String
layerDesc
;
private
List
<
String
>
skills
;
/**
* 派单优先级(1-10,数值越小表示优先级越高,默认10)
*/
private
Integer
priority
;
}
project-order/src/main/java/com/dituhui/pea/order/entity/MapLayerCustomizeEntity.java
View file @
63344de
...
...
@@ -45,4 +45,9 @@ public class MapLayerCustomizeEntity {
// Getters and Setters
// ...
/**
* 派单优先级(1-10,数值越小表示优先级越高,默认10)
*/
@Column
(
name
=
"priority"
,
nullable
=
false
)
private
Integer
priority
=
10
;
}
project-order/src/main/java/com/dituhui/pea/order/feign/ISaaSRemoteService.java
View file @
63344de
package
com
.
dituhui
.
pea
.
order
.
feign
;
import
com.dituhui.pea.common.SaasWebResult
;
import
com.dituhui.pea.pojo.fendan.FenDanEsResult
;
import
com.dituhui.pea.pojo.fendan.FendanDTO
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestParam
;
@FeignClient
(
url
=
"${SaaS.url}"
,
name
=
"saasService"
)
...
...
@@ -30,4 +34,8 @@ public interface ISaaSRemoteService {
@GetMapping
(
"/v2/fendan"
)
public
String
blockByAddress
(
@RequestParam
String
ak
,
@RequestParam
String
addresses
,
@RequestParam
Boolean
need_district
,
@RequestParam
Boolean
need_layer
,
@RequestParam
String
area_fields
);
@PostMapping
(
"/saas/fendan/distribute/single"
)
public
SaasWebResult
single
(
@RequestParam
String
ak
,
@RequestParam
String
t
,
@RequestBody
FendanDTO
fendanDTO
);
}
project-order/src/main/java/com/dituhui/pea/order/service/BusinessLayerService.java
View file @
63344de
...
...
@@ -2,6 +2,7 @@ package com.dituhui.pea.order.service;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.order.dto.BusinessCustomLayerUpdateReqDTO
;
import
java.util.List
;
...
...
@@ -16,5 +17,7 @@ public interface BusinessLayerService {
Result
<?>
businessCustomLayerUpdate
(
String
layerId
,
String
layerDesc
,
List
<
String
>
skillCodes
);
Result
<?>
businessCustomLayerUpdate
(
BusinessCustomLayerUpdateReqDTO
reqDTO
);
Result
<?>
businessCustomLayerRemove
(
String
layerId
);
}
project-order/src/main/java/com/dituhui/pea/order/service/impl/BusinessLayerServiceImpl.java
View file @
63344de
...
...
@@ -7,6 +7,7 @@ import com.dituhui.pea.common.ResultEnum;
import
com.dituhui.pea.order.common.ListUtils
;
import
com.dituhui.pea.order.dao.*
;
import
com.dituhui.pea.order.dto.BusinessCustomLayerRespDTO
;
import
com.dituhui.pea.order.dto.BusinessCustomLayerUpdateReqDTO
;
import
com.dituhui.pea.order.dto.BusinessCustomLayersRespDTO
;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.feign.ISaaSRemoteService
;
...
...
@@ -14,6 +15,7 @@ import com.dituhui.pea.order.service.BusinessLayerService;
import
com.dituhui.pea.order.utils.TypeUtils
;
import
com.google.gson.internal.LinkedTreeMap
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.domain.Page
;
...
...
@@ -153,6 +155,7 @@ public class BusinessLayerServiceImpl implements BusinessLayerService {
resp
.
setBranchId
(
layer
.
getBranchId
());
resp
.
setBranchName
(
branchName
);
resp
.
setSkills
(
skillCodes
);
resp
.
setPriority
(
layer
.
getPriority
());
return
Result
.
success
(
resp
);
}
...
...
@@ -211,6 +214,29 @@ public class BusinessLayerServiceImpl implements BusinessLayerService {
return
Result
.
success
(
null
);
}
@Transactional
@Override
public
Result
<?>
businessCustomLayerUpdate
(
BusinessCustomLayerUpdateReqDTO
reqDTO
)
throws
BusinessException
{
MapLayerCustomizeEntity
layer
=
mapLayerCustomizeDao
.
getByLayerId
(
reqDTO
.
getLayerId
());
if
(
layer
==
null
)
{
throw
new
BusinessException
(
"图层不存在"
);
}
// 更新描述信息
layer
.
setLayerDescribe
(
reqDTO
.
getLayerDesc
());
if
(
ObjectUtils
.
isNotEmpty
(
reqDTO
))
{
layer
.
setPriority
(
reqDTO
.
getPriority
());
}
layer
.
setLayerDescribe
(
reqDTO
.
getLayerDesc
());
entityManager
.
merge
(
layer
);
// 更新技能
this
.
updateLayerSkills
(
reqDTO
.
getLayerId
(),
new
HashSet
<>(
reqDTO
.
getSkills
()));
return
Result
.
success
(
null
);
}
@Override
public
Result
<?>
businessCustomLayerRemove
(
String
layerId
)
throws
BusinessException
{
...
...
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