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 2537d27c
authored
Jul 07, 2023
by
丁伟峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
配件仓隶属于分部、分站
1 parent
b6579940
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
12 deletions
project-order/src/main/java/com/dituhui/pea/order/dao/OrgTeamDao.java
project-order/src/main/java/com/dituhui/pea/order/dao/WarehouseInfoDao.java
project-order/src/main/java/com/dituhui/pea/order/entity/OrgWarehouseInfoEntity.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/BusinessTeamServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/dao/OrgTeamDao.java
View file @
2537d27
...
...
@@ -18,5 +18,7 @@ public interface OrgTeamDao extends JpaRepository<OrgTeamEntity, Integer> {
Page
<
OrgTeamEntity
>
findAllByGroupId
(
String
groupId
,
Pageable
pageable
);
Page
<
OrgTeamEntity
>
findAllByBranchId
(
String
branchId
,
Pageable
pageable
);
OrgTeamEntity
getByTeamId
(
String
teamId
);
}
project-order/src/main/java/com/dituhui/pea/order/dao/WarehouseInfoDao.java
View file @
2537d27
...
...
@@ -2,10 +2,17 @@ package com.dituhui.pea.order.dao;
import
com.dituhui.pea.order.entity.OrgWarehouseInfoEntity
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.Query
;
import
java.util.List
;
public
interface
WarehouseInfoDao
extends
JpaRepository
<
OrgWarehouseInfoEntity
,
Long
>
{
List
<
OrgWarehouseInfoEntity
>
getAllByGroupId
(
String
groupId
);
// 返回工作队所在的分部所有的配件仓
@Query
(
"select a from OrgWarehouseInfoEntity a join OrgTeamEntity o on a.branchId=o.branchId where o.teamId= :teamId"
)
List
<
OrgWarehouseInfoEntity
>
getAllByTeamId
(
String
teamId
);
// 返回工作队关联的配件仓
@Query
(
"select a from OrgWarehouseInfoEntity a join OrgTeamEntity o on a.warehouseId=o.warehouseId where o.teamId= :teamId"
)
OrgWarehouseInfoEntity
getByTeamAssigned
(
String
teamId
);
}
project-order/src/main/java/com/dituhui/pea/order/entity/OrgWarehouseInfoEntity.java
View file @
2537d27
...
...
@@ -28,6 +28,11 @@ public class OrgWarehouseInfoEntity {
private
String
warehouseName
;
/**
* 归属分部
*/
private
String
branchId
;
/**
* 归属分站
*/
private
String
groupId
;
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/BusinessTeamServiceImpl.java
View file @
2537d27
...
...
@@ -4,7 +4,6 @@ import cn.hutool.core.date.Week;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.order.dao.*
;
import
com.dituhui.pea.order.dto.*
;
import
com.dituhui.pea.order.entity.OrgTeamEngineerEntity
;
import
com.dituhui.pea.order.entity.OrgTeamEntity
;
import
com.dituhui.pea.order.entity.OrgWarehouseInfoEntity
;
import
com.dituhui.pea.order.service.BusinessTeamService
;
...
...
@@ -41,36 +40,49 @@ public class BusinessTeamServiceImpl implements BusinessTeamService {
@Override
public
Result
<?>
getTeams
(
BusinessTeamsDTO
.
Request
req
)
{
assert
"branch"
.
equals
(
req
.
getLevelType
())
||
"group"
.
equals
(
req
.
getLevelType
());
List
<
BusinessTeamsDTO
.
Content
>
contents
=
new
ArrayList
<>();
Pageable
pageable
=
PageRequest
.
of
(
req
.
getPage
()
-
1
,
req
.
getSize
());
Page
<
OrgTeamEntity
>
page
=
orgTeamDao
.
findAllByGroupId
(
req
.
getLevelValue
(),
pageable
);
List
<
String
>
teamIds
=
page
.
getContent
().
stream
().
map
(
OrgTeamEntity:
:
getTeamId
).
collect
(
Collectors
.
toList
());
for
(
OrgTeamEntity
e:
page
.
getContent
()){
String
engineers
=
orgTeamEngineerDao
.
findAllByTeamId
(
e
.
getTeamId
()).
stream
().
map
(
e2
->{
Page
<
OrgTeamEntity
>
page
=
null
;
if
(
"branch"
.
equals
(
req
.
getLevelType
())){
page
=
orgTeamDao
.
findAllByBranchId
(
req
.
getLevelValue
(),
pageable
);
}
else
{
page
=
orgTeamDao
.
findAllByGroupId
(
req
.
getLevelValue
(),
pageable
);
}
for
(
OrgTeamEntity
e
:
page
.
getContent
())
{
String
engineers
=
orgTeamEngineerDao
.
findAllByTeamId
(
e
.
getTeamId
()).
stream
().
map
(
e2
->
{
return
engineerInfoDao
.
getByEngineerCode
(
e2
.
getEngineerCode
()).
getName
();
}).
collect
(
Collectors
.
toList
()).
toString
();
BusinessTeamsDTO
.
Content
content
=
new
BusinessTeamsDTO
.
Content
();
content
.
setTeamId
(
e
.
getTeamId
()).
setTeamName
(
e
.
getTeamName
());
content
.
setWorkdays
(
getWorkdaysChinese
(
e
.
getWorkdays
()).
toString
(
));
content
.
setEngineers
(
engineers
);
content
.
setWorkdays
(
String
.
join
(
","
,
getWorkdaysChinese
(
e
.
getWorkdays
())
));
content
.
setEngineers
(
String
.
join
(
","
,
engineers
)
);
// todo 工作队容量
OrgWarehouseInfoEntity
warehouse
=
warehouseInfoDao
.
getByTeamAssigned
(
e
.
getTeamId
());
if
(
warehouse
!=
null
){
content
.
setWarehouseName
(
warehouse
.
getWarehouseName
());
}
//capacityUse已占容量, capacityRest剩余容量
// ordersNum 当前单数
// pepleMinute 人数/分钟数
contents
.
add
(
content
);
}
BusinessTeamsDTO
.
Result
rs
=
new
BusinessTeamsDTO
.
Result
();
rs
.
setContent
(
contents
).
setTotal
(
page
.
getTotalPages
()).
setPageSize
(
page
.
getSize
());
return
Result
.
success
(
rs
);
}
private
List
<
String
>
getWorkdaysChinese
(
String
workDays
){
private
List
<
String
>
getWorkdaysChinese
(
String
workDays
)
{
// 将 1,2,3 转换为 周一、周二、周三
return
Arrays
.
stream
(
workDays
.
split
(
","
)).
map
(
e
->
{
return
Arrays
.
stream
(
workDays
.
split
(
","
)).
map
(
e
->
{
return
Week
.
of
(
Integer
.
valueOf
(
e
)).
toChinese
(
"周"
);
}).
collect
(
Collectors
.
toList
());
}
@Override
public
Result
<?>
getWarehouses
(
BusinessWarehousesDTO
.
Request
req
)
{
List
<
OrgWarehouseInfoEntity
>
warehouseInfoEntityList
=
warehouseInfoDao
.
getAllBy
Group
Id
(
req
.
getGroupId
());
List
<
OrgWarehouseInfoEntity
>
warehouseInfoEntityList
=
warehouseInfoDao
.
getAllBy
Team
Id
(
req
.
getGroupId
());
List
<
BusinessWarehousesDTO
.
Content
>
contents
=
warehouseInfoEntityList
.
stream
().
map
(
entity
->
{
BusinessWarehousesDTO
.
Content
dto
=
new
BusinessWarehousesDTO
.
Content
();
dto
.
setWarehouseId
(
entity
.
getWarehouseId
());
...
...
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