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 05668c5f
authored
Jun 15, 2023
by
王力
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature_mvp616_wangl' into 'develop'
Feature mvp616 wangl See merge request !97
2 parents
b94e3dc6
397c64c6
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
260 additions
and
2 deletions
project-order/src/main/java/com/alibaba/cloud/integration/order/controller/ScheduleController.java
project-order/src/main/java/com/alibaba/cloud/integration/order/dao/OrgTeamEngineerMPDao.java
project-order/src/main/java/com/alibaba/cloud/integration/order/dao/OrgTeamMPDao.java
project-order/src/main/java/com/alibaba/cloud/integration/order/dto/ScheduleEngineerOverviewResp.java
project-order/src/main/java/com/alibaba/cloud/integration/order/dto/ScheduleOverviewResp.java
project-order/src/main/java/com/alibaba/cloud/integration/order/entity/OrgTeam.java
project-order/src/main/java/com/alibaba/cloud/integration/order/entity/OrgTeamEngineer.java
project-order/src/main/java/com/alibaba/cloud/integration/order/service/impl/ScheduleServiceImpl.java
project-order/src/main/java/com/alibaba/cloud/integration/order/controller/ScheduleController.java
View file @
05668c5
...
@@ -20,7 +20,7 @@ public class ScheduleController {
...
@@ -20,7 +20,7 @@ public class ScheduleController {
@GetMapping
(
"/schedule/overview"
)
@GetMapping
(
"/schedule/overview"
)
public
Result
<?>
getScheduleOverview
(
@RequestParam
long
page
,
@RequestParam
long
size
,
@RequestParam
String
date
,
public
Result
<?>
getScheduleOverview
(
@RequestParam
long
page
,
@RequestParam
long
size
,
@RequestParam
String
date
,
@RequestParam
String
levelType
,
@RequestParam
(
"level
Id
"
)
List
<
String
>
levelIds
)
{
@RequestParam
String
levelType
,
@RequestParam
(
"level
Value
"
)
List
<
String
>
levelIds
)
{
Result
<?>
res
=
null
;
Result
<?>
res
=
null
;
try
{
try
{
res
=
scheduleService
.
getScheduleOverview
(
page
,
size
,
date
,
levelType
,
levelIds
);
res
=
scheduleService
.
getScheduleOverview
(
page
,
size
,
date
,
levelType
,
levelIds
);
...
...
project-order/src/main/java/com/alibaba/cloud/integration/order/dao/OrgTeamEngineerMPDao.java
0 → 100644
View file @
05668c5
package
com
.
alibaba
.
cloud
.
integration
.
order
.
dao
;
import
com.alibaba.cloud.integration.order.entity.OrgTeamEngineer
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
@Mapper
public
interface
OrgTeamEngineerMPDao
extends
BaseMapper
<
OrgTeamEngineer
>
{
}
project-order/src/main/java/com/alibaba/cloud/integration/order/dao/OrgTeamMPDao.java
0 → 100644
View file @
05668c5
package
com
.
alibaba
.
cloud
.
integration
.
order
.
dao
;
import
com.alibaba.cloud.integration.order.entity.OrgTeam
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
@Mapper
public
interface
OrgTeamMPDao
extends
BaseMapper
<
OrgTeam
>
{
}
project-order/src/main/java/com/alibaba/cloud/integration/order/dto/ScheduleEngineerOverviewResp.java
0 → 100644
View file @
05668c5
package
com
.
alibaba
.
cloud
.
integration
.
order
.
dto
;
import
lombok.Data
;
@Data
public
class
ScheduleEngineerOverviewResp
{
}
project-order/src/main/java/com/alibaba/cloud/integration/order/dto/ScheduleOverviewResp.java
0 → 100644
View file @
05668c5
package
com
.
alibaba
.
cloud
.
integration
.
order
.
dto
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
ScheduleOverviewResp
{
private
long
total
;
private
long
pages
;
private
long
pageCurrent
;
private
long
pageSize
;
private
List
<
Team
>
content
;
@Data
public
static
class
Team
{
private
String
name
;
private
String
value
;
private
String
level
;
private
String
orderDesc
;
private
String
distanceDes
;
private
OrderSum
order
;
private
List
<
Item
>
children
;
}
@Data
public
static
class
Item
{
private
String
name
;
private
String
value
;
private
String
level
;
private
String
orderDesc
;
private
String
distanceDes
;
private
OrderSum
order
;
}
@Data
public
static
class
OrderSum
{
private
Integer
total
;
private
Integer
installNum
;
private
Integer
fixNum
;
private
Integer
designNum
;
private
Integer
cleanNum
;
}
}
project-order/src/main/java/com/alibaba/cloud/integration/order/entity/OrgTeam.java
0 → 100644
View file @
05668c5
package
com
.
alibaba
.
cloud
.
integration
.
order
.
entity
;
import
lombok.Data
;
import
java.sql.Time
;
import
java.sql.Timestamp
;
@Data
public
class
OrgTeam
{
private
long
id
;
private
String
teamId
;
private
String
teamName
;
private
String
teamType
;
private
String
clusterId
;
private
String
branchId
;
private
String
groupId
;
private
String
warehouseId
;
private
String
workdays
;
private
String
memo
;
private
Timestamp
createTime
;
private
Timestamp
updateTime
;
}
project-order/src/main/java/com/alibaba/cloud/integration/order/entity/OrgTeamEngineer.java
0 → 100644
View file @
05668c5
package
com
.
alibaba
.
cloud
.
integration
.
order
.
entity
;
import
lombok.Data
;
import
java.sql.Timestamp
;
@Data
public
class
OrgTeamEngineer
{
private
long
id
;
private
String
teamId
;
private
String
engineerCode
;
private
Integer
status
;
private
String
memo
;
private
Timestamp
createTime
;
private
Timestamp
updateTime
;
}
\ No newline at end of file
project-order/src/main/java/com/alibaba/cloud/integration/order/service/impl/ScheduleServiceImpl.java
View file @
05668c5
package
com
.
alibaba
.
cloud
.
integration
.
order
.
service
.
impl
;
package
com
.
alibaba
.
cloud
.
integration
.
order
.
service
.
impl
;
import
com.alibaba.cloud.integration.common.Result
;
import
com.alibaba.cloud.integration.common.Result
;
import
com.alibaba.cloud.integration.order.dao.OrderAppointmentMPDao
;
import
com.alibaba.cloud.integration.order.dao.OrderRequestMPDao
;
import
com.alibaba.cloud.integration.order.dao.OrgTeamEngineerMPDao
;
import
com.alibaba.cloud.integration.order.dao.OrgTeamMPDao
;
import
com.alibaba.cloud.integration.order.dto.ScheduleOverviewResp
;
import
com.alibaba.cloud.integration.order.entity.OrderAppointment
;
import
com.alibaba.cloud.integration.order.entity.OrderRequest
;
import
com.alibaba.cloud.integration.order.entity.OrgTeam
;
import
com.alibaba.cloud.integration.order.entity.OrgTeamEngineer
;
import
com.alibaba.cloud.integration.order.service.ScheduleService
;
import
com.alibaba.cloud.integration.order.service.ScheduleService
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
@Service
@Service
public
class
ScheduleServiceImpl
implements
ScheduleService
{
public
class
ScheduleServiceImpl
implements
ScheduleService
{
@Autowired
private
OrgTeamMPDao
orgTeamMPDao
;
@Autowired
private
OrgTeamEngineerMPDao
orgTeamEngineerMPDao
;
@Autowired
private
OrderRequestMPDao
orderRequestMPDao
;
@Autowired
private
OrderAppointmentMPDao
orderAppointmentMPDao
;
@Override
@Override
public
Result
<?>
getScheduleOverview
(
long
page
,
long
size
,
String
date
,
String
levelType
,
List
<
String
>
levelIds
)
{
public
Result
<?>
getScheduleOverview
(
long
page
,
long
size
,
String
date
,
String
levelType
,
List
<
String
>
levelIds
)
{
return
null
;
// 获取team列表
IPage
<
OrgTeam
>
pg
=
this
.
queryOrgTeams
(
page
,
size
,
levelType
,
levelIds
);
List
<
OrgTeam
>
orgTeams
=
pg
.
getRecords
();
List
<
ScheduleOverviewResp
.
Team
>
items
=
new
ArrayList
<>();
// 获取工单列表
for
(
OrgTeam
t
:
orgTeams
)
{
ScheduleOverviewResp
.
Team
item
=
new
ScheduleOverviewResp
.
Team
();
item
.
setName
(
t
.
getTeamName
());
item
.
setValue
(
t
.
getTeamId
());
item
.
setLevel
(
"team"
);
// 获取改team订单列表
List
<
OrderRequest
>
orders
=
this
.
queryOrderRequests
(
t
.
getTeamId
(),
date
);
item
.
setOrder
(
this
.
getTeamOrderSum
(
orders
));
// 获取team技术员列表
List
<
OrgTeamEngineer
>
teamEngineers
=
this
.
queryOrgTeamEngineers
(
t
.
getTeamId
());
// 获取技术员对应的订单
List
<
String
>
orderRequestIds
=
orders
.
stream
().
map
(
OrderRequest:
:
getOrderId
).
collect
(
Collectors
.
toList
());
List
<
OrderAppointment
>
orderAppointments
=
this
.
queryOrderAppointments
(
orderRequestIds
,
date
);
Map
<
String
,
List
<
OrderAppointment
>>
engineerOrders
=
orderAppointments
.
stream
().
collect
(
Collectors
.
groupingBy
(
OrderAppointment:
:
getEngineerCode
));
List
<
ScheduleOverviewResp
.
Item
>
children
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
String
,
List
<
OrderAppointment
>>
entry
:
engineerOrders
.
entrySet
())
{
ScheduleOverviewResp
.
Item
child
=
new
ScheduleOverviewResp
.
Item
();
String
engineerCode
=
entry
.
getKey
();
List
<
String
>
orderIds
=
entry
.
getValue
().
stream
().
map
(
OrderAppointment:
:
getOrderId
).
collect
(
Collectors
.
toList
());
List
<
OrderRequest
>
orders2
=
new
ArrayList
<>();
for
(
OrderRequest
o
:
orders
)
{
if
(
orderIds
.
contains
(
o
.
getOrderId
()))
{
orders
.
add
(
o
);
}
}
child
.
setName
(
""
);
child
.
setValue
(
engineerCode
);
child
.
setLevel
(
"engineer"
);
child
.
setOrder
(
this
.
getTeamOrderSum
(
orders2
));
child
.
setOrderDesc
(
Integer
.
toString
(
orders2
.
size
()));
child
.
setDistanceDes
(
""
);
children
.
add
(
child
);
}
item
.
setChildren
(
children
);
item
.
setOrderDesc
(
String
.
format
(
"人均:%d"
,
orders
.
size
()
/
teamEngineers
.
size
()));
item
.
setDistanceDes
(
""
);
}
ScheduleOverviewResp
res
=
new
ScheduleOverviewResp
();
res
.
setTotal
(
pg
.
getTotal
());
res
.
setPages
(
pg
.
getPages
());
res
.
setPageSize
(
pg
.
getSize
());
res
.
setPageCurrent
(
pg
.
getCurrent
());
res
.
setContent
(
items
);
return
Result
.
success
(
res
);
}
}
@Override
@Override
public
Result
<?>
getScheduleEngineerOverview
(
String
date
,
String
engineerCode
)
{
public
Result
<?>
getScheduleEngineerOverview
(
String
date
,
String
engineerCode
)
{
return
null
;
return
null
;
}
}
private
IPage
<
OrgTeam
>
queryOrgTeams
(
long
page
,
long
size
,
String
levelType
,
List
<
String
>
levelIds
)
{
IPage
<
OrgTeam
>
pg
=
new
Page
<>(
page
,
size
);
LambdaQueryWrapper
<
OrgTeam
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
in
(
levelType
.
equals
(
"cluster"
),
OrgTeam:
:
getClusterId
,
levelIds
);
lqw
.
in
(
levelType
.
equals
(
"branch"
),
OrgTeam:
:
getBranchId
,
levelIds
);
lqw
.
in
(
levelType
.
equals
(
"group"
),
OrgTeam:
:
getGroupId
,
levelIds
);
lqw
.
orderByAsc
(
OrgTeam:
:
getTeamId
);
// 根据teamId排序
orgTeamMPDao
.
selectPage
(
pg
,
lqw
);
return
pg
;
}
private
List
<
OrgTeamEngineer
>
queryOrgTeamEngineers
(
String
teamId
)
{
LambdaQueryWrapper
<
OrgTeamEngineer
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
eq
(
OrgTeamEngineer:
:
getTeamId
,
teamId
);
lqw
.
eq
(
OrgTeamEngineer:
:
getStatus
,
1
);
return
orgTeamEngineerMPDao
.
selectList
(
lqw
);
}
private
List
<
OrderRequest
>
queryOrderRequests
(
String
teamId
,
String
date
)
{
LambdaQueryWrapper
<
OrderRequest
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
in
(
OrderRequest:
:
getOrgTeamId
,
teamId
);
lqw
.
eq
(
OrderRequest:
:
getAppointmentStatus
,
"ASSIGNED"
);
lqw
.
gt
(
OrderRequest:
:
getExpectTimeBegin
,
this
.
getTimestampFromDate
(
date
,
"00:00:00"
));
lqw
.
lt
(
OrderRequest:
:
getExpectTimeBegin
,
this
.
getTimestampFromDate
(
date
,
"23:59:59"
));
return
orderRequestMPDao
.
selectList
(
lqw
);
}
private
List
<
OrderAppointment
>
queryOrderAppointments
(
List
<
String
>
orderIds
,
String
date
)
{
LambdaQueryWrapper
<
OrderAppointment
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
in
(
OrderAppointment:
:
getOrderId
,
orderIds
);
lqw
.
ge
(
OrderAppointment:
:
getExpectStartTime
,
this
.
getTimestampFromDate
(
date
,
"00:00:00"
));
return
orderAppointmentMPDao
.
selectList
(
lqw
);
}
private
ScheduleOverviewResp
.
OrderSum
getTeamOrderSum
(
List
<
OrderRequest
>
orders
)
{
ScheduleOverviewResp
.
OrderSum
s
=
new
ScheduleOverviewResp
.
OrderSum
();
Map
<
String
,
List
<
OrderRequest
>>
cc
=
orders
.
stream
().
collect
(
Collectors
.
groupingBy
(
OrderRequest:
:
getSkill
));
List
<
OrderRequest
>
emtpy
=
new
ArrayList
<>();
s
.
setTotal
(
orders
.
size
());
s
.
setInstallNum
(
cc
.
getOrDefault
(
"安装"
,
emtpy
).
size
());
s
.
setFixNum
(
cc
.
getOrDefault
(
"维修"
,
emtpy
).
size
());
s
.
setDesignNum
(
cc
.
getOrDefault
(
"设计"
,
emtpy
).
size
());
s
.
setCleanNum
(
cc
.
getOrDefault
(
"清洗"
,
emtpy
).
size
());
return
s
;
}
public
Timestamp
getTimestampFromDate
(
String
date
,
String
t
)
{
return
Timestamp
.
valueOf
(
date
+
" "
+
t
);
}
}
}
\ No newline at end of file
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