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 935790b3
authored
Jul 13, 2023
by
丁伟峰
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop
2 parents
d4bdaab6
5a166684
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
40 deletions
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderServiceDetailImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderServiceDetailImpl.java
View file @
935790b
package
com
.
dituhui
.
pea
.
order
.
service
.
impl
;
package
com
.
dituhui
.
pea
.
order
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.order.common.TimeUtils
;
import
com.dituhui.pea.order.common.TimeUtils
;
import
com.dituhui.pea.order.dao.*
;
import
com.dituhui.pea.order.dao.*
;
import
com.dituhui.pea.order.dto.*
;
import
com.dituhui.pea.order.dto.*
;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.service.OrderServiceDetail
;
import
com.dituhui.pea.order.service.OrderServiceDetail
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -26,9 +26,6 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
...
@@ -26,9 +26,6 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
private
OrderAppointmentMPDao
orderAppointmentMPDao
;
private
OrderAppointmentMPDao
orderAppointmentMPDao
;
@Autowired
@Autowired
private
EngineerSkillMPDao
engineerSkillMPDao
;
@Autowired
private
EngineerInfoMPDao
engineerInfoMPDao
;
private
EngineerInfoMPDao
engineerInfoMPDao
;
@Autowired
@Autowired
...
@@ -41,7 +38,10 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
...
@@ -41,7 +38,10 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
private
OrgGroupMPDao
orgGroupMPDao
;
private
OrgGroupMPDao
orgGroupMPDao
;
@Autowired
@Autowired
private
ProductCategoryMPDao
productCategoryMPDao
;
private
EngineerSkillGroupMPDao
engineerSkillGroupMPDao
;
@Autowired
private
SkillInfoMPDao
skillInfoMPDao
;
@Transactional
@Transactional
@Override
@Override
...
@@ -54,7 +54,7 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
...
@@ -54,7 +54,7 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
// 设置订单详情信息
// 设置订单详情信息
OrderServiceDetailResp
.
OrderDetail
detail
=
new
OrderServiceDetailResp
.
OrderDetail
();
OrderServiceDetailResp
.
OrderDetail
detail
=
new
OrderServiceDetailResp
.
OrderDetail
();
detail
.
setAddress
(
String
.
format
(
"%s%s%s"
,
order
.
getCity
(),
order
.
getCounty
(),
order
.
getAddress
()));
detail
.
setAddress
(
String
.
format
(
"%s%s%s"
,
order
.
getCity
(),
order
.
getCounty
(),
order
.
getAddress
()));
detail
.
setLocation
(
String
.
format
(
"%s,%s"
,
order
.
getX
(),
order
.
getY
()));
detail
.
setLocation
(
String
.
format
(
"%s,%s"
,
order
.
getX
(),
order
.
getY
()));
detail
.
setDate
(
TimeUtils
.
IsoLocalDate2String
(
order
.
getDt
()));
detail
.
setDate
(
TimeUtils
.
IsoLocalDate2String
(
order
.
getDt
()));
detail
.
setBrand
(
order
.
getBrand
());
detail
.
setBrand
(
order
.
getBrand
());
detail
.
setType
(
order
.
getType
());
detail
.
setType
(
order
.
getType
());
...
@@ -116,11 +116,8 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
...
@@ -116,11 +116,8 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
List
<
String
>
groupIds
=
egInfo
.
values
().
stream
().
map
(
EngineerInfo:
:
getGroupId
).
collect
(
Collectors
.
toList
());
List
<
String
>
groupIds
=
egInfo
.
values
().
stream
().
map
(
EngineerInfo:
:
getGroupId
).
collect
(
Collectors
.
toList
());
HashMap
<
String
,
OrgGroup
>
groups
=
this
.
queryOrgGroups
(
groupIds
);
HashMap
<
String
,
OrgGroup
>
groups
=
this
.
queryOrgGroups
(
groupIds
);
// 获取工程师技能列表
// 获取工程师技能列表<engineerCode, skills>
Map
<
String
,
List
<
EngineerSkill
>>
egSkill
=
this
.
getEngineerSkills
(
egCodes
);
Map
<
String
,
String
>
egSkill
=
this
.
getEngineerSkills
(
egCodes
);
// 获取所有技能列表
HashMap
<
String
,
String
>
skills
=
this
.
queryAllSkills
();
// 获取subOrder订单timeline
// 获取subOrder订单timeline
Map
<
String
,
List
<
OrderTimeline
>>
timelines
=
this
.
getOrderTimelines
(
orderId
);
Map
<
String
,
List
<
OrderTimeline
>>
timelines
=
this
.
getOrderTimelines
(
orderId
);
...
@@ -136,7 +133,7 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
...
@@ -136,7 +133,7 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
String
subOrderId
=
o
.
getSuborderId
();
String
subOrderId
=
o
.
getSuborderId
();
EngineerInfo
eg
=
egInfo
.
getOrDefault
(
o
.
getEngineerCode
(),
null
);
EngineerInfo
eg
=
egInfo
.
getOrDefault
(
o
.
getEngineerCode
(),
null
);
List
<
EngineerSkill
>
es
=
egSkill
.
getOrDefault
(
o
.
getEngineerCode
(),
null
);
String
skill
=
egSkill
.
getOrDefault
(
o
.
getEngineerCode
(),
null
);
// 获取工程师姓名
// 获取工程师姓名
String
engineerName
=
(
eg
!=
null
)
?
eg
.
getName
()
:
o
.
getEngineerCode
();
String
engineerName
=
(
eg
!=
null
)
?
eg
.
getName
()
:
o
.
getEngineerCode
();
...
@@ -152,7 +149,7 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
...
@@ -152,7 +149,7 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
item
.
setEngineerCode
(
o
.
getEngineerCode
());
item
.
setEngineerCode
(
o
.
getEngineerCode
());
item
.
setExpectTime
(
TimeUtils
.
IsoTimestamp2DateTime
(
o
.
getExpectStartTime
()));
item
.
setExpectTime
(
TimeUtils
.
IsoTimestamp2DateTime
(
o
.
getExpectStartTime
()));
item
.
setTimelines
(
this
.
packOrderTimeline
(
timelines
.
get
(
subOrderId
)));
item
.
setTimelines
(
this
.
packOrderTimeline
(
timelines
.
get
(
subOrderId
)));
item
.
setItems
(
this
.
packEngineerItems
(
eg
,
es
,
groups
.
get
(
eg
.
getGroupId
()),
skills
));
item
.
setItems
(
this
.
packEngineerItems
(
eg
,
skill
,
groups
.
get
(
eg
.
getGroupId
())
));
items
.
add
(
item
);
items
.
add
(
item
);
}
}
...
@@ -214,26 +211,42 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
...
@@ -214,26 +211,42 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
return
map
;
return
map
;
}
}
private
Map
<
String
,
List
<
EngineerSkill
>
>
getEngineerSkills
(
List
<
String
>
egCodes
)
{
private
Map
<
String
,
String
>
getEngineerSkills
(
List
<
String
>
egCodes
)
{
// 获取工程师技能列表
// 获取工程师技能列表
Map
<
String
,
List
<
EngineerSkill
>
>
map
=
new
HashMap
<>();
Map
<
String
,
String
>
map
=
new
HashMap
<>();
if
(
egCodes
.
isEmpty
())
{
if
(
egCodes
.
isEmpty
())
{
return
map
;
return
map
;
}
}
LambdaQueryWrapper
<
EngineerSkillGroup
>
lqw
=
new
LambdaQueryWrapper
<>();
LambdaQueryWrapper
<
EngineerSkill
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
select
(
EngineerSkillGroup:
:
getEngineerCode
,
EngineerSkillGroup:
:
getSkillGroupCode
);
lqw
.
in
(
EngineerSkill:
:
getEngineerCode
,
egCodes
);
lqw
.
in
(
EngineerSkillGroup:
:
getEngineerCode
,
egCodes
);
lqw
.
eq
(
EngineerSkill:
:
getBean_status
,
1
);
lqw
.
eq
(
EngineerSkillGroup:
:
getStatus
,
1
);
lqw
.
eq
(
EngineerSkill:
:
getStatus
,
1
);
List
<
EngineerSkillGroup
>
rows
=
engineerSkillGroupMPDao
.
selectList
(
lqw
);
List
<
EngineerSkill
>
rows
=
engineerSkillMPDao
.
selectList
(
lqw
);
// 根据engineerCode排序
// 根据engineerCode排序
Comparator
<
EngineerSkill
>
cmp
=
Comparator
.
comparing
(
EngineerSkill:
:
getEngineerCode
);
Comparator
<
EngineerSkillGroup
>
cmp
=
Comparator
.
comparing
(
EngineerSkillGroup:
:
getEngineerCode
);
List
<
EngineerSkill
>
results
=
rows
.
stream
().
sorted
(
cmp
).
collect
(
Collectors
.
toList
());
List
<
EngineerSkillGroup
>
sortedResults
=
rows
.
stream
().
sorted
(
cmp
).
collect
(
Collectors
.
toList
());
// 根据engineerCode分组
// 根据engineerCode分组
return
results
.
stream
().
collect
(
Collectors
.
groupingBy
(
EngineerSkill:
:
getEngineerCode
));
Map
<
String
,
List
<
EngineerSkillGroup
>>
results
=
sortedResults
.
stream
().
collect
(
Collectors
.
groupingBy
(
EngineerSkillGroup:
:
getEngineerCode
));
// 获取所有技能
HashMap
<
String
,
String
>
skills
=
this
.
queryAllSkills
();
for
(
Map
.
Entry
<
String
,
List
<
EngineerSkillGroup
>>
entry
:
results
.
entrySet
())
{
String
engineerCode
=
entry
.
getKey
();
List
<
String
>
engineerSkills
=
new
ArrayList
<>();
for
(
EngineerSkillGroup
r
:
entry
.
getValue
())
{
String
skill
=
skills
.
getOrDefault
(
r
.
getSkillGroupCode
(),
""
);
if
(
skill
.
isEmpty
())
{
continue
;
}
engineerSkills
.
add
(
skill
);
}
map
.
put
(
engineerCode
,
String
.
join
(
"、"
,
engineerSkills
));
}
return
map
;
}
}
private
Map
<
String
,
List
<
OrderTimeline
>>
getOrderTimelines
(
String
orderId
)
{
private
Map
<
String
,
List
<
OrderTimeline
>>
getOrderTimelines
(
String
orderId
)
{
...
@@ -255,18 +268,28 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
...
@@ -255,18 +268,28 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
private
HashMap
<
String
,
String
>
queryAllSkills
()
{
private
HashMap
<
String
,
String
>
queryAllSkills
()
{
HashMap
<
String
,
String
>
map
=
new
HashMap
<>();
HashMap
<
String
,
String
>
map
=
new
HashMap
<>();
List
<
ProductCategory
>
records
=
productCategoryMPDao
.
selectList
(
null
);
List
<
SkillInfo
>
records
=
skillInfoMPDao
.
selectList
(
null
);
for
(
ProductCategory
r
:
records
)
{
map
.
put
(
r
.
getProductCategoryId
(),
String
.
format
(
"%s%s"
,
r
.
getType
(),
r
.
getSkill
()));
Comparator
<
SkillInfo
>
cmp
=
Comparator
.
comparing
(
SkillInfo:
:
getSkillGroupCode
);
List
<
SkillInfo
>
sortedResults
=
records
.
stream
().
sorted
(
cmp
).
collect
(
Collectors
.
toList
());
Map
<
String
,
List
<
SkillInfo
>>
results
=
sortedResults
.
stream
().
collect
(
Collectors
.
groupingBy
(
SkillInfo:
:
getSkillGroupCode
));
for
(
Map
.
Entry
<
String
,
List
<
SkillInfo
>>
entry
:
results
.
entrySet
())
{
String
skillGroupCode
=
entry
.
getKey
();
HashSet
<
String
>
categories
=
new
HashSet
<>();
for
(
SkillInfo
s
:
entry
.
getValue
())
{
categories
.
add
(
String
.
format
(
"%s%s"
,
s
.
getTypeCategory
(),
s
.
getSkillCategory
()));
}
List
<
String
>
skills
=
new
ArrayList
<>(
categories
);
map
.
put
(
skillGroupCode
,
String
.
join
(
"、"
,
skills
));
}
}
return
map
;
return
map
;
}
}
private
List
<
KV
>
packEngineerItems
(
EngineerInfo
eg
,
List
<
EngineerSkill
>
egSkill
,
OrgGroup
group
,
HashMap
<
String
,
String
>
skills
)
{
private
List
<
KV
>
packEngineerItems
(
EngineerInfo
eg
,
String
skill
,
OrgGroup
group
)
{
// 获取工程师信息
// 获取工程师信息
List
<
KV
>
items
=
new
ArrayList
<>();
List
<
KV
>
items
=
new
ArrayList
<>();
if
(
eg
==
null
&&
egS
kill
==
null
)
{
if
(
eg
==
null
&&
s
kill
==
null
)
{
return
items
;
return
items
;
}
}
...
@@ -303,18 +326,8 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
...
@@ -303,18 +326,8 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
items
.
add
(
this
.
packEngineer
(
"工号"
,
eg
.
getEngineerCode
(),
""
));
items
.
add
(
this
.
packEngineer
(
"工号"
,
eg
.
getEngineerCode
(),
""
));
items
.
add
(
this
.
packEngineer
(
"手机号"
,
eg
.
getPhone
(),
""
));
items
.
add
(
this
.
packEngineer
(
"手机号"
,
eg
.
getPhone
(),
""
));
}
}
items
.
add
(
this
.
packEngineer
(
"技能"
,
skill
,
""
));
if
(
egSkill
!=
null
)
{
List
<
String
>
rows
=
new
ArrayList
<>();
for
(
EngineerSkill
s
:
egSkill
)
{
String
skill
=
skills
.
getOrDefault
(
s
.
getCategoryId
(),
""
);
if
(
skill
.
isEmpty
())
{
continue
;
}
rows
.
add
(
skill
);
}
items
.
add
(
this
.
packEngineer
(
"技能"
,
String
.
join
(
"、"
,
rows
),
""
));
}
return
items
;
return
items
;
}
}
...
...
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