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 a94dc1ad
authored
Jul 18, 2023
by
张晓
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-dispatch-zx2' into develop
2 parents
5d7e71c4
5f79e72a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
9 deletions
project-dispatch/src/main/java/com/dituhui/pea/dispatch/controller/PrepareController.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/scheduler/BatchScheduler.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/service/impl/ExtractServiceImpl.java
project-dispatch/src/test/java/com/dituhui/pea/dispatch/SolveServiceTest.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/controller/PrepareController.java
View file @
a94dc1a
...
@@ -53,7 +53,7 @@ public class PrepareController {
...
@@ -53,7 +53,7 @@ public class PrepareController {
SolverConfig
solverConfig
=
new
SolverConfig
().
withSolutionClass
(
DispatchSolution
.
class
);
SolverConfig
solverConfig
=
new
SolverConfig
().
withSolutionClass
(
DispatchSolution
.
class
);
solverConfig
.
withEntityClassList
(
Arrays
.
asList
(
Technician
.
class
,
Customer
.
class
));
// 这里不能漏掉,否则约束不生效
solverConfig
.
withEntityClassList
(
Arrays
.
asList
(
Technician
.
class
,
Customer
.
class
));
// 这里不能漏掉,否则约束不生效
solverConfig
.
withConstraintProviderClass
(
DispatchConstraintProvider
.
class
);
solverConfig
.
withConstraintProviderClass
(
DispatchConstraintProvider
.
class
);
solverConfig
.
withTerminationSpentLimit
(
Duration
.
ofSeconds
(
10
));
solverConfig
.
withTerminationSpentLimit
(
Duration
.
ofSeconds
(
60
*
5
));
SolverFactory
<
DispatchSolution
>
solverFactory
=
SolverFactory
.
create
(
solverConfig
);
SolverFactory
<
DispatchSolution
>
solverFactory
=
SolverFactory
.
create
(
solverConfig
);
solver
=
solverFactory
.
buildSolver
();
solver
=
solverFactory
.
buildSolver
();
...
@@ -80,10 +80,10 @@ public class PrepareController {
...
@@ -80,10 +80,10 @@ public class PrepareController {
return
Result
.
success
(
resultMap
);
return
Result
.
success
(
resultMap
);
}
}
// 重新进行数据准备、
异步
任务运行
// 重新进行数据准备、任务运行
@GetMapping
(
"/solveStart/{groupId}/{day}"
)
@GetMapping
(
"/solveStart/{groupId}/{day}"
)
public
Result
<?>
solveAsync
(
@PathVariable
String
groupId
,
@PathVariable
String
day
)
{
public
Result
<?>
solveAsync
(
@PathVariable
String
groupId
,
@PathVariable
String
day
)
{
log
.
info
(
"调用引擎处理-
异步
处理, groupId:{}, day:{}"
,
groupId
,
day
);
log
.
info
(
"调用引擎处理-处理, groupId:{}, day:{}"
,
groupId
,
day
);
String
batchNo
=
batchService
.
buildBatchData
(
groupId
,
day
);
String
batchNo
=
batchService
.
buildBatchData
(
groupId
,
day
);
// DispatchBatch newBatch= batchService.queryBatchInfoByDay(groupId, day);
// DispatchBatch newBatch= batchService.queryBatchInfoByDay(groupId, day);
...
@@ -110,11 +110,11 @@ public class PrepareController {
...
@@ -110,11 +110,11 @@ public class PrepareController {
solverManager.solveAndListen(problemId, id -> problem,
solverManager.solveAndListen(problemId, id -> problem,
this.solveService::saveAndExtractSolution);
this.solveService::saveAndExtractSolution);
log.error("调用引擎处理-
异步处理, 已触发异步
, groupId:{}, batchNo:{}", groupId, batchNo);
log.error("调用引擎处理-
处理, 已触发
, groupId:{}, batchNo:{}", groupId, batchNo);
*/
*/
return
Result
.
success
(
"已触发
异步
执行"
);
return
Result
.
success
(
"已触发执行"
);
}
}
@GetMapping
(
"/solveStatus/{groupId}/{day}"
)
@GetMapping
(
"/solveStatus/{groupId}/{day}"
)
...
...
project-dispatch/src/main/java/com/dituhui/pea/dispatch/scheduler/BatchScheduler.java
View file @
a94dc1a
...
@@ -55,7 +55,7 @@ public class BatchScheduler {
...
@@ -55,7 +55,7 @@ public class BatchScheduler {
SolverConfig
solverConfig
=
new
SolverConfig
().
withSolutionClass
(
DispatchSolution
.
class
);
SolverConfig
solverConfig
=
new
SolverConfig
().
withSolutionClass
(
DispatchSolution
.
class
);
solverConfig
.
withEntityClassList
(
Arrays
.
asList
(
Technician
.
class
,
Customer
.
class
));
// 这里不能漏掉,否则约束不生效
solverConfig
.
withEntityClassList
(
Arrays
.
asList
(
Technician
.
class
,
Customer
.
class
));
// 这里不能漏掉,否则约束不生效
solverConfig
.
withConstraintProviderClass
(
DispatchConstraintProvider
.
class
);
solverConfig
.
withConstraintProviderClass
(
DispatchConstraintProvider
.
class
);
solverConfig
.
withTerminationSpentLimit
(
Duration
.
ofSeconds
(
20
));
solverConfig
.
withTerminationSpentLimit
(
Duration
.
ofSeconds
(
60
*
5
));
SolverFactory
<
DispatchSolution
>
solverFactory
=
SolverFactory
.
create
(
solverConfig
);
SolverFactory
<
DispatchSolution
>
solverFactory
=
SolverFactory
.
create
(
solverConfig
);
solver
=
solverFactory
.
buildSolver
();
solver
=
solverFactory
.
buildSolver
();
...
...
project-dispatch/src/main/java/com/dituhui/pea/dispatch/service/impl/ExtractServiceImpl.java
View file @
a94dc1a
...
@@ -163,9 +163,10 @@ public class ExtractServiceImpl implements ExtractService {
...
@@ -163,9 +163,10 @@ public class ExtractServiceImpl implements ExtractService {
}
else
{
}
else
{
// 如果有记录:1虚拟指派 2排量预派 3
// 如果有记录:1虚拟指派 2排量预派 3
if
(
Set
.
of
(
"PRE"
,
"VIRTUAL"
).
contains
(
appointmentOpt
.
get
().
getPreStatus
())
&&
Set
.
of
(
"NOT_ASSIGNED"
,
"ASSIGNED"
).
contains
(
appointmentOpt
.
get
().
getStatus
()))
{
OrderAppointment
appointment
=
appointmentOpt
.
get
();
OrderAppointment
appointment
=
appointmentOpt
.
get
();
if
(
Set
.
of
(
"PRE"
,
"VIRTUAL"
).
contains
(
appointment
.
getPreStatus
())
&&
Set
.
of
(
"NOT_ASSIGNED"
,
"ASSIGNED"
).
contains
(
appointment
.
getStatus
()))
{
String
lastContent
=
String
.
format
(
"批量自动指派:<%s,%s>"
,
appointment
.
getEngineerCode
(),
appointment
.
getEngineerName
());
String
lastContent
=
String
.
format
(
"批量自动指派:<%s,%s>"
,
appointment
.
getEngineerCode
(),
appointment
.
getEngineerName
());
appointment
.
setStatus
(
"ASSIGNED"
);
appointment
.
setStatus
(
"ASSIGNED"
);
appointment
.
setPreStatus
(
isConfirm
?
"CONFIRM"
:
"PRE"
);
appointment
.
setPreStatus
(
isConfirm
?
"CONFIRM"
:
"PRE"
);
...
@@ -178,6 +179,9 @@ public class ExtractServiceImpl implements ExtractService {
...
@@ -178,6 +179,9 @@ public class ExtractServiceImpl implements ExtractService {
appointment
.
setExpectEndTime
(
dispatchOrder
.
getTimeEnd
());
appointment
.
setExpectEndTime
(
dispatchOrder
.
getTimeEnd
());
appointment
.
setUpdateTime
(
LocalDateTime
.
now
());
appointment
.
setUpdateTime
(
LocalDateTime
.
now
());
orderAppointmentRepo
.
save
(
appointment
);
orderAppointmentRepo
.
save
(
appointment
);
if
(
null
==
appointment
.
getSuborderId
())
{
appointment
.
setSuborderId
(
appointment
.
getOrderId
());
}
OrderLog
orderLog
=
new
OrderLog
().
setOrderId
(
orderId
).
setSuborderId
(
appointment
.
getSuborderId
()).
setSource
(
"PEA-BACKEND"
).
setOperator
(
"DISPATCH"
)
OrderLog
orderLog
=
new
OrderLog
().
setOrderId
(
orderId
).
setSuborderId
(
appointment
.
getSuborderId
()).
setSource
(
"PEA-BACKEND"
).
setOperator
(
"DISPATCH"
)
.
setContent
(
String
.
format
(
"批量自动指派:<%s,%s>"
,
engCode
,
engName
)).
setContentOld
(
lastContent
)
.
setContent
(
String
.
format
(
"批量自动指派:<%s,%s>"
,
engCode
,
engName
)).
setContentOld
(
lastContent
)
...
...
project-dispatch/src/test/java/com/dituhui/pea/dispatch/SolveServiceTest.java
View file @
a94dc1a
...
@@ -40,7 +40,7 @@ class SolveServiceTest {
...
@@ -40,7 +40,7 @@ class SolveServiceTest {
ExtractService
extractService
;
ExtractService
extractService
;
String
groupId
=
"gsuzhou"
;
String
groupId
=
"gsuzhou"
;
String
day
=
"2023-0
7-11
"
;
String
day
=
"2023-0
3-20
"
;
private
SolverManager
<
DispatchSolution
,
UUID
>
solverManager
;
private
SolverManager
<
DispatchSolution
,
UUID
>
solverManager
;
private
Solver
<
DispatchSolution
>
solver
;
private
Solver
<
DispatchSolution
>
solver
;
...
...
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