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 1a571a4e
authored
Jul 24, 2023
by
张晓
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
order-info 1/3
1 parent
45cabcf0
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
140 additions
and
269 deletions
project-dispatch/src/main/java/com/dituhui/pea/dispatch/dao/DispatchOrderRepository.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/dao/OrderAppointmentRepository.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/dao/OrderInfoRepository.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/dao/OrderRequestRepository.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/entity/DispatchEngineer.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/entity/DispatchOrder.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/entity/EngineerInfo.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/entity/OrderAppointment.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/entity/OrderRequest.java → project-dispatch/src/main/java/com/dituhui/pea/dispatch/entity/OrderInfo.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/service/impl/ExtractServiceImpl.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/dao/DispatchOrderRepository.java
View file @
1a571a4
...
...
@@ -10,12 +10,13 @@ import java.util.Optional;
public
interface
DispatchOrderRepository
extends
CrudRepository
<
DispatchOrder
,
Long
>
{
// 查看未指派非confirm的,供算法计算
@Query
(
"from DispatchOrder where groupId=?1 and batchNo=?2 and status !='CONFIRM' and (engineerCode is null or engineerCode='' ) "
)
List
<
DispatchOrder
>
findNotAssigned
(
String
groupId
,
String
batchNo
);
// 查看算法指派成功且非confirm状态的
@Query
(
"from DispatchOrder where groupId=?1 and batchNo=?2 and status !='CONFIRM' and
engineerCode is not null and engineerCode!=''
"
)
@Query
(
"from DispatchOrder where groupId=?1 and batchNo=?2 and status !='CONFIRM' and
( engineerCode is not null and engineerCode!='')
"
)
List
<
DispatchOrder
>
findAssigned
(
String
groupId
,
String
batchNo
);
Optional
<
DispatchOrder
>
findByGroupIdAndBatchNoAndOrderId
(
String
groupId
,
String
batchNo
,
String
orderId
);
...
...
project-dispatch/src/main/java/com/dituhui/pea/dispatch/dao/OrderAppointmentRepository.java
deleted
100644 → 0
View file @
45cabcf
package
com
.
dituhui
.
pea
.
dispatch
.
dao
;
import
com.dituhui.pea.dispatch.entity.OrderAppointment
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.data.repository.CrudRepository
;
import
java.util.Optional
;
public
interface
OrderAppointmentRepository
extends
CrudRepository
<
OrderAppointment
,
Long
>
{
@Query
(
value
=
"SELECT * FROM order_appointment WHERE order_id=:orderId ORDER BY id DESC LIMIT 1"
,
nativeQuery
=
true
)
Optional
<
OrderAppointment
>
findByOrderId
(
String
orderId
);
}
project-dispatch/src/main/java/com/dituhui/pea/dispatch/dao/OrderInfoRepository.java
0 → 100644
View file @
1a571a4
package
com
.
dituhui
.
pea
.
dispatch
.
dao
;
import
com.dituhui.pea.dispatch.entity.OrderInfo
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.data.repository.CrudRepository
;
import
java.util.Optional
;
public
interface
OrderInfoRepository
extends
CrudRepository
<
OrderInfo
,
Long
>
{
// @Query(value = "SELECT * FROM order_info WHERE order_id=:orderId ORDER BY dt DESC LIMIT 1",nativeQuery = true)
Optional
<
OrderInfo
>
findOrderInfoByOrderIdOrderByDtDesc
(
String
orderId
);
}
project-dispatch/src/main/java/com/dituhui/pea/dispatch/dao/OrderRequestRepository.java
deleted
100644 → 0
View file @
45cabcf
package
com
.
dituhui
.
pea
.
dispatch
.
dao
;
import
com.dituhui.pea.dispatch.entity.OrderRequest
;
import
org.springframework.data.repository.CrudRepository
;
import
java.util.Optional
;
public
interface
OrderRequestRepository
extends
CrudRepository
<
OrderRequest
,
Long
>
{
Optional
<
OrderRequest
>
findByOrderId
(
String
orderId
);
}
project-dispatch/src/main/java/com/dituhui/pea/dispatch/entity/DispatchEngineer.java
View file @
1a571a4
...
...
@@ -28,6 +28,9 @@ public class DispatchEngineer implements Serializable {
@Column
(
name
=
"batch_no"
)
private
String
batchNo
;
@Column
(
name
=
"team_id"
)
private
String
teamId
;
@Column
(
name
=
"engineer_code"
)
private
String
engineerCode
;
...
...
project-dispatch/src/main/java/com/dituhui/pea/dispatch/entity/DispatchOrder.java
View file @
1a571a4
...
...
@@ -30,6 +30,9 @@ public class DispatchOrder implements Serializable {
@Column
(
name
=
"batch_no"
)
private
String
batchNo
;
@Column
(
name
=
"team_id"
)
private
String
teamId
;
@Column
(
name
=
"order_id"
)
private
String
orderId
;
...
...
project-dispatch/src/main/java/com/dituhui/pea/dispatch/entity/EngineerInfo.java
View file @
1a571a4
...
...
@@ -45,11 +45,6 @@ public class EngineerInfo implements Serializable {
private
String
credentials
;
private
Integer
vehicle
;
@Column
(
name
=
"vehicle_no"
)
private
String
vehicleNo
;
@Column
(
name
=
"bean_status"
)
private
Integer
beanStatus
;
...
...
project-dispatch/src/main/java/com/dituhui/pea/dispatch/entity/OrderAppointment.java
deleted
100644 → 0
View file @
45cabcf
package
com
.
dituhui
.
pea
.
dispatch
.
entity
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.databind.annotation.JsonDeserialize
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer
;
import
com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer
;
import
com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer
;
import
com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer
;
import
lombok.Data
;
import
javax.persistence.*
;
import
java.io.Serializable
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
@Data
@Entity
@Table
(
name
=
"order_appointment"
)
public
class
OrderAppointment
implements
Serializable
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Integer
id
;
@Column
(
name
=
"order_id"
)
private
String
orderId
;
@Column
(
name
=
"suborder_id"
)
private
String
suborderId
;
@Column
(
name
=
"main_sub"
)
private
Integer
mainSub
;
@Column
(
name
=
"engineer_code"
)
private
String
engineerCode
;
@Column
(
name
=
"engineer_name"
)
private
String
engineerName
;
@Column
(
name
=
"engineer_phone"
)
private
String
engineerPhone
;
@Column
(
name
=
"engineer_age"
)
private
Integer
engineerAge
;
@Column
(
name
=
"is_workshop"
)
private
Integer
isWorkshop
;
@JsonDeserialize
(
using
=
LocalDateDeserializer
.
class
)
@JsonSerialize
(
using
=
LocalDateSerializer
.
class
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
@Column
(
name
=
"dt"
)
private
LocalDate
dt
;
@JsonDeserialize
(
using
=
LocalDateTimeDeserializer
.
class
)
@JsonSerialize
(
using
=
LocalDateTimeSerializer
.
class
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@Column
(
name
=
"expect_start_time"
)
private
LocalDateTime
expectStartTime
;
@JsonDeserialize
(
using
=
LocalDateTimeDeserializer
.
class
)
@JsonSerialize
(
using
=
LocalDateTimeSerializer
.
class
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@Column
(
name
=
"expect_end_time"
)
private
LocalDateTime
expectEndTime
;
@JsonDeserialize
(
using
=
LocalDateTimeDeserializer
.
class
)
@JsonSerialize
(
using
=
LocalDateTimeSerializer
.
class
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@Column
(
name
=
"actual_time"
)
private
LocalDateTime
actualTime
;
@JsonDeserialize
(
using
=
LocalDateTimeDeserializer
.
class
)
@JsonSerialize
(
using
=
LocalDateTimeSerializer
.
class
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@Column
(
name
=
"actual_start_time"
)
private
LocalDateTime
actualStartTime
;
@JsonDeserialize
(
using
=
LocalDateTimeDeserializer
.
class
)
@JsonSerialize
(
using
=
LocalDateTimeSerializer
.
class
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@Column
(
name
=
"actual_end_time"
)
private
LocalDateTime
actualEndTime
;
@Column
(
name
=
"pre_status"
)
private
String
preStatus
;
private
String
status
;
private
String
memo
;
@JsonDeserialize
(
using
=
LocalDateTimeDeserializer
.
class
)
@JsonSerialize
(
using
=
LocalDateTimeSerializer
.
class
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@Column
(
name
=
"create_time"
)
private
LocalDateTime
createTime
;
@JsonDeserialize
(
using
=
LocalDateTimeDeserializer
.
class
)
@JsonSerialize
(
using
=
LocalDateTimeSerializer
.
class
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@Column
(
name
=
"update_time"
)
private
LocalDateTime
updateTime
;
}
project-dispatch/src/main/java/com/dituhui/pea/dispatch/entity/Order
Request
.java
→
project-dispatch/src/main/java/com/dituhui/pea/dispatch/entity/Order
Info
.java
View file @
1a571a4
package
com
.
dituhui
.
pea
.
dispatch
.
entity
;
import
lombok.Data
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.databind.annotation.JsonDeserialize
;
...
...
@@ -17,20 +18,31 @@ import java.time.LocalDateTime;
@Data
@Entity
@Table
(
name
=
"order_
request
"
)
public
class
Order
Request
implements
Serializable
{
@Table
(
name
=
"order_
info
"
)
public
class
Order
Info
implements
Serializable
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
String
id
;
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Integer
id
;
@Column
(
name
=
"order_id"
)
private
String
orderId
;
private
java
.
sql
.
Date
dt
;
@Column
(
name
=
"sub_id"
)
private
String
subId
;
private
String
name
;
private
String
phone
;
private
String
province
;
private
String
city
;
private
String
county
;
private
String
address
;
@Column
(
name
=
"x"
)
...
...
@@ -39,11 +51,8 @@ public class OrderRequest implements Serializable {
@Column
(
name
=
"y"
)
private
String
Y
;
private
String
province
;
private
String
city
;
private
String
county
;
@Column
(
name
=
"bean_brand"
)
private
String
beanBrand
;
private
String
brand
;
...
...
@@ -51,19 +60,17 @@ public class OrderRequest implements Serializable {
private
String
skill
;
@Column
(
name
=
"apply_note"
)
private
String
applyNote
;
@Column
(
name
=
"take_time"
)
private
Integer
takeTime
;
@Column
(
name
=
"is_workshop"
)
private
Integer
isWorkshop
;
@Column
(
name
=
"fault_describe"
)
private
String
faultDescribe
;
@JsonDeserialize
(
using
=
LocalDateDeserializer
.
class
)
@JsonSerialize
(
using
=
LocalDateSerializer
.
class
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
@Column
(
name
=
"dt"
)
private
LocalDate
dt
;
@Column
(
name
=
"apply_note"
)
private
String
applyNote
;
@JsonDeserialize
(
using
=
LocalDateTimeDeserializer
.
class
)
@JsonSerialize
(
using
=
LocalDateTimeSerializer
.
class
)
...
...
@@ -82,53 +89,96 @@ public class OrderRequest implements Serializable {
private
String
source
;
@Column
(
name
=
"bean_priority"
)
private
String
beanPriority
;
@Column
(
name
=
"bean_tags"
)
private
String
beanTags
;
@Column
(
name
=
"bean_status"
)
private
String
beanStatus
;
@Column
(
name
=
"bean_sub_status"
)
private
String
beanSubStatus
;
@Column
(
name
=
"area_id"
)
private
String
areaId
;
@Column
(
name
=
"order_priority"
)
private
String
orderPriority
;
@Column
(
name
=
"org_cluster_id"
)
private
String
orgClusterId
;
@Column
(
name
=
"org_branch_id"
)
private
String
orgBranchId
;
@Column
(
name
=
"order_tags"
)
private
String
orderTags
;
@Column
(
name
=
"org_group_id"
)
private
String
orgGroupId
;
@Column
(
name
=
"org_team_id"
)
private
String
orgTeamId
;
private
Integer
priority
;
private
String
tags
;
private
String
status
;
@Column
(
name
=
"appointment_method"
)
private
String
appointmentMethod
;
@Column
(
name
=
"appointment_status"
)
private
String
appointmentStatus
;
@Column
(
name
=
"
appointment_method
"
)
private
String
appointmentMethod
;
@Column
(
name
=
"
order_status
"
)
private
String
orderStatus
;
@Column
(
name
=
"
org_cluster_id
"
)
private
String
orgClusterId
;
@Column
(
name
=
"
service_status
"
)
private
String
serviceStatus
;
@Column
(
name
=
"
org_cluster_nam
e"
)
private
String
orgClusterNam
e
;
@Column
(
name
=
"
engineer_cod
e"
)
private
String
engineerCod
e
;
@Column
(
name
=
"
org_branch_id
"
)
private
String
orgBranchId
;
@Column
(
name
=
"
engineer_name
"
)
private
String
engineerName
;
@Column
(
name
=
"
org_branch_nam
e"
)
private
String
orgBranchNam
e
;
@Column
(
name
=
"
engineer_phon
e"
)
private
String
engineerPhon
e
;
@Column
(
name
=
"
org_group_id
"
)
private
String
orgGroupId
;
@Column
(
name
=
"
engineer_code_sub
"
)
private
String
engineerCodeSub
;
@Column
(
name
=
"org_group_name"
)
private
String
orgGroupName
;
@JsonDeserialize
(
using
=
LocalDateTimeDeserializer
.
class
)
@JsonSerialize
(
using
=
LocalDateTimeSerializer
.
class
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@Column
(
name
=
"plan_start_time"
)
private
LocalDateTime
planStartTime
;
@Column
(
name
=
"org_team_id"
)
private
String
orgTeamId
;
@JsonDeserialize
(
using
=
LocalDateTimeDeserializer
.
class
)
@JsonSerialize
(
using
=
LocalDateTimeSerializer
.
class
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@Column
(
name
=
"plan_end_time"
)
private
LocalDateTime
planEndTime
;
@Column
(
name
=
"arrive_elapsed"
)
private
Integer
arriveElapsed
;
@Column
(
name
=
"org_team_name"
)
private
String
orgTeamName
;
@Column
(
name
=
"arrive_distance"
)
private
Integer
arriveDistance
;
@JsonDeserialize
(
using
=
LocalDateTimeDeserializer
.
class
)
@JsonSerialize
(
using
=
LocalDateTimeSerializer
.
class
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@Column
(
name
=
"actual_start_time"
)
private
LocalDateTime
actualStartTime
;
@JsonDeserialize
(
using
=
LocalDateTimeDeserializer
.
class
)
@JsonSerialize
(
using
=
LocalDateTimeSerializer
.
class
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@Column
(
name
=
"actual_end_time"
)
private
LocalDateTime
actualEndTime
;
private
String
description
;
@Column
(
name
=
"extra_info"
)
private
String
extraInfo
;
@JsonDeserialize
(
using
=
LocalDateTimeDeserializer
.
class
)
@JsonSerialize
(
using
=
LocalDateTimeSerializer
.
class
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
...
...
project-dispatch/src/main/java/com/dituhui/pea/dispatch/service/impl/ExtractServiceImpl.java
View file @
1a571a4
...
...
@@ -43,10 +43,8 @@ public class ExtractServiceImpl implements ExtractService {
DispatchOrderRepository
dispatchOrderRepo
;
@Autowired
Order
RequestRepository
orderRequest
Repo
;
Order
InfoRepository
orderInfo
Repo
;
@Autowired
OrderAppointmentRepository
orderAppointmentRepo
;
@Autowired
OrderLogRepository
orderLogRepo
;
...
...
@@ -87,18 +85,24 @@ public class ExtractServiceImpl implements ExtractService {
log
.
info
(
"算法结果更新到工单, step1.1-loop, {}/{}, groupId:{}, batchNo:{}, orderId:{}, engCode:{}"
,
idx
,
dispatchOrderList
.
size
(),
groupId
,
batchNo
,
orderId
,
engCode
);
Optional
<
Order
Request
>
orderOpt
=
orderRequestRepo
.
findByOrderId
(
orderId
);
Optional
<
Order
Info
>
orderOpt
=
orderInfoRepo
.
findOrderInfoByOrderIdOrderByDtDesc
(
orderId
);
if
(!
orderOpt
.
isPresent
())
{
log
.
warn
(
"算法结果更新到工单, step1.1-loop, 工单不存在, groupId:{}, batchNo:{}, orderId:{}"
,
groupId
,
batchNo
,
orderId
);
return
;
}
OrderRequest
orderRequest
=
orderOpt
.
get
();
OrderInfo
orderInfo
=
orderOpt
.
get
();
if
(!(
"OPEN"
.
equals
(
orderInfo
.
getBeanStatus
())
&&
Set
.
of
(
"AUTO_NOW"
,
"AUTO_BATCH"
).
contains
(
orderInfo
.
getAppointmentMethod
())
&&
Set
.
of
(
"INIT"
,
"VIRTUAL"
,
"PRE"
).
contains
(
orderInfo
.
getAppointmentStatus
())
&&
"NORMAL"
.
equals
(
orderInfo
.
getOrderStatus
())
&&
"INIT"
.
equals
(
orderInfo
.
getServiceStatus
())
if
(!(
"OPEN"
.
equals
(
orderRequest
.
getStatus
())
&&
Set
.
of
(
"ASSIGNED"
,
"NOT_ASSIGNED"
).
contains
(
orderRequest
.
getAppointmentStatus
())
))
{
log
.
warn
(
"算法结果更新到工单, step1.1-loop, 工单状态异常, groupId:{}, batchNo:{}, orderId:{},
status:{}, appointment
-status:{}"
,
groupId
,
batchNo
,
orderId
,
order
Request
.
getStatus
(),
orderRequest
.
getAppointment
Status
());
))
{
log
.
warn
(
"算法结果更新到工单, step1.1-loop, 工单状态异常, groupId:{}, batchNo:{}, orderId:{},
bean-status:{}, appointment-status:{}, order-status:{}, service
-status:{}"
,
groupId
,
batchNo
,
orderId
,
order
Info
.
getBeanStatus
(),
orderInfo
.
getAppointmentStatus
(),
orderInfo
.
getOrderStatus
(),
orderInfo
.
getService
Status
());
return
;
}
...
...
@@ -111,102 +115,38 @@ public class ExtractServiceImpl implements ExtractService {
}
String
engName
=
engineerInfo
.
getName
();
String
phone
=
engineerInfo
.
getPhone
();
int
age
=
0
;
/*
int age = 0;
if (!StringUtils.isNullOrEmpty(engineerInfo.getBirth())) {
DateTime birthDate = DateUtil.parse(engineerInfo.getBirth(), "yyyy-MM-dd");
age = DateUtil.age(birthDate.toJdkDate(), DateUtil.date());
}
}
*/
if
(
"NOT_ASSIGNED"
.
equals
(
order
Request
.
getAppointmentStatus
()))
{
if
(
"NOT_ASSIGNED"
.
equals
(
order
Info
.
getAppointmentStatus
()))
{
jdbcTemplate
.
update
(
"update order_request set appointment_status ='ASSIGNED' where order_id =? and appointment_status='NOT_ASSIGNED'"
,
orderId
);
}
// 会有多次上门情况( pre_status='PRE' and status in ('NOT_ASSIGNED', 'ASSIGNED') ,直接更新,其它情况新增)
Optional
<
OrderAppointment
>
appointmentOpt
=
orderAppointmentRepo
.
findByOrderId
(
orderId
);
if
(
appointmentOpt
.
isEmpty
())
{
// 没有则插入一条
OrderAppointment
appointment
=
new
OrderAppointment
();
appointment
.
setOrderId
(
orderId
);
String
subId
=
String
.
format
(
"%s_%s"
,
orderId
,
DateUtil
.
format
(
LocalDateTime
.
now
(),
"yyyyMMddHHmmss"
));
appointment
.
setSuborderId
(
subId
);
appointment
.
setMainSub
(
1
);
appointment
.
setEngineerCode
(
engCode
);
appointment
.
setEngineerName
(
engName
);
appointment
.
setEngineerPhone
(
phone
);
appointment
.
setEngineerAge
(
age
);
appointment
.
setIsWorkshop
(
0
);
appointment
.
setDt
(
orderRequest
.
getDt
());
appointment
.
setExpectStartTime
(
dispatchOrder
.
getTimeBegin
());
appointment
.
setExpectEndTime
(
dispatchOrder
.
getTimeEnd
());
appointment
.
setPreStatus
(
isConfirm
?
"CONFIRM"
:
"PRE"
);
appointment
.
setStatus
(
"ASSIGNED"
);
appointment
.
setMemo
(
""
);
appointment
.
setCreateTime
(
LocalDateTime
.
now
());
appointment
.
setUpdateTime
(
LocalDateTime
.
now
());
orderAppointmentRepo
.
save
(
appointment
);
// 写order_log
OrderLog
orderLog
=
new
OrderLog
().
setOrderId
(
orderId
).
setSuborderId
(
subId
).
setSource
(
"PEA-DISPATCH"
).
setOperator
(
"DISPATCH"
)
.
setContent
(
String
.
format
(
"批量自动指派:<%s,%s>"
,
engCode
,
engName
)).
setContentOld
(
""
)
.
setMemo
(
"批量自动指派"
).
setCreateTime
(
LocalDateTime
.
now
()).
setUpdateTime
(
LocalDateTime
.
now
());
orderLogRepo
.
save
(
orderLog
);
orderInfo
.
setEngineerCode
(
engCode
);
orderInfo
.
setEngineerName
(
engName
);
orderInfo
.
setEngineerPhone
(
phone
);
orderInfo
.
setPlanStartTime
(
dispatchOrder
.
getTimeBegin
());
orderInfo
.
setPlanEndTime
(
dispatchOrder
.
getTimeEnd
());
orderInfo
.
setAppointmentStatus
(
isConfirm
?
"CONFIRM"
:
"PRE"
);
orderInfo
.
setUpdateTime
(
LocalDateTime
.
now
());
orderInfoRepo
.
save
(
orderInfo
);
if
(
isConfirm
)
{
OrderEvent
orderEvent
=
new
OrderEvent
().
setOrderId
(
orderId
).
setSuborderId
(
subId
).
setHappen
(
LocalDateTime
.
now
())
.
setEvent
(
"批量自动指派"
).
setOperator
(
"DISPATCH"
).
setOperatorName
(
"算法批量指派"
).
setSource
(
"PEA-DISPATCH"
)
.
setDescription
(
String
.
format
(
"批量自动指派:<%s,%s>"
,
engCode
,
engName
)).
setMemo
(
""
)
.
setCreateTime
(
LocalDateTime
.
now
()).
setUpdateTime
(
LocalDateTime
.
now
());
orderEventRepo
.
save
(
orderEvent
);
}
}
else
{
// 如果有记录:1虚拟指派 2排量预派 3
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
());
appointment
.
setStatus
(
"ASSIGNED"
);
appointment
.
setPreStatus
(
isConfirm
?
"CONFIRM"
:
"PRE"
);
appointment
.
setEngineerCode
(
engCode
);
appointment
.
setEngineerName
(
engName
);
appointment
.
setEngineerPhone
(
phone
);
appointment
.
setEngineerAge
(
age
);
appointment
.
setDt
(
orderRequest
.
getDt
());
appointment
.
setExpectStartTime
(
dispatchOrder
.
getTimeBegin
());
appointment
.
setExpectEndTime
(
dispatchOrder
.
getTimeEnd
());
appointment
.
setUpdateTime
(
LocalDateTime
.
now
());
orderAppointmentRepo
.
save
(
appointment
);
if
(
null
==
appointment
.
getSuborderId
())
{
appointment
.
setSuborderId
(
appointment
.
getOrderId
());
}
OrderLog
orderLog
=
new
OrderLog
().
setOrderId
(
orderId
).
setSuborderId
(
appointment
.
getSuborderId
()).
setSource
(
"PEA-DISPATCH"
).
setOperator
(
"DISPATCH"
)
.
setContent
(
String
.
format
(
"批量自动指派:<%s,%s>"
,
engCode
,
engName
)).
setContentOld
(
lastContent
)
OrderLog
orderLog
=
new
OrderLog
().
setOrderId
(
orderId
).
setSuborderId
(
orderInfo
.
getSubId
()).
setSource
(
"PEA-DISPATCH"
).
setOperator
(
"DISPATCH"
)
.
setContent
(
String
.
format
(
"批量自动指派:<%s,%s>"
,
engCode
,
engName
)).
setContentOld
(
""
)
.
setMemo
(
"批量自动指派"
).
setCreateTime
(
LocalDateTime
.
now
()).
setUpdateTime
(
LocalDateTime
.
now
());
orderLogRepo
.
save
(
orderLog
);
if
(
isConfirm
)
{
OrderEvent
orderEvent
=
new
OrderEvent
().
setOrderId
(
orderId
).
setSuborderId
(
appointment
.
getSuborder
Id
()).
setHappen
(
LocalDateTime
.
now
())
OrderEvent
orderEvent
=
new
OrderEvent
().
setOrderId
(
orderId
).
setSuborderId
(
orderInfo
.
getSub
Id
()).
setHappen
(
LocalDateTime
.
now
())
.
setEvent
(
"批量自动指派"
).
setOperator
(
"DISPATCH"
).
setOperatorName
(
"算法批量指派"
).
setSource
(
"PEA-DISPATCH"
)
.
setDescription
(
String
.
format
(
"批量自动指派:<%s,%s>"
,
engCode
,
engName
)).
setMemo
(
""
)
.
setCreateTime
(
LocalDateTime
.
now
()).
setUpdateTime
(
LocalDateTime
.
now
());
orderEventRepo
.
save
(
orderEvent
);
}
}
else
{
// 其它情况待补充(改约) todo
if
(
Set
.
of
(
"CONFIRM"
).
contains
(
appointmentOpt
.
get
().
getPreStatus
())
&&
Set
.
of
(
"TODO"
,
"???"
).
contains
(
appointmentOpt
.
get
().
getStatus
()))
{
}
}
}
});
log
.
info
(
"算法结果更新到工单完成, groupId:{}, batchNo:{}"
,
groupId
,
batchNo
);
...
...
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