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 f146707b
authored
Oct 18, 2023
by
huangjinxin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop
2 parents
49e54b1d
1da7e6b3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
85 additions
and
2 deletions
project-order/src/main/java/com/dituhui/pea/order/controller/PeaApiController.java
project-order/src/main/java/com/dituhui/pea/order/dao/OrgGroupDao.java
project-order/src/main/java/com/dituhui/pea/order/service/PeaOuterAPIService.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/PeaOuterAPIServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/controller/PeaApiController.java
View file @
f146707
...
...
@@ -5,6 +5,7 @@ import com.dituhui.pea.order.common.jackson.JsonUtil;
import
com.dituhui.pea.order.dto.OrganizationTreeDTO
;
import
com.dituhui.pea.order.dto.param.*
;
import
com.dituhui.pea.order.service.EngineerCalendarService
;
import
com.dituhui.pea.order.service.PeaOuterAPIService
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.format.annotation.DateTimeFormat
;
...
...
@@ -28,6 +29,7 @@ import java.util.Date;
public
class
PeaApiController
{
private
final
EngineerCalendarService
engineerCalendarService
;
private
final
PeaOuterAPIService
peaOuterAPIService
;
private
static
final
String
capacity
=
"{\"groupId\": \"G100038\", \"params\": {\"beginDate\": \"2023-07-21\", \"endDate\": \"2023-07-27\", \"services\": [{\"brand\": \"博世\", \"productType\": \"多门冰箱\", \"serviceType\": \"商场样机安装\"}], \"location\": {\"addressId\":\"21231231\", \"latitude\": 120.608463, \"longitude\": 31.318442, \"name\": \"江苏省苏州市姑苏区蒋庙前\", \"address\": \"江苏省苏州市姑苏区解放大街123号\"}}, \"takeTime\": 720, \"datas\": [{\"date\": \"2023-07-21\", \"segments\": [{\"maxDuration\": 90, \"name\": \"全天\", \"beginTime\": \"2023-07-21 08:00:00\", \"endTime\": \"2023-07-21 17:59:59\", \"status\": 1, \"remain\": 3500}, {\"maxDuration\": 45, \"name\": \"上午\", \"beginTime\": \"2023-07-21 08:00:00\", \"endTime\": \"2023-07-21 11:59:59\", \"status\": 1, \"remain\": 2500}, {\"maxDuration\": 60, \"name\": \"下午\", \"beginTime\": \"2023-07-21 13:00:00\", \"endTime\": \"2023-07-21 17:59:59\", \"status\": 0, \"remain\": 1000}, {\"maxDuration\": 60, \"name\": \"时间段\", \"beginTime\": \"2023-07-21 13:00:00\", \"endTime\": \"2023-07-21 15:00:00\", \"status\": 1, \"remain\": 480}]}]}"
;
...
...
@@ -128,7 +130,7 @@ public class PeaApiController {
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
@RequestParam
(
"beginDate"
)
Date
beginDate
,
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
Date
endDate
)
throws
IOException
{
CapacityQueryDTO
.
Result
resultTemp
=
JsonUtil
.
parse
(
capacity
,
CapacityQueryDTO
.
Result
.
class
).
get
();
...
...
@@ -151,7 +153,10 @@ public class PeaApiController {
@PostMapping
(
"/estimate/visit"
)
public
Result
<
EstimateDTO
.
VisitResult
>
estimateVisit
(
@Validated
@RequestBody
EstimateDTO
.
VisitRequest
request
)
{
return
Result
.
success
(
new
EstimateDTO
.
VisitResult
());
EstimateDTO
.
VisitResult
visitResult
=
peaOuterAPIService
.
estimateVisitService
(
request
.
getBrand
(),
request
.
getProductType
(),
request
.
getServiceType
(),
request
.
getLocation
());
return
Result
.
success
(
visitResult
);
}
...
...
project-order/src/main/java/com/dituhui/pea/order/dao/OrgGroupDao.java
View file @
f146707
...
...
@@ -31,4 +31,14 @@ public interface OrgGroupDao extends JpaRepository<OrgGroupEntity, Integer> {
@Query
(
value
=
"SELECT * from org_group og left join org_team ot on og.group_id = ot.group_id WHERE ot.team_id in (:teamIds) order by og.category "
,
nativeQuery
=
true
)
List
<
OrgGroupEntity
>
findByTeamIdIn
(
@Param
(
"teamIds"
)
List
<
String
>
teamIds
);
/**
* 根据teamId 获取分站信息
*
* @param teamId 工作队ID
* @return 工作队ID
*/
@Query
(
value
=
"SELECT og.* FROM org_group og left join org_team ot ON ot.group_id = og.group_id "
+
"WHERE ot.team_id = :teamId"
,
nativeQuery
=
true
)
OrgGroupEntity
queryGroupByTeam
(
String
teamId
);
}
project-order/src/main/java/com/dituhui/pea/order/service/PeaOuterAPIService.java
0 → 100644
View file @
f146707
package
com
.
dituhui
.
pea
.
order
.
service
;
import
com.dituhui.pea.order.dto.param.EstimateDTO
;
import
com.dituhui.pea.order.dto.param.Location
;
/**
* PEA 对外服务接口API 定义
*/
public
interface
PeaOuterAPIService
{
/**
* 技术员上门里程预估服务, 根据品牌, 技能,类型以及客户单所在地址获取对应的工作小队信, 根据工作小队获取技能
*
* @param brand 服务代码
* @param productType 品牌代码
* @param serviceType 技能代码
* @param clientLocation 服务单所在位置
* @return 工作队所在小组仓库地址信息以及出战点到客户地点间路程公里数
*/
EstimateDTO
.
VisitResult
estimateVisitService
(
String
brand
,
String
productType
,
String
serviceType
,
Location
clientLocation
);
}
project-order/src/main/java/com/dituhui/pea/order/service/impl/PeaOuterAPIServiceImpl.java
0 → 100644
View file @
f146707
package
com
.
dituhui
.
pea
.
order
.
service
.
impl
;
import
com.dituhui.pea.order.dao.OrgGroupDao
;
import
com.dituhui.pea.order.dto.param.EstimateDTO
;
import
com.dituhui.pea.order.dto.param.Location
;
import
com.dituhui.pea.order.entity.OrgGroupEntity
;
import
com.dituhui.pea.order.service.PeaOuterAPIService
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
/**
* 对外接口实现
*/
@Slf4j
@RequiredArgsConstructor
@Service
public
class
PeaOuterAPIServiceImpl
implements
PeaOuterAPIService
{
/**
* 分部数据访问层
*/
private
final
OrgGroupDao
orgGroupDao
;
@Override
public
EstimateDTO
.
VisitResult
estimateVisitService
(
String
brand
,
String
productType
,
String
serviceType
,
Location
clientLocation
)
{
//TODO 走分单逻辑获取对应的工作队信息
String
teamId
=
"team_suzhou_001"
;
OrgGroupEntity
orgGroupEntity
=
orgGroupDao
.
queryGroupByTeam
(
teamId
);
//获取分站出站点(仓库点)
Location
outboundLocation
=
new
Location
();
outboundLocation
.
setAddress
(
orgGroupEntity
.
getAddress
());
outboundLocation
.
setLongitude
(
Double
.
parseDouble
(
orgGroupEntity
.
getX
()));
outboundLocation
.
setLatitude
(
Double
.
parseDouble
(
orgGroupEntity
.
getY
()));
EstimateDTO
.
VisitResult
visitResult
=
new
EstimateDTO
.
VisitResult
();
visitResult
.
setGroupId
(
orgGroupEntity
.
getGroupId
());
visitResult
.
setGroupName
(
orgGroupEntity
.
getGroupName
());
visitResult
.
setGroupLocation
(
outboundLocation
);
visitResult
.
setDestination
(
clientLocation
);
//TODO 里程估计调用
visitResult
.
setDistance
(
0
);
return
visitResult
;
}
}
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