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 5c08350f
authored
Jul 13, 2023
by
张晓
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-dispatch-zx' into develop
2 parents
5da780c4
28d370cc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
11 deletions
project-dispatch/src/main/java/com/dituhui/pea/dispatch/controller/PrepareController.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/service/SolveService.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/service/impl/SolveServiceImpl.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 @
5c08350
...
...
@@ -4,7 +4,6 @@ package com.dituhui.pea.dispatch.controller;
import
cn.hutool.core.map.MapUtil
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.dispatch.constraint.DispatchConstraintProvider
;
import
com.dituhui.pea.dispatch.entity.DispatchBatch
;
import
com.dituhui.pea.dispatch.pojo.Customer
;
import
com.dituhui.pea.dispatch.pojo.DispatchSolution
;
import
com.dituhui.pea.dispatch.pojo.Technician
;
...
...
@@ -66,9 +65,11 @@ public class PrepareController {
* 运行批次任务,直接返回结果(不重新进行数据准备)
*/
@GetMapping
(
"/solveTest/{groupId}/{batchNo}"
)
public
Result
<?>
prepareAndSolve
(
@PathVariable
String
groupId
,
@PathVariable
String
batchNo
)
{
log
.
info
(
"prepareSolve, groupId:{}, day:{}"
,
groupId
,
batchNo
);
DispatchSolution
solution
=
solveService
.
prepareAndSolveSolution
(
groupId
,
batchNo
);
public
Result
<?>
prepareAndSolve
(
@PathVariable
String
groupId
,
@PathVariable
String
day
)
{
log
.
info
(
"prepareSolve, groupId:{}, day:{}"
,
groupId
,
day
);
String
batchNo
=
batchService
.
buildBatchData
(
groupId
,
day
);
log
.
info
(
"调用引擎处理, groupId:{}, day:{}, batchNo:{}"
,
groupId
,
day
,
batchNo
);
DispatchSolution
solution
=
solveService
.
prepareAndSolveTest
(
groupId
,
batchNo
);
List
<
Technician
>
technicianList
=
solution
.
getTechnicianList
();
List
<
Customer
>
customerList
=
solution
.
getCustomerList
();
HardSoftLongScore
score
=
solution
.
getScore
();
...
...
@@ -83,8 +84,7 @@ public class PrepareController {
@GetMapping
(
"/solveStart/{groupId}/{day}"
)
public
Result
<?>
solveAsync
(
@PathVariable
String
groupId
,
@PathVariable
String
day
)
{
log
.
info
(
"调用引擎处理-异步处理, groupId:{}, day:{}"
,
groupId
,
day
);
String
batchNo
=
null
;
batchNo
=
batchService
.
buildBatchData
(
groupId
,
day
);
String
batchNo
=
batchService
.
buildBatchData
(
groupId
,
day
);
// DispatchBatch newBatch= batchService.queryBatchInfoByDay(groupId, day);
// log.info("newBatch:{}", newBatch);
...
...
@@ -93,7 +93,10 @@ public class PrepareController {
log
.
info
(
"调用引擎处理, groupId:{}, day:{}, batchNo:{}"
,
groupId
,
day
,
batchNo
);
DispatchSolution
problem
=
solveService
.
prepareSolution
(
groupId
,
batchNo
);
if
(
problem
.
getCustomerList
().
size
()
<=
0
)
{
log
.
info
(
"dispatchRun no order , group:{}, day:{}, batch:{}, order-size:{}"
,
groupId
,
day
,
batchNo
,
problem
.
getCustomerList
().
size
());
return
Result
.
failed
(
"当前批次没有工单数据"
);
}
DispatchSolution
solution
=
solver
.
solve
(
problem
);
solveService
.
saveSolutionWrp
(
solution
);
...
...
project-dispatch/src/main/java/com/dituhui/pea/dispatch/service/SolveService.java
View file @
5c08350
...
...
@@ -17,7 +17,7 @@ public interface SolveService {
* 按小组、批次号组装问题对象
* 调用optaplaner计算输出结果
* */
DispatchSolution
prepareAndSolve
Solution
(
String
groupId
,
String
batchNo
);
DispatchSolution
prepareAndSolve
Test
(
String
groupId
,
String
batchNo
);
UUID
generateProblemId
(
String
groupId
,
String
batchNo
);
...
...
project-dispatch/src/main/java/com/dituhui/pea/dispatch/service/impl/SolveServiceImpl.java
View file @
5c08350
...
...
@@ -110,7 +110,6 @@ public class SolveServiceImpl implements SolveService {
if
(
dispatchOrderList
.
isEmpty
())
{
log
.
error
(
"组织问题对象, 未查询到工单信息 ,groupId:{}, batchNo:{}"
,
groupId
,
batchNo
);
throw
new
RuntimeException
(
String
.
format
(
"组织问题对象, 未查询到工单信息 ,groupId:%s, batchNo:%s"
,
groupId
,
batchNo
));
}
dispatchOrderList
.
forEach
(
order
->
{
...
...
@@ -195,11 +194,15 @@ public class SolveServiceImpl implements SolveService {
* 调用optaplaner计算输出结果
* */
@Override
public
DispatchSolution
prepareAndSolve
Solution
(
String
groupId
,
String
batchNo
)
{
public
DispatchSolution
prepareAndSolve
Test
(
String
groupId
,
String
batchNo
)
{
log
.
info
(
"组织问题对象/调用引擎处理, groupId:{}, batchNo:{}"
,
groupId
,
batchNo
);
// Load the problem
DispatchSolution
problem
=
prepareSolution
(
groupId
,
batchNo
);
if
(
problem
.
getCustomerList
().
size
()
<=
0
)
{
log
.
info
(
"dispatchRun no order , group:{}, batch:{}, order-size:{}"
,
groupId
,
batchNo
,
problem
.
getCustomerList
().
size
());
throw
new
RuntimeException
(
"当前批次没有工单信息"
);
}
SolverConfig
solverConfig
=
new
SolverConfig
().
withSolutionClass
(
DispatchSolution
.
class
);
...
...
project-dispatch/src/test/java/com/dituhui/pea/dispatch/SolveServiceTest.java
View file @
5c08350
...
...
@@ -57,7 +57,7 @@ class SolveServiceTest {
log
.
info
(
"init"
);
DispatchSolution
solution
=
solveService
.
prepareAndSolve
Solution
(
groupId
,
batchNo
);
DispatchSolution
solution
=
solveService
.
prepareAndSolve
Test
(
groupId
,
batchNo
);
log
.
info
(
"result:{}"
,
solution
);
...
...
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