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 f176cdea
authored
Jul 25, 2023
by
张晓
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
order_info.dispatch适配
1 parent
9cb3db32
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
7 deletions
project-dispatch/src/main/java/com/dituhui/pea/dispatch/controller/PrepareController.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/dao/DispatchBatchRepository.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/entity/OrderInfo.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/scheduler/BatchScheduler.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/service/impl/BatchServiceImpl.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/service/impl/ExtractServiceImpl.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/controller/PrepareController.java
View file @
f176cde
...
...
@@ -55,7 +55,9 @@ public class PrepareController {
SolverConfig
solverConfig
=
new
SolverConfig
().
withSolutionClass
(
DispatchSolution
.
class
);
solverConfig
.
withEntityClassList
(
Arrays
.
asList
(
Technician
.
class
,
Customer
.
class
));
// 这里不能漏掉,否则约束不生效
solverConfig
.
withConstraintProviderClass
(
DispatchConstraintProvider
.
class
);
solverConfig
.
withTerminationSpentLimit
(
Duration
.
ofSeconds
(
60
*
5
));
// solverConfig.withTerminationSpentLimit(Duration.ofSeconds(60 * 5));
// 手工触发计算,为尽快看到效果,先给2分钟时间
solverConfig
.
withTerminationSpentLimit
(
Duration
.
ofSeconds
(
60
*
2
));
solverFactory
=
SolverFactory
.
create
(
solverConfig
);
solver
=
solverFactory
.
buildSolver
();
...
...
project-dispatch/src/main/java/com/dituhui/pea/dispatch/dao/DispatchBatchRepository.java
View file @
f176cde
...
...
@@ -2,12 +2,9 @@ package com.dituhui.pea.dispatch.dao;
import
com.dituhui.pea.dispatch.entity.DispatchBatch
;
import
org.springframework.data.jpa.repository.Modifying
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.data.repository.CrudRepository
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.Optional
;
...
...
project-dispatch/src/main/java/com/dituhui/pea/dispatch/entity/OrderInfo.java
View file @
f176cde
...
...
@@ -129,6 +129,9 @@ public class OrderInfo implements Serializable {
@Column
(
name
=
"appointment_status"
)
private
String
appointmentStatus
;
@Column
(
name
=
"dispatcher"
)
private
String
dispatcher
;
@Column
(
name
=
"order_status"
)
private
String
orderStatus
;
...
...
project-dispatch/src/main/java/com/dituhui/pea/dispatch/scheduler/BatchScheduler.java
View file @
f176cde
...
...
@@ -122,7 +122,7 @@ public class BatchScheduler {
// Set the output file.
exporter
.
write
(
solution
,
new
File
(
"dispatchSolution_%s_%s.json"
.
format
(
groupId
,
currDay
)));
exporter
.
write
(
solution
,
new
File
(
String
.
format
(
"dispatchSolution_%s_%s.json"
,
groupId
,
currDay
)));
Thread
.
sleep
(
1000
*
5
);
...
...
project-dispatch/src/main/java/com/dituhui/pea/dispatch/service/impl/BatchServiceImpl.java
View file @
f176cde
...
...
@@ -109,7 +109,7 @@ public class BatchServiceImpl implements BatchService {
" concat(a.brand, '-', a.type, '-', a.skill) skills , a.take_time , a.appointment_status\n"
+
" from order_info a \n"
+
" where a.org_group_id=? and a.dt = ? and bean_status='OPEN'\n"
+
" and appointment_method like 'AUTO%' and a.appointment_status in ('INIT',
'VIRTUAL',
'PRE')\n"
+
" and appointment_method like 'AUTO%' and a.appointment_status in ('INIT', 'PRE')\n"
+
" and order_status ='NORMAL' and service_status='INIT'\n"
+
" order by a.expect_time_begin asc "
;
int
orderCount
=
jdbcTemplate
.
update
(
sqlOrder
,
batchNo
,
groupId
,
batchDay
);
...
...
project-dispatch/src/main/java/com/dituhui/pea/dispatch/service/impl/ExtractServiceImpl.java
View file @
f176cde
...
...
@@ -100,7 +100,7 @@ public class ExtractServiceImpl implements ExtractService {
if
(!(
"OPEN"
.
equals
(
orderInfo
.
getBeanStatus
())
&&
Set
.
of
(
"AUTO_NOW"
,
"AUTO_BATCH"
).
contains
(
orderInfo
.
getAppointmentMethod
())
&&
Set
.
of
(
"INIT"
,
"
VIRTUAL"
,
"
PRE"
).
contains
(
orderInfo
.
getAppointmentStatus
())
&&
Set
.
of
(
"INIT"
,
"PRE"
).
contains
(
orderInfo
.
getAppointmentStatus
())
&&
"NORMAL"
.
equals
(
orderInfo
.
getOrderStatus
())
&&
"INIT"
.
equals
(
orderInfo
.
getServiceStatus
())))
{
log
.
warn
(
"算法结果更新到工单, step1.1-loop, 工单状态异常, groupId:{}, batchNo:{}, orderId:{}, bean-status:{}, appointment-status:{}, order-status:{}, service-status:{}"
,
...
...
@@ -132,6 +132,7 @@ public class ExtractServiceImpl implements ExtractService {
orderInfo
.
setArriveElapsed
(
dispatchOrder
.
getPathTime
());
orderInfo
.
setArriveDistance
(
dispatchOrder
.
getPathDistance
());
orderInfo
.
setAppointmentStatus
(
isConfirm
?
"CONFIRM"
:
"PRE"
);
orderInfo
.
setDispatcher
(
"AUTO_BATCH"
);
orderInfo
.
setUpdateTime
(
LocalDateTime
.
now
());
orderInfoRepo
.
save
(
orderInfo
);
...
...
@@ -159,8 +160,14 @@ public class ExtractServiceImpl implements ExtractService {
orderInfo
.
setArriveElapsed
(
0
);
orderInfo
.
setArriveDistance
(
0
);
orderInfo
.
setAppointmentStatus
(
"INIT"
);
orderInfo
.
setDispatcher
(
"AUTO_BATCH"
);
orderInfo
.
setUpdateTime
(
LocalDateTime
.
now
());
orderInfoRepo
.
save
(
orderInfo
);
OrderLog
orderLog
=
new
OrderLog
().
setOrderId
(
orderId
).
setSuborderId
(
orderInfo
.
getSubId
()).
setSource
(
"PEA-DISPATCH"
).
setOperator
(
"DISPATCH"
)
.
setContent
(
String
.
format
(
"批量自动指派:<%s,%s>"
,
""
,
"抹掉技术员"
)).
setContentOld
(
""
)
.
setMemo
(
"批量自动指派"
).
setCreateTime
(
LocalDateTime
.
now
()).
setUpdateTime
(
LocalDateTime
.
now
());
orderLogRepo
.
save
(
orderLog
);
}
});
...
...
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