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 d5b66177
authored
Jun 19, 2023
by
王力
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature_mvp616_wangl' into 'develop'
修改 See merge request !107
2 parents
0bb9a2b6
b594780d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
2 deletions
project-order/src/main/java/com/alibaba/cloud/integration/order/service/impl/OrderAssignImpl.java
project-order/src/main/java/com/alibaba/cloud/integration/order/service/impl/OrderAssignImpl.java
View file @
d5b6617
...
@@ -5,6 +5,7 @@ import com.alibaba.cloud.integration.common.Result;
...
@@ -5,6 +5,7 @@ import com.alibaba.cloud.integration.common.Result;
import
com.alibaba.cloud.integration.order.dao.EngineerInfoMPDao
;
import
com.alibaba.cloud.integration.order.dao.EngineerInfoMPDao
;
import
com.alibaba.cloud.integration.order.dao.OrderAppointmentMPDao
;
import
com.alibaba.cloud.integration.order.dao.OrderAppointmentMPDao
;
import
com.alibaba.cloud.integration.order.dao.OrderRequestMPDao
;
import
com.alibaba.cloud.integration.order.dao.OrderRequestMPDao
;
import
com.alibaba.cloud.integration.order.dto.OrderAssignRecommendResp
;
import
com.alibaba.cloud.integration.order.entity.EngineerInfo
;
import
com.alibaba.cloud.integration.order.entity.EngineerInfo
;
import
com.alibaba.cloud.integration.order.entity.OrderAppointment
;
import
com.alibaba.cloud.integration.order.entity.OrderAppointment
;
import
com.alibaba.cloud.integration.order.entity.OrderRequest
;
import
com.alibaba.cloud.integration.order.entity.OrderRequest
;
...
@@ -18,6 +19,7 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -18,6 +19,7 @@ import org.springframework.transaction.annotation.Transactional;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.List
;
...
@@ -38,7 +40,50 @@ public class OrderAssignImpl implements OrderAssign {
...
@@ -38,7 +40,50 @@ public class OrderAssignImpl implements OrderAssign {
@Override
@Override
public
Result
<?>
getOrderAssignRecommendEngineers
(
String
orderId
,
String
key
,
String
distance
,
String
recommend
)
{
public
Result
<?>
getOrderAssignRecommendEngineers
(
String
orderId
,
String
key
,
String
distance
,
String
recommend
)
{
// 服务单指派-推荐技术员列表
// 服务单指派-推荐技术员列表
return
null
;
OrderRequest
order
=
this
.
queryOrderRequest
(
orderId
);
if
(
order
==
null
)
{
throw
new
BusinessException
(
"订单不存在"
);
}
String
date
=
this
.
Timestamp2Datetime
(
order
.
getExpectTimeBegin
(),
"yyyy-MM-dd"
);
// 获取group内的小组成员
List
<
EngineerInfo
>
engineers
=
this
.
queryEngineerInfoByGroupId
(
order
.
getOrgGroupId
());
List
<
OrderAssignRecommendResp
.
Engineer
>
items
=
new
ArrayList
<>();
OrderRecommend
or
=
new
OrderRecommend
();
for
(
EngineerInfo
engineer
:
engineers
)
{
List
<
OrderAppointment
>
orderAppointments
=
this
.
queryOrderAppointments
(
engineer
.
getEngineerCode
(),
date
);
RecommendResult
rr
=
or
.
recommend
(
order
,
orderAppointments
);
if
(
rr
.
getIndex
()
==
-
1
)
{
continue
;
}
OrderAssignRecommendResp
.
Engineer
item
=
new
OrderAssignRecommendResp
.
Engineer
();
OrderAssignRecommendResp
.
InsertInfo
insertInfo
=
new
OrderAssignRecommendResp
.
InsertInfo
();
insertInfo
.
setNumber
(
String
.
format
(
"%d/%d"
,
rr
.
index
+
1
,
orderAppointments
.
size
()
+
1
));
insertInfo
.
setTimeDesc
(
"+30分钟"
);
insertInfo
.
setTimeDesc
(
"+4公里"
);
item
.
setEngineerCode
(
engineer
.
getEngineerCode
());
item
.
setEngineerName
(
engineer
.
getName
());
item
.
setLocation
(
""
);
item
.
setInsertInfo
(
insertInfo
);
item
.
setDistanceDesc
(
"15.5公里"
);
item
.
setTimeDesc
(
"520分钟"
);
item
.
setDesc
(
String
.
format
(
"将被插入在第%d单,受此影响原第%d单变化第%d单,第3单将增加5公里路程,比预计晚到30分钟,建议调整;"
,
rr
.
index
+
1
,
rr
.
index
+
1
,
rr
.
index
+
2
));
item
.
setStartTime
(
""
);
item
.
setStartTime
(
""
);
item
.
setTimelines
(
this
.
packTimelines
(
orderAppointments
));
items
.
add
(
item
);
}
OrderAssignRecommendResp
res
=
new
OrderAssignRecommendResp
();
res
.
setEngineers
(
items
);
return
Result
.
success
(
res
);
}
}
@Transactional
@Transactional
...
@@ -52,7 +97,7 @@ public class OrderAssignImpl implements OrderAssign {
...
@@ -52,7 +97,7 @@ public class OrderAssignImpl implements OrderAssign {
EngineerInfo
engineer
=
this
.
queryEngineerInfo
(
engineerCode
);
EngineerInfo
engineer
=
this
.
queryEngineerInfo
(
engineerCode
);
String
date
=
""
;
String
date
=
this
.
Timestamp2Datetime
(
order
.
getExpectTimeBegin
(),
"yyyy-MM-dd"
)
;
List
<
OrderAppointment
>
orderAppointments
=
this
.
queryOrderAppointments
(
engineerCode
,
date
);
List
<
OrderAppointment
>
orderAppointments
=
this
.
queryOrderAppointments
(
engineerCode
,
date
);
OrderRecommend
recommend
=
new
OrderRecommend
();
OrderRecommend
recommend
=
new
OrderRecommend
();
...
@@ -107,6 +152,30 @@ public class OrderAssignImpl implements OrderAssign {
...
@@ -107,6 +152,30 @@ public class OrderAssignImpl implements OrderAssign {
lqw
.
eq
(
EngineerInfo:
:
getEngineerCode
,
engineerCode
);
lqw
.
eq
(
EngineerInfo:
:
getEngineerCode
,
engineerCode
);
return
engineerInfoMPDao
.
selectOne
(
lqw
);
return
engineerInfoMPDao
.
selectOne
(
lqw
);
}
}
private
List
<
EngineerInfo
>
queryEngineerInfoByGroupId
(
String
groupId
)
{
LambdaQueryWrapper
<
EngineerInfo
>
lqw
=
new
LambdaQueryWrapper
<>();
lqw
.
eq
(
EngineerInfo:
:
getGroupId
,
groupId
);
return
engineerInfoMPDao
.
selectList
(
lqw
);
}
private
List
<
OrderAssignRecommendResp
.
Timeline
>
packTimelines
(
List
<
OrderAppointment
>
orders
)
{
List
<
OrderAssignRecommendResp
.
Timeline
>
items
=
new
ArrayList
<>();
for
(
OrderAppointment
order:
orders
){
OrderAssignRecommendResp
.
Timeline
item
=
new
OrderAssignRecommendResp
.
Timeline
();
item
.
setStartTime
(
""
);
item
.
setEndTime
(
""
);
item
.
setType
(
""
);
items
.
add
(
item
);
}
return
items
;
}
private
String
Timestamp2Datetime
(
Timestamp
t
,
String
pattern
)
{
DateTimeFormatter
df
=
DateTimeFormatter
.
ofPattern
(
pattern
);
return
df
.
format
(
t
.
toLocalDateTime
());
}
}
}
@Data
@Data
...
...
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