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 02558695
authored
Jul 14, 2023
by
chamberone
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
https://zhangguoping@gitlab.dituhui.com/bsh/project/pr…
…oject.git into develop
2 parents
7ad7074c
942ae4d6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
46 additions
and
58 deletions
project-order/src/main/java/com/dituhui/pea/order/controller/EngineerTimelineController.java
project-order/src/main/java/com/dituhui/pea/order/dao/WarehouseInfoMPDao.java
project-order/src/main/java/com/dituhui/pea/order/dto/EnginnerTimelineReq.java → project-order/src/main/java/com/dituhui/pea/order/dto/EngineerTimelineReq.java
project-order/src/main/java/com/dituhui/pea/order/dto/EnginnerTimelineResp.java → project-order/src/main/java/com/dituhui/pea/order/dto/EngineerTimelineResp.java
project-order/src/main/java/com/dituhui/pea/order/entity/WarehouseInfo.java → project-order/src/main/java/com/dituhui/pea/order/entity/OrgWarehouseInfo.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerTimelineServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/controller/EngineerTimelineController.java
View file @
0255869
...
...
@@ -16,7 +16,7 @@ public class EngineerTimelineController {
@Autowired
private
EngineerTimelineService
engineerTimelineService
;
@GetMapping
(
"/engineer/work/
trace
"
)
@GetMapping
(
"/engineer/work/
dynamics
"
)
public
Result
<?>
GetEngineerTimeline
(
@RequestParam
String
engineerCode
,
String
date
)
{
return
engineerTimelineService
.
getEngineerTimelines
(
engineerCode
,
date
);
}
...
...
project-order/src/main/java/com/dituhui/pea/order/dao/WarehouseInfoMPDao.java
View file @
0255869
package
com
.
dituhui
.
pea
.
order
.
dao
;
import
com.dituhui.pea.order.entity.WarehouseInfo
;
import
com.dituhui.pea.order.entity.
Org
WarehouseInfo
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
@Mapper
public
interface
WarehouseInfoMPDao
extends
BaseMapper
<
WarehouseInfo
>
{
public
interface
WarehouseInfoMPDao
extends
BaseMapper
<
Org
WarehouseInfo
>
{
}
project-order/src/main/java/com/dituhui/pea/order/dto/Engin
n
erTimelineReq.java
→
project-order/src/main/java/com/dituhui/pea/order/dto/Engin
e
erTimelineReq.java
View file @
0255869
...
...
@@ -3,7 +3,7 @@ package com.dituhui.pea.order.dto;
import
lombok.Data
;
@Data
public
class
Engin
n
erTimelineReq
{
private
String
engin
n
erCode
;
public
class
Engin
e
erTimelineReq
{
private
String
engin
e
erCode
;
private
String
date
;
}
project-order/src/main/java/com/dituhui/pea/order/dto/Engin
n
erTimelineResp.java
→
project-order/src/main/java/com/dituhui/pea/order/dto/Engin
e
erTimelineResp.java
View file @
0255869
...
...
@@ -5,7 +5,7 @@ import lombok.Data;
import
java.util.List
;
@Data
public
class
Engin
n
erTimelineResp
{
public
class
Engin
e
erTimelineResp
{
private
String
engineerCode
;
private
String
engineerName
;
...
...
project-order/src/main/java/com/dituhui/pea/order/entity/WarehouseInfo.java
→
project-order/src/main/java/com/dituhui/pea/order/entity/
Org
WarehouseInfo.java
View file @
0255869
...
...
@@ -3,9 +3,10 @@ package com.dituhui.pea.order.entity;
import
lombok.Data
;
@Data
public
class
WarehouseInfo
{
private
Integer
warehouseId
;
private
String
warehouseNname
;
public
class
OrgWarehouseInfo
{
private
long
id
;
private
String
warehouseId
;
private
String
warehouseName
;
private
String
branchId
;
private
String
cityCode
;
private
String
address
;
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerTimelineServiceImpl.java
View file @
0255869
...
...
@@ -3,7 +3,7 @@ package com.dituhui.pea.order.service.impl;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.order.common.TimeUtils
;
import
com.dituhui.pea.order.dao.*
;
import
com.dituhui.pea.order.dto.Engin
n
erTimelineResp
;
import
com.dituhui.pea.order.dto.Engin
e
erTimelineResp
;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.service.EngineerTimelineService
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
...
...
@@ -11,8 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.sql.Timestamp
;
import
java.time.format.DateTimeFormatter
;
import
java.time.LocalDate
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
...
...
@@ -39,67 +38,54 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService {
@Autowired
private
OrgGroupMPDao
orgGroupMPDao
;
@Autowired
private
OrderEventMPDao
orderEventMPDao
;
@Transactional
@Override
public
Result
<?>
getEngineerTimelines
(
String
engineerCode
,
String
date
){
// 工程师姓名
String
name
=
this
.
getEngineerName
(
engineerCode
);
LocalDate
localDate
=
TimeUtils
.
IsoDate2LocalDate
(
date
);
// 工程師信息
EngineerInfo
engineerInfo
=
engineerInfoMPDao
.
getByEngineerCode
(
engineerCode
);
// 获取工程师已完成的timeline数据
List
<
EngineerTimeline
>
timelines
=
this
.
engineerTimelines
(
engineerCode
,
date
);
// 获取工程师date日的订单数据
List
<
OrderAppointment
>
orders
=
this
.
orderAppointments
(
engineerCode
,
date
);
List
<
OrderAppointment
>
orders
=
orderAppointmentMPDao
.
selectByEngineerCodeAndDt
(
engineerCode
,
localDate
);
// 获取工程师已完成的timeline数据
List
<
String
>
orderIds
=
orders
.
stream
().
map
(
OrderAppointment:
:
getOrderId
).
collect
(
Collectors
.
toList
());
List
<
OrderEvent
>
timelines
=
this
.
engineerTimelines
(
orderIds
,
date
);
// 获取客户地址
List
<
String
>
orderIds
=
new
ArrayList
<>();
for
(
OrderAppointment
o:
orders
)
{
orderIds
.
add
(
o
.
getOrderId
());
}
HashMap
<
String
,
String
>
orderLocations
=
this
.
orderRequestsLocation
(
orderIds
);
// 获取配送站地址
String
branchId
=
this
.
getEngineerBranchId
(
engineerCode
);
String
warehouseLocation
=
this
.
getWarehouseLocation
(
branchId
);
List
<
Engin
n
erTimelineResp
.
DynamicItem
>
dynamics
=
this
.
packItems
(
timelines
,
orders
,
orderLocations
,
warehouseLocation
);
List
<
Engin
e
erTimelineResp
.
DynamicItem
>
dynamics
=
this
.
packItems
(
timelines
,
orders
,
orderLocations
,
warehouseLocation
);
Engin
nerTimelineResp
res
=
new
Enginn
erTimelineResp
();
Engin
eerTimelineResp
res
=
new
Engine
erTimelineResp
();
res
.
setEngineerCode
(
engineerCode
);
res
.
setEngineerName
(
name
);
res
.
setEngineerName
(
engineerInfo
.
getName
()
);
res
.
setDynamics
(
dynamics
);
return
Result
.
success
(
res
);
}
private
String
getEngineerName
(
String
engineerCode
){
LambdaQueryWrapper
<
EngineerInfo
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
eq
(
EngineerInfo:
:
getEngineerCode
,
engineerCode
);
EngineerInfo
e
=
engineerInfoMPDao
.
selectOne
(
lqw
);
return
e
.
getName
();
}
private
List
<
OrderAppointment
>
orderAppointments
(
String
engineerCode
,
String
date
){
// 获取指派单列表
LambdaQueryWrapper
<
OrderAppointment
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
eq
(
OrderAppointment:
:
getEngineerCode
,
engineerCode
);
lqw
.
ge
(
OrderAppointment:
:
getExpectStartTime
,
date
+
" 00:00:00"
);
lqw
.
le
(
OrderAppointment:
:
getExpectStartTime
,
date
+
" 23:59:59"
);
return
orderAppointmentMPDao
.
selectList
(
lqw
);
}
private
List
<
EngineerTimeline
>
engineerTimelines
(
String
engineerCode
,
String
date
){
private
List
<
OrderEvent
>
engineerTimelines
(
List
<
String
>
orderIds
,
String
date
){
// 获取工程师timeline
List
<
String
>
events
=
Stream
.
of
(
"分站取还配件"
,
"已出发"
,
"加单"
).
collect
(
Collectors
.
toList
());
LambdaQueryWrapper
<
EngineerTimeline
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
eq
(
EngineerTimeline:
:
getEngineerCode
,
engineerCode
);
lqw
.
ge
(
EngineerTimeline
:
:
getHappen
,
date
+
" 00:00:00"
);
lqw
.
le
(
EngineerTimeline
:
:
getHappen
,
date
+
" 23:59:59"
);
lqw
.
in
(
EngineerTimeline
:
:
getEvent
,
events
);
return
engineerTimeline
MPDao
.
selectList
(
lqw
);
LambdaQueryWrapper
<
OrderEvent
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
in
(
OrderEvent:
:
getOrderId
,
orderIds
);
lqw
.
ge
(
OrderEvent
:
:
getHappen
,
date
+
" 00:00:00"
);
lqw
.
le
(
OrderEvent
:
:
getHappen
,
date
+
" 23:59:59"
);
lqw
.
in
(
OrderEvent
:
:
getEvent
,
events
);
return
orderEvent
MPDao
.
selectList
(
lqw
);
}
private
HashMap
<
String
,
String
>
orderRequestsLocation
(
List
<
String
>
orderIds
)
{
// 获取客户地址location
HashMap
<
String
,
String
>
map
=
new
HashMap
<>();
LambdaQueryWrapper
<
OrderRequest
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
in
(
OrderRequest:
:
getOrderId
,
orderIds
);
...
...
@@ -112,9 +98,10 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService {
private
String
getWarehouseLocation
(
String
branchId
)
{
// 获取配送站location
LambdaQueryWrapper
<
WarehouseInfo
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
eq
(
WarehouseInfo:
:
getBranchId
,
branchId
);
WarehouseInfo
w
=
warehouseInfoMPDao
.
selectOne
(
lqw
);
LambdaQueryWrapper
<
OrgWarehouseInfo
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
eq
(
OrgWarehouseInfo:
:
getBranchId
,
branchId
);
List
<
OrgWarehouseInfo
>
wares
=
warehouseInfoMPDao
.
selectList
(
lqw
);
OrgWarehouseInfo
w
=
wares
.
get
(
0
);
return
String
.
format
(
"%s,%s"
,
w
.
getX
(),
w
.
getY
());
}
...
...
@@ -135,15 +122,15 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService {
}
private
List
<
Engin
nerTimelineResp
.
DynamicItem
>
packItems
(
List
<
EngineerTimeline
>
timelines
,
List
<
OrderAppointment
>
orders
,
HashMap
<
String
,
String
>
locations
,
String
warehouseLocation
)
{
private
List
<
Engin
eerTimelineResp
.
DynamicItem
>
packItems
(
List
<
OrderEvent
>
timelines
,
List
<
OrderAppointment
>
orders
,
HashMap
<
String
,
String
>
locations
,
String
warehouseLocation
)
{
int
index
=
1
;
int
index
=
0
;
String
order_id
,
title
,
type
,
text
,
location
;
List
<
Engin
n
erTimelineResp
.
DynamicItem
>
items
=
new
ArrayList
<>();
List
<
Engin
e
erTimelineResp
.
DynamicItem
>
items
=
new
ArrayList
<>();
Set
<
String
>
s
=
new
HashSet
<>();
for
(
EngineerTimeline
t:
timelines
){
Engin
nerTimelineResp
.
DynamicItem
item
=
new
Enginn
erTimelineResp
.
DynamicItem
();
for
(
OrderEvent
t:
timelines
){
Engin
eerTimelineResp
.
DynamicItem
item
=
new
Engine
erTimelineResp
.
DynamicItem
();
if
(
t
.
getEvent
().
equals
(
"分站取还配件"
))
{
title
=
t
.
getEvent
();
...
...
@@ -180,7 +167,7 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService {
continue
;
}
index
+=
1
;
Engin
nerTimelineResp
.
DynamicItem
item
=
new
Enginn
erTimelineResp
.
DynamicItem
();
Engin
eerTimelineResp
.
DynamicItem
item
=
new
Engine
erTimelineResp
.
DynamicItem
();
item
.
setTitle
(
String
.
format
(
"第%d单出发"
,
index
));
item
.
setTime
(
TimeUtils
.
IsoTimestamp2DateTime
(
o
.
getExpectStartTime
()));
item
.
setStatus
(
0
);
...
...
@@ -190,6 +177,6 @@ public class EngineerTimelineServiceImpl implements EngineerTimelineService {
items
.
add
(
item
);
}
// 根据items的time升序排序
return
items
.
stream
().
sorted
(
Comparator
.
comparing
(
Engin
n
erTimelineResp
.
DynamicItem
::
getTime
)).
collect
(
Collectors
.
toList
());
return
items
.
stream
().
sorted
(
Comparator
.
comparing
(
Engin
e
erTimelineResp
.
DynamicItem
::
getTime
)).
collect
(
Collectors
.
toList
());
}
}
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