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 dfbe8406
authored
Nov 14, 2023
by
刘鑫
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
https://gitlab.dituhui.com/bsh/project/project
into develop
2 parents
6e0b8abd
dacdcd13
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
59 additions
and
23 deletions
project-dispatch/src/main/java/com/dituhui/pea/dispatch/service/impl/SolveServiceImpl.java
project-interface/src/main/java/com/dituhui/pea/enums/StatusCodeEnum.java
project-order/src/main/java/com/dituhui/pea/order/dto/OrderServiceDetailResp.java
project-order/src/main/java/com/dituhui/pea/order/enums/OrderEventEnum.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderAssignImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderCreateServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderServiceDetailImpl.java
project-order/src/main/java/com/dituhui/pea/order/utils/OrderUtil.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/service/impl/SolveServiceImpl.java
View file @
dfbe840
...
...
@@ -280,16 +280,20 @@ public class SolveServiceImpl implements SolveService {
// technicianList
ArrayList
<
Technician
>
technicianList
=
new
ArrayList
<>();
dispatchEngineerRepo
.
findByTeamIdAndBatchNo
(
teamId
,
batchNo
).
forEach
(
engineer
->
{
Location
location
=
new
Location
(
engineer
.
getId
(),
engineer
.
getEngineerCode
(),
"中心点"
,
StrUtil
.
isEmpty
(
engineer
.
getX
())
?
0
:
Double
.
parseDouble
(
engineer
.
getX
()),
StrUtil
.
isEmpty
(
engineer
.
getY
())
?
0
:
Double
.
parseDouble
(
engineer
.
getY
()));
// Depot depot = new Depot(engineer.getId(), engineer.getEngineerCode(), location, 60 * 8, 60 * 18);
// depotList.add(depot);
// log.debug("组织问题对象, technicianList groupId:{}, batchNo:{}, engineer-code:{}", groupId, batchNo, engineer.getEngineerCode());
// 技术员时间窗
int
[][]
timeWindows
=
engineerCalendarService
.
timeWindows
(
engineer
.
getEngineerCode
(),
teamId
,
LocalDateTimeUtil
.
parseDate
(
currDay
,
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
)));
if
(
null
!=
timeWindows
&&
timeWindows
.
length
>
0
)
{
log
.
info
(
"技术员时间窗, teamId:{}, batchNo:{}, engineerName:{}, timeWindows:{}"
,
teamId
,
batchNo
,
engineer
.
getEngineerName
(),
new
Gson
().
toJson
(
timeWindows
));
// 技术员技能
List
<
String
>
skillList
=
queryEngineerSkills
(
engineer
.
getEngineerCode
());
// log.debug("组织问题对象, technicianList groupId:{}, batchNo:{}, engineer-code:{} , skills:{}", groupId, batchNo, engineer.getEngineerCode(), String.join(";", skillList));
// 距离偏好map
Location
location
=
new
Location
(
engineer
.
getId
(),
engineer
.
getEngineerCode
(),
"中心点"
,
StrUtil
.
isEmpty
(
engineer
.
getX
())
?
0
:
Double
.
parseDouble
(
engineer
.
getX
()),
StrUtil
.
isEmpty
(
engineer
.
getY
())
?
0
:
Double
.
parseDouble
(
engineer
.
getY
()));
Map
<
String
,
Long
>
preferedLoctionDistanceMap
=
new
HashMap
<
String
,
Long
>();
if
(
location
.
getLongitude
()
>
1
&&
location
.
getLatitude
()
>
1
)
{
// 设置了偏好位置
...
...
@@ -301,12 +305,13 @@ public class SolveServiceImpl implements SolveService {
// 未设置,不参与计算
}
//
硬约束:电动车固定40km上限,其他无限制
// 最大距离,
硬约束:电动车固定40km上限,其他无限制
int
maxDistance
=
engineer
.
getMaxDistance
()
*
1000
;
if
(
engineer
.
getVehicleType
()
!=
null
&&
engineer
.
getVehicleType
()
==
2
)
{
maxDistance
=
40
*
1000
;
}
// 技术员出发地
Double
x
=
null
;
Double
y
=
null
;
if
(
ObjectUtil
.
equal
(
engineer
.
getDeparture
(),
DepartureEnum
.
WORK_ADDR
.
getCode
()))
{
...
...
@@ -317,19 +322,19 @@ public class SolveServiceImpl implements SolveService {
y
=
Double
.
parseDouble
(
orgWarehouseInfoEntity
.
getY
());
}
Location
engineerLocation
=
new
Location
(
engineer
.
getId
(),
engineer
.
getEngineerCode
(),
"起点"
,
x
,
y
);
Depot
engineerDepot
=
new
Depot
(
engineer
.
getId
(),
engineer
.
getEngineerCode
(),
engineerLocation
,
60
*
8
,
60
*
18
);
// FIXME 无锡时间窗数据错误,暂时改成固定值
int
[][]
timeWindows
=
engineerCalendarService
.
timeWindows
(
engineer
.
getEngineerCode
(),
teamId
,
LocalDateTimeUtil
.
parseDate
(
currDay
,
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
)));
System
.
err
.
println
(
engineer
.
getEngineerName
()+
" : "
+
new
Gson
().
toJson
(
timeWindows
));
log
.
info
(
engineer
.
getEngineerName
()+
" : "
+
new
Gson
().
toJson
(
timeWindows
));
timeWindows
=
new
int
[][]
{
{
480
,
1080
}
};
Depot
engineerDepot
=
new
Depot
(
engineer
.
getId
(),
engineer
.
getEngineerCode
(),
engineerLocation
,
60
*
8
,
60
*
18
);
Technician
vehicle
=
new
Technician
(
engineer
.
getId
(),
engineer
.
getEngineerCode
(),
engineer
.
getMaxNum
(),
engineer
.
getMaxMinute
(),
maxDistance
,
engineer
.
getVehicleType
(),
engineerDepot
,
timeWindows
,
Set
.
copyOf
(
skillList
),
preferedLoctionDistanceMap
);
Technician
vehicle
=
new
Technician
(
engineer
.
getId
(),
engineer
.
getEngineerCode
(),
engineer
.
getMaxNum
(),
engineer
.
getMaxMinute
(),
maxDistance
,
engineer
.
getVehicleType
(),
engineerDepot
,
timeWindows
,
Set
.
copyOf
(
skillList
),
preferedLoctionDistanceMap
);
technicianList
.
add
(
vehicle
);
}
else
{
// 没有时间窗技术员,不参与派工
log
.
info
(
"技术员时间窗, teamId:{}, batchNo:{}, engineerName:{}, no timeWindows"
,
teamId
,
batchNo
,
engineer
.
getEngineerName
());
}
});
log
.
info
(
"组织问题对象, depotList-list, teamId:{}, batchNo:{}"
,
teamId
,
batchNo
);
log
.
info
(
"组织问题对象, technician-list, teamId:{}, batchNo:{}, technician-list:{}"
,
teamId
,
batchNo
,
technicianList
.
size
());
// locationlist 起点+订单地点
...
...
project-interface/src/main/java/com/dituhui/pea/enums/StatusCodeEnum.java
View file @
dfbe840
...
...
@@ -143,6 +143,8 @@ public enum StatusCodeEnum {
ORDER_RESCHEDULE_BEFORE_TIME
(
"028"
,
"订单不能改约到当前时间以前!"
,
false
),
TEAM_UNMATCHED
(
"029"
,
"工程师没有匹配到工作队"
,
false
),
ORDER_FINISHED
(
"030"
,
"订单已结束,请勿操作"
,
false
),
;
/**
...
...
project-order/src/main/java/com/dituhui/pea/order/dto/OrderServiceDetailResp.java
View file @
dfbe840
...
...
@@ -64,6 +64,8 @@ public class OrderServiceDetailResp {
private
String
expectTimeBegin
;
private
String
expectTimeEnd
;
private
String
expectTimeDesc
;
private
String
source
;
...
...
project-order/src/main/java/com/dituhui/pea/order/enums/OrderEventEnum.java
View file @
dfbe840
...
...
@@ -3,8 +3,8 @@ package com.dituhui.pea.order.enums;
public
enum
OrderEventEnum
{
// 建单,首次指派,改派,取消,改约,放回工单池
createOrder
(
"建单"
,
"%s通过%s创建服务工单:%s"
),
firstAssignment
(
"首次指派"
,
"通过PEA派工给工程师%s"
),
reassignment
(
"
改
派"
,
"通过PEA派工给工程师%s"
),
//
firstAssignment("首次指派", "通过PEA派工给工程师%s"),
reassignment
(
"
指
派"
,
"通过PEA派工给工程师%s"
),
cancel
(
"取消"
,
"%s在线指导解决"
),
recontracting
(
"改约"
,
"工程师%s/%s已改约,改约时间%s,改约原因:%s"
),
backOrderPool
(
"放回工单池"
,
"取消派工"
),
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderAssignImpl.java
View file @
dfbe840
...
...
@@ -194,11 +194,24 @@ public class OrderAssignImpl implements OrderAssign {
if
(
order
==
null
)
{
return
Result
.
failed
(
"订单不存在"
);
}
if
(
order
.
getOrderStatus
().
equals
(
OrderStatusEnum
.
CANCELED
.
getCode
())
||
order
.
getServiceStatus
().
equals
(
ServiceStatusEnum
.
FINISHED
.
getCode
()))
{
return
Result
.
failed
(
StatusCodeEnum
.
ORDER_FINISHED
);
}
OrgTeamEntity
orgTeam
=
orgTeamDao
.
getByTeamId
(
order
.
getOrgTeamId
());
// 判断cutoff
Integer
cutoff
=
CommonUtil
.
isCutoff
(
order
.
getExpectTimeBegin
(),
orgTeam
.
getWorkOff
());
if
(
cutoff
>
0
)
{
// cutoff更新order_request表为人工指派
order
.
setAppointmentStatus
(
AppointmentMethodEnum
.
MANUAL
.
name
());
order
.
setServiceStatus
(
OrderFlowEnum
.
INIT
.
name
());
order
=
OrderUtil
.
handleErrorOrder
(
order
);
order
.
setIsCutoff
(
cutoff
);
}
else
{
// 更新order_request表为未指派
order
.
setAppointmentStatus
(
OrderFlowEnum
.
INIT
.
name
());
order
.
setServiceStatus
(
OrderFlowEnum
.
INIT
.
name
());
order
=
OrderUtil
.
handleErrorOrder
(
order
);
order
=
OrderUtil
.
handleErrorOrder2
(
order
);
}
orderInfoDao
.
save
(
order
);
commonService
.
addOrderEvent
(
orderId
,
""
,
"PEA"
,
"PEA"
,
OrderEventEnum
.
backOrderPool
.
getEvent
(),
OrderEventEnum
.
backOrderPool
.
getMsg
(),
""
);
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderCreateServiceImpl.java
View file @
dfbe840
...
...
@@ -418,7 +418,7 @@ public class OrderCreateServiceImpl implements OrderCreateService {
commonService
.
addOrderEvent
(
orderId
,
""
,
req
.
getSource
(),
"API"
,
OrderEventEnum
.
createOrder
.
getEvent
(),
String
.
format
(
OrderEventEnum
.
createOrder
.
getMsg
(),
req
.
getSource
(),
"BEAN"
,
req
.
getOrderId
()),
""
);
if
(
req
.
getIsAppointEngineer
()
==
1
)
{
commonService
.
addOrderEvent
(
orderId
,
""
,
req
.
getSource
(),
"PEA"
,
OrderEventEnum
.
firstAssignment
.
getEvent
(),
String
.
format
(
OrderEventEnum
.
firstA
ssignment
.
getMsg
(),
engineerName
+
"-"
+
byTeamId
.
getTeamName
()),
""
);
commonService
.
addOrderEvent
(
orderId
,
""
,
req
.
getSource
(),
"PEA"
,
OrderEventEnum
.
reassignment
.
getEvent
(),
String
.
format
(
OrderEventEnum
.
rea
ssignment
.
getMsg
(),
engineerName
+
"-"
+
byTeamId
.
getTeamName
()),
""
);
}
return
Result
.
success
(
null
);
}
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderServiceDetailImpl.java
View file @
dfbe840
...
...
@@ -79,6 +79,7 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
res
.
setSkill
(
order
.
getSkill
());
res
.
setFaultDescribe
(
order
.
getFaultDescribe
());
res
.
setExpectTimeBegin
(
TimeUtils
.
IsoLocalDateTime2String
(
order
.
getExpectTimeBegin
()));
res
.
setExpectTimeEnd
(
TimeUtils
.
IsoLocalDateTime2String
(
order
.
getExpectTimeEnd
()));
res
.
setExpectTimeDesc
(
order
.
getExpectTimeDesc
());
res
.
setSource
(
order
.
getSource
());
res
.
setTags
(
order
.
getTags
());
...
...
project-order/src/main/java/com/dituhui/pea/order/utils/OrderUtil.java
View file @
dfbe840
...
...
@@ -18,4 +18,17 @@ public class OrderUtil {
return
order
;
}
/**
* 分单,超派,特殊时间等处理工单指派工程师,网点等数据
*
* @param order
* @return
*/
public
static
OrderInfoEntity
handleErrorOrder2
(
OrderInfoEntity
order
)
{
order
.
setEngineerPhone
(
null
);
order
.
setEngineerName
(
null
);
order
.
setEngineerCode
(
null
);
return
order
;
}
}
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