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 e171ae61
authored
Nov 06, 2023
by
Ren Ping
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:排班结果工程师详情修改
1 parent
d28fc44a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
26 deletions
project-dispatch/src/main/java/com/dituhui/pea/dispatch/quartz/AutoDispatchJob.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/SchedulerServiceImpl.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/service/impl/SolveServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/dto/ScheduleEngineerOverviewDynamics.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/ScheduleServiceImpl.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/quartz/AutoDispatchJob.java
View file @
e171ae6
...
...
@@ -2,6 +2,7 @@ package com.dituhui.pea.dispatch.quartz;
import
com.dituhui.pea.dispatch.service.SchedulerService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.quartz.DisallowConcurrentExecution
;
import
org.quartz.JobExecutionContext
;
import
org.quartz.JobExecutionException
;
import
org.quartz.JobKey
;
...
...
@@ -18,6 +19,7 @@ import javax.annotation.Resource;
*/
@Component
@Slf4j
@DisallowConcurrentExecution
public
class
AutoDispatchJob
extends
QuartzJobBean
{
public
static
final
String
TEAM_JOB_PREFIX
=
"BOXI_TEAM_"
;
...
...
project-dispatch/src/main/java/com/dituhui/pea/dispatch/service/impl/BatchServiceImpl.java
View file @
e171ae6
...
...
@@ -201,6 +201,10 @@ public class BatchServiceImpl implements BatchService {
String
batchNo
=
""
;
String
batchDay
=
""
;
if
(
"team_suzhou_001"
.
equals
(
teamId
)){
System
.
out
.
println
(
teamId
);
}
Optional
<
DispatchBatch
>
optional
=
batchRepository
.
findByTeamIdAndBatchDate
(
teamId
,
day
);
if
(!
optional
.
isPresent
())
{
// 创建batch
...
...
@@ -227,22 +231,26 @@ public class BatchServiceImpl implements BatchService {
log
.
info
(
"写入新批次技术员、工单数据, teamId:{}, day:{}, batchNo:{}"
,
teamId
,
batchDay
,
batchNo
);
String
sqlEngineer
=
"INSERT INTO dispatch_engineer (team_id, batch_no, engineer_code, engineer_name, x, y, max_num, max_minute, max_distance, vehicle_type)\n"
+
"SELECT o.team_id,?,o.engineer_code, a.name , b.x, b.y , max_num, max_minute, max_distance, b.vehicle FROM `org_team_engineer` o,engineer_info a,engineer_business b \
r\
n"
+
" WHERE o.team_id=? AND
`status`=1\r
\n"
+
" AND o.engineer_code=a.engineer_code AND a.engineer_code = b.engineer_code \
r\
n"
+
"SELECT o.team_id,?,o.engineer_code, a.name , b.x, b.y , max_num, max_minute, max_distance, b.vehicle FROM `org_team_engineer` o,engineer_info a,engineer_business b \n"
+
" WHERE o.team_id=? AND
o.`status`=1
\n"
+
" AND o.engineer_code=a.engineer_code AND a.engineer_code = b.engineer_code \n"
+
" AND b.x IS NOT NULL AND b.x !=''"
+
" order by a.engineer_code asc"
;
int
engCount
=
jdbcTemplate
.
update
(
sqlEngineer
,
batchNo
,
teamId
);
if
(
"team_suzhou_001"
.
equals
(
teamId
)){
System
.
out
.
println
(
teamId
);
}
// 未派过的工单(已派过PRE状态还可以再次派)
String
sqlOrder
=
"INSERT INTO dispatch_order (group_id, batch_no, team_id, order_id , dt, x, y, \n"
+
" expect_time_begin, expect_time_end, tags, priority , skills , take_time, status )\n"
+
" SELECT a.org_group_id, ?, a.org_team_id , a.order_id, ?, a.x, a.y , \
r\
n"
+
" a.expect_time_begin, a.expect_time_end, a.tags, a.priority , \
r\
n"
+
" CONCAT(a.brand, '-', a.type, '-', a.skill) skills , a.take_time , a.appointment_status\
r\
n"
+
" FROM order_info a \
r\n"
+
" WHERE a.org_team_id=? AND a.dt = ? AND bean_status='OPEN'\r
\n"
+
" AND appointment_method LIKE 'AUTO%' AND a.appointment_status IN ('INIT', 'PRE')\
r\
n"
+
" AND order_status ='NORMAL' AND service_status='INIT'\
r\
n"
+
" ORDER BY a.expect_time_begin ASC \
r\
n"
;
+
" SELECT a.org_group_id, ?, a.org_team_id , a.order_id, ?, a.x, a.y , \n"
+
" a.expect_time_begin, a.expect_time_end, a.tags, a.priority , \n"
+
" CONCAT(a.brand, '-', a.type, '-', a.skill) skills , a.take_time , a.appointment_status\n"
+
" FROM order_info a \
n"
+
" WHERE a.org_team_id=? AND a.dt = ? AND bean_status='OPEN'
\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 \n"
;
int
orderCount
=
jdbcTemplate
.
update
(
sqlOrder
,
batchNo
,
batchDay
,
teamId
,
batchDay
);
// confirm的要做预占用,所以也加入进来
...
...
project-dispatch/src/main/java/com/dituhui/pea/dispatch/service/impl/SchedulerServiceImpl.java
View file @
e171ae6
...
...
@@ -57,15 +57,13 @@ public class SchedulerServiceImpl implements SchedulerService {
}
@Override
@Transactional
(
isolation
=
Isolation
.
READ_COMMITTED
,
rollbackFor
=
Exception
.
class
)
public
void
dispatchRun2
(
String
teamId
)
{
OrgTeamEntity
orgTeamEntity
=
orgTeamDao
.
findByTeamId
(
teamId
);
String
groupId
=
orgTeamEntity
.
getGroupId
();
log
.
info
(
"dispatchRun group:{}, team:{} done"
,
groupId
,
teamId
);
try
{
for
(
int
i
=
1
;
i
<=
nextDaysLimit
;
i
++)
{
String
currDay
=
LocalDate
.
now
().
plusDays
(
i
).
format
(
DateTimeFormatter
.
ISO_LOCAL_DATE
);
for
(
int
i
=
1
;
i
<=
nextDaysLimit
;
i
++)
{
String
currDay
=
LocalDate
.
now
().
plusDays
(
i
).
format
(
DateTimeFormatter
.
ISO_LOCAL_DATE
);
try
{
log
.
info
(
"dispatchRun begin----- teamId:{}, day:{}"
,
teamId
,
currDay
);
String
batchNo
=
batchService
.
buildBatchData2
(
teamId
,
currDay
);
...
...
@@ -90,10 +88,10 @@ public class SchedulerServiceImpl implements SchedulerService {
exporter
.
write
(
solution
,
new
File
(
String
.
format
(
"dispatchSolution_%s_%s.json"
,
teamId
,
currDay
)));
//log.info("dispatchRun group:{}, team:{} done", groupId, teamId);
}
catch
(
Exception
e
)
{
log
.
error
(
">>> (teamId:{}, day:{})自动排班失败:{}"
,
teamId
,
currDay
,
e
.
getMessage
(),
e
);
throw
e
;
}
}
catch
(
Exception
e
)
{
log
.
error
(
">>> (teamId:{})自动排班失败:{}"
,
teamId
,
e
.
getMessage
(),
e
);
throw
e
;
}
}
}
\ No newline at end of file
project-dispatch/src/main/java/com/dituhui/pea/dispatch/service/impl/SolveServiceImpl.java
View file @
e171ae6
...
...
@@ -416,7 +416,6 @@ public class SolveServiceImpl implements SolveService {
saveSolutionToDispatch2
(
teamId
,
batchNo
,
solution
);
}
...
...
project-order/src/main/java/com/dituhui/pea/order/dto/ScheduleEngineerOverviewDynamics.java
View file @
e171ae6
...
...
@@ -6,6 +6,11 @@ import lombok.Data;
public
class
ScheduleEngineerOverviewDynamics
{
/**
* 分站名称
*/
private
String
groupName
;
/**
* 姓名
*/
private
String
name
;
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/ScheduleServiceImpl.java
View file @
e171ae6
...
...
@@ -239,11 +239,18 @@ public class ScheduleServiceImpl implements ScheduleService {
sumElapsed
+=
Objects
.
isNull
(
o
.
getArriveElapsed
())
?
0
:
o
.
getArriveElapsed
();
}
String
groupName
=
""
;
OrgGroupEntity
group
=
orgGroupDao
.
getByGroupId
(
engineer
.
getGroupId
());
if
(
group
!=
null
)
{
groupName
=
group
.
getGroupName
();
}
Map
<
String
,
List
<
OrderInfoEntity
>>
statusGroup
=
orderAppointments
.
stream
().
collect
(
Collectors
.
groupingBy
(
OrderInfoEntity:
:
getServiceStatus
));
List
<
OrderInfoEntity
>
empty
=
new
ArrayList
<>();
Integer
countPending
=
statusGroup
.
getOrDefault
(
"INIT"
,
empty
).
size
()
+
statusGroup
.
getOrDefault
(
"CONTACTED"
,
empty
).
size
()
+
statusGroup
.
getOrDefault
(
"PENDING"
,
empty
).
size
();
ScheduleEngineerOverviewDynamics
dynamics
=
new
ScheduleEngineerOverviewDynamics
();
dynamics
.
setGroupName
(
groupName
);
dynamics
.
setName
(
engineer
.
getName
());
dynamics
.
setEngineerCode
(
engineer
.
getEngineerCode
());
dynamics
.
setPhone
(
engineer
.
getPhone
());
...
...
@@ -310,12 +317,6 @@ public class ScheduleServiceImpl implements ScheduleService {
orders
.
add
(
item
);
}
String
groupName
=
""
;
OrgGroupEntity
group
=
orgGroupDao
.
getByGroupId
(
engineer
.
getGroupId
());
if
(
group
!=
null
)
{
groupName
=
group
.
getGroupName
();
}
ScheduleEngineerOverviewResp
res
=
new
ScheduleEngineerOverviewResp
();
// res.setTitle(String.format("%s_%s_%s_%s_%s", groupName,
// engineer.getName(),
...
...
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