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 a98de2b6
authored
Nov 09, 2023
by
huangjinxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:G改约原因增加技能变更,
1 parent
04cc1926
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
302 additions
and
87 deletions
project-order/src/main/java/com/dituhui/pea/order/constant/OrderReschedulingReason.java
project-order/src/main/java/com/dituhui/pea/order/dto/OrderReschedule.java
project-order/src/main/java/com/dituhui/pea/order/dto/param/OrderDTO.java
project-order/src/main/java/com/dituhui/pea/order/entity/OrderInfoEntity.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/BeanRemoteServiceImpl.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/OrderInfoServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/utils/CommonUtil.java
project-order/src/main/java/com/dituhui/pea/order/constant/OrderReschedulingReason.java
0 → 100644
View file @
a98de2b
package
com
.
dituhui
.
pea
.
order
.
constant
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 改约原因常量
*/
public
class
OrderReschedulingReason
{
public
static
Map
<
String
,
List
<
String
>>
ReschedulingReasonMap
=
new
HashMap
<>()
{
{
put
(
"服务设备/工具相关"
,
new
ArrayList
<>()
{
{
add
(
"缺少常用必备工具"
);
add
(
"交通工具不可用"
);
}
});
put
(
"服务物料/配件相关"
,
new
ArrayList
<>()
{
{
add
(
"配件准备错误"
);
add
(
"配件未到货"
);
add
(
"加单服务,没有所需配件"
);
add
(
"缺少可用的安装类附件"
);
add
(
"缺少可用的清洁类产品"
);
add
(
"缺少可用的清洁类产品"
);
add
(
"缺少可用的消耗品(生料带、鞋套等)"
);
add
(
"缺少服务所需纸质工单"
);
}
});
put
(
"服务政策/流程相关"
,
new
ArrayList
<>()
{
{
add
(
"超派"
);
add
(
"重复单(工程师发起申请按钮,由CC校验取消)"
);
add
(
"服务指派不准确"
);
add
(
"转入车间服务流程"
);
add
(
"退换机方案沟通中"
);
add
(
"不接受退换机政策"
);
add
(
"用户考虑费用问题"
);
add
(
"用户不认可收费标准"
);
add
(
"用户考虑安装/维修方案"
);
add
(
"用户不接受维修标准"
);
add
(
"用户考虑软性故障相关解释"
);
add
(
"没有相关安装/维修操作指导(不提供此服务)"
);
}
});
put
(
"安装、维修环境(极端天气)"
,
new
ArrayList
<>()
{
{
add
(
"安装、维修环境不符"
);
add
(
"极端天气,无法正常上门"
);
}
});
put
(
"服务关联人员相关"
,
new
ArrayList
<>()
{
{
add
(
"预约排期问题"
);
add
(
"用户希望更换其他工程师上门"
);
add
(
"服务工程师技能不符"
);
add
(
"突发的事件导致工程师无法上门(如请假、生病、事故)"
);
add
(
"等待支持岗位(投诉组、分部、技术支持)提供方案"
);
add
(
"拉修/退换机的物流服务不到位"
);
add
(
"售前送货的物流服务不到位"
);
}
});
put
(
"暂无法关单,初始服务已完成"
,
new
ArrayList
<>()
{
{
add
(
"用户希望观察使用一段时间"
);
add
(
"用户本人不在现场"
);
add
(
"TSS软件系统故障"
);
add
(
"配件代码未维护进系统"
);
}
});
put
(
"用户相关"
,
new
ArrayList
<>()
{
{
add
(
"用户不接电话且已短信通知用户(改约3次以内)"
);
add
(
"3天6次未联系上用户"
);
add
(
"无法满足消费者夜间上门需求(非加单)"
);
add
(
"用户期望的服务时间与其他用户冲突"
);
add
(
"上门前得知外部人员已服务"
);
add
(
"用户要求自行来分部购买配/附件(仅仓管可选)"
);
add
(
"机器已退/换,不再需要上门服务(仅行政/用户/CC可选)"
);
add
(
"非BSH产品"
);
add
(
"用户主动提出往后改约(必须短信通知用户)"
);
add
(
"机器故障已消除(仅行政/用户/CC可选)"
);
add
(
"消费者希望提前上门"
);
}
});
put
(
"其它原因"
,
new
ArrayList
<>()
{
{
}
});
}
};
}
project-order/src/main/java/com/dituhui/pea/order/dto/OrderReschedule.java
View file @
a98de2b
...
...
@@ -3,6 +3,8 @@ package com.dituhui.pea.order.dto;
import
com.dituhui.pea.order.dto.param.Location
;
import
lombok.Data
;
import
javax.validation.constraints.NotBlank
;
@Data
public
class
OrderReschedule
{
private
String
orderId
;
...
...
@@ -23,4 +25,27 @@ public class OrderReschedule {
* 备注
*/
private
String
description
;
/**
* 设备品牌(博世/西门子)
*/
private
String
brand
;
/**
* 产品类别
*/
private
String
productType
;
/**
* 服务类型
*/
private
String
serviceType
;
/**
* 改约原因
*/
private
String
reschedulingReason
;
}
project-order/src/main/java/com/dituhui/pea/order/dto/param/OrderDTO.java
View file @
a98de2b
...
...
@@ -199,6 +199,26 @@ public class OrderDTO {
*/
private
Location
happenLocation
;
/**
* 设备品牌(博世/西门子)
*/
private
String
brand
;
/**
* 产品类别
*/
private
String
productType
;
/**
* 服务类型
*/
private
String
serviceType
;
/**
* 改约原因
*/
private
String
reschedulingReason
;
}
/**
...
...
project-order/src/main/java/com/dituhui/pea/order/entity/OrderInfoEntity.java
View file @
a98de2b
...
...
@@ -240,4 +240,10 @@ public class OrderInfoEntity {
*/
@Column
(
name
=
"is_cutoff"
)
private
Integer
isCutoff
=
0
;
/**
* 改约原因
*/
@Column
(
name
=
"rescheduling_reason"
)
private
String
reschedulingReason
;
}
project-order/src/main/java/com/dituhui/pea/order/service/impl/BeanRemoteServiceImpl.java
View file @
a98de2b
...
...
@@ -234,7 +234,9 @@ public class BeanRemoteServiceImpl {
}
Department
data
=
departmentBeanR
.
getData
();
//处理大区,分部数据
if
(
StringUtils
.
isNotBlank
(
data
.
getDeptLevel
()))
{
if
(
StringUtils
.
isBlank
(
data
.
getDeptLevel
()))
{
return
Result
.
failed
(
"组织级别不能为空"
);
}
if
(
data
.
getDeptLevel
().
equals
(
BeanOrgLevelEnum
.
REGION
.
getCode
()))
{
OrgClusterEntity
clusterEntity
=
orgClusterDao
.
getByClusterId
(
data
.
getId
());
if
(
ObjUtil
.
isNull
(
clusterEntity
))
{
...
...
@@ -252,7 +254,8 @@ public class BeanRemoteServiceImpl {
clusterEntity
.
setReserveTimeMax
(
data
.
getPartReserveTimeMax
());
clusterEntity
.
setBsDeptId
(
data
.
getBsDeptId
());
orgClusterDao
.
save
(
clusterEntity
);
}
else
if
(
data
.
getDeptLevel
().
equals
(
BeanOrgLevelEnum
.
BRANCH
.
getCode
()))
{
}
if
(
data
.
getDeptLevel
().
equals
(
BeanOrgLevelEnum
.
BRANCH
.
getCode
()))
{
OrgBranchEntity
branchEntity
=
orgBranchDao
.
getByBranchId
(
data
.
getId
());
if
(
ObjUtil
.
isNull
(
branchEntity
))
{
branchEntity
=
new
OrgBranchEntity
();
...
...
@@ -273,10 +276,8 @@ public class BeanRemoteServiceImpl {
orgBranchDao
.
save
(
branchEntity
);
branchMap
.
put
(
data
.
getBsDeptId
(),
branchEntity
);
}
}
if
((
data
.
getDeptLevel
().
equalsIgnoreCase
(
BeanOrgLevelEnum
.
STATION
.
getCode
())))
{
//处理分站外围数据
if
(
StringUtils
.
isNotBlank
(
data
.
getDeptType
())
&&
(
data
.
getDeptType
().
equals
(
BeanOrgLevelEnum
.
STATION
.
getCode
())
||
data
.
getDeptType
().
equals
(
BeanOrgLevelEnum
.
PERIPHERY
.
getCode
())))
{
OrgGroupEntity
groupEntity
=
orgGroupDao
.
getByGroupId
(
data
.
getId
());
if
(
ObjUtil
.
isNull
(
groupEntity
))
{
groupEntity
=
new
OrgGroupEntity
();
...
...
@@ -371,7 +372,7 @@ public class BeanRemoteServiceImpl {
//处理分站外围
groupEntity
.
setKind
(
CollectionUtils
.
isEmpty
(
data
.
getType
())
?
4
:
BeanPointTypeEnum
.
getTypeByClazz
(
data
.
getType
().
get
(
0
)));
groupEntity
.
setCategory
(
2
);
groupEntity
.
setAddress
(
data
.
getBusinessAddress
().
getA
ddress
());
groupEntity
.
setAddress
(
data
.
getBusinessAddress
().
getA
ll
());
groupEntity
.
setX
(
data
.
getBusinessAddress
().
getLongitude
());
groupEntity
.
setY
(
data
.
getBusinessAddress
().
getLatitude
());
orgGroupDao
.
save
(
groupEntity
);
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderCreateServiceImpl.java
View file @
a98de2b
...
...
@@ -141,11 +141,14 @@ public class OrderCreateServiceImpl implements OrderCreateService {
orderId
=
s
.
substring
(
s
.
length
()
-
9
);
}
OrderInfoEntity
byOrderId
=
orderInfoDao
.
getByOrderId
(
req
.
getOrderId
());
String
peaBrand
=
fixBrand
(
req
.
getBrand
());
if
(
ObjectUtil
.
isNotNull
(
byOrderId
))
{
return
Result
.
failed
(
StatusCodeEnum
.
ORDER_EXISTS
);
}
String
peaBrand
=
fixBrand
(
req
.
getBrand
());
SkillInfoEntity
skillInfoEntity
=
skillInfoDao
.
getByBrandAndTypeAndSkill
(
peaBrand
,
req
.
getProductType
(),
req
.
getServiceType
());
if
(
ObjectUtil
.
isNull
(
skillInfoEntity
))
{
return
Result
.
failed
(
StatusCodeEnum
.
ORDER_SKILL_NOT_EXISTS
);
}
Location
location
=
req
.
getLocation
();
//预处理字段
entity
.
setExpectTimeBegin
(
DateUtil
.
fromDate
(
req
.
getExpectBegin
()));
...
...
@@ -179,7 +182,7 @@ public class OrderCreateServiceImpl implements OrderCreateService {
engineerName
=
engineerInfo
.
getName
();
entity
.
setEngineerName
(
engineerInfo
.
getName
());
entity
.
setEngineerPhone
(
engineerInfo
.
getPhone
());
entity
.
setEngineer
Phone
(
engineerInfo
.
getPhon
e
());
entity
.
setEngineer
Code
(
engineerInfo
.
getEngineerCod
e
());
entity
.
setOrgClusterId
(
byTeamId
.
getClusterId
());
entity
.
setOrgBranchId
(
byTeamId
.
getBranchId
());
entity
.
setOrgGroupId
(
byTeamId
.
getGroupId
());
...
...
@@ -189,7 +192,7 @@ public class OrderCreateServiceImpl implements OrderCreateService {
//特殊时间段
Integer
special
=
CommonUtil
.
isSpecial
(
entity
.
getExpectTimeBegin
().
toLocalTime
(),
entity
.
getExpectTimeEnd
().
toLocalTime
(),
byTeamId
.
getWorkOn
(),
byTeamId
.
getWorkOff
());
Integer
cutoff
=
CommonUtil
.
isCutoff
(
LocalDateTime
.
now
(),
byTeamId
.
getWorkOff
());
Integer
cutoff
=
CommonUtil
.
isCutoff
(
entity
.
getExpectTimeBegin
(),
byTeamId
.
getWorkOff
());
entity
.
setIsCutoff
(
cutoff
);
entity
.
setIsSpecialTime
(
special
);
}
else
{
...
...
@@ -210,7 +213,7 @@ public class OrderCreateServiceImpl implements OrderCreateService {
//发送通知分部消息
sendMsg
(
branchEntity
.
getBranchId
(),
orderId
,
entity
.
getExpectTimeBegin
().
toLocalDate
());
Integer
cutoff
=
CommonUtil
.
isCutoff
(
LocalDateTime
.
now
(),
null
);
Integer
cutoff
=
CommonUtil
.
isCutoff
(
entity
.
getExpectTimeBegin
(),
null
);
entity
.
setIsCutoff
(
cutoff
);
}
else
{
// 根据分单工作队,填写clusterId/branchId/groupId/teamId等
...
...
@@ -223,7 +226,7 @@ public class OrderCreateServiceImpl implements OrderCreateService {
//特殊时间段
Integer
special
=
CommonUtil
.
isSpecial
(
entity
.
getExpectTimeBegin
().
toLocalTime
(),
entity
.
getExpectTimeEnd
().
toLocalTime
(),
teamInfo
.
getWorkOn
(),
teamInfo
.
getWorkOff
());
Integer
cutoff
=
CommonUtil
.
isCutoff
(
LocalDateTime
.
now
(),
teamInfo
.
getWorkOff
());
Integer
cutoff
=
CommonUtil
.
isCutoff
(
entity
.
getExpectTimeBegin
(),
teamInfo
.
getWorkOff
());
// 处理cutoff 动态排班结束后创建的当日单和次日单
boolean
isTomorrow
=
DateUtil
.
judgeTimeIsisTomorrow
(
entity
.
getExpectTimeBegin
());
//次日单自动批量
...
...
@@ -272,8 +275,6 @@ public class OrderCreateServiceImpl implements OrderCreateService {
entity
.
setWorkshop
(
false
);
// 处理技能和标签
SkillInfoEntity
skillInfoEntity
=
skillInfoDao
.
getByBrandAndTypeAndSkill
(
peaBrand
,
req
.
getProductType
(),
req
.
getServiceType
());
assert
skillInfoEntity
!=
null
;
entity
.
setTakeTime
(
skillInfoEntity
.
getTakeTime
());
String
joinTags
=
CollectionUtils
.
isEmpty
(
req
.
getOrderTags
())
?
""
:
String
.
join
(
","
,
req
.
getOrderTags
());
entity
.
setBeanTags
(
joinTags
);
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderInfoServiceImpl.java
View file @
a98de2b
...
...
@@ -7,17 +7,11 @@ import com.dituhui.pea.common.Result;
import
com.dituhui.pea.common.ResultEnum
;
import
com.dituhui.pea.enums.StatusCodeEnum
;
import
com.dituhui.pea.order.common.TimeUtils
;
import
com.dituhui.pea.order.dao.OrderInfoDao
;
import
com.dituhui.pea.order.dao.OrgBranchDao
;
import
com.dituhui.pea.order.dao.OrgGroupDao
;
import
com.dituhui.pea.order.dao.SkillInfoDao
;
import
com.dituhui.pea.order.dao.*
;
import
com.dituhui.pea.order.dto.MsgDTO
;
import
com.dituhui.pea.order.dto.OrderReschedule
;
import
com.dituhui.pea.order.dto.param.*
;
import
com.dituhui.pea.order.entity.OrderInfoEntity
;
import
com.dituhui.pea.order.entity.OrgBranchEntity
;
import
com.dituhui.pea.order.entity.OrgGroupEntity
;
import
com.dituhui.pea.order.entity.SkillInfoEntity
;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.enums.AppointmentMethodEnum
;
import
com.dituhui.pea.order.enums.BeanServiceFlowEnum
;
import
com.dituhui.pea.order.enums.OrderStatusEnum
;
...
...
@@ -70,6 +64,9 @@ public class OrderInfoServiceImpl implements OrderInfoService {
@Autowired
private
OrgGroupDao
orgGroupDao
;
@Autowired
private
OrgTeamDao
orgTeamDao
;
/**
* 新增订单处理一家多单逻辑
...
...
@@ -168,7 +165,7 @@ public class OrderInfoServiceImpl implements OrderInfoService {
orderInfo
.
setDescription
(
request
.
getDescription
());
}
//处理一家多单逻辑
Result
<
String
>
deleteMultipleOrders
=
this
.
deleteMultipleOrders
(
orderInfo
.
getMultipleOrders
(),
orderInfo
.
get
Address
Id
());
Result
<
String
>
deleteMultipleOrders
=
this
.
deleteMultipleOrders
(
orderInfo
.
getMultipleOrders
(),
orderInfo
.
get
Order
Id
());
if
(!
deleteMultipleOrders
.
getCode
().
equals
(
ResultEnum
.
SUCCESS
.
getCode
()))
{
throw
new
BusinessException
(
"改约日期失败"
);
}
...
...
@@ -179,24 +176,16 @@ public class OrderInfoServiceImpl implements OrderInfoService {
//组装改约接口
OrderReschedule
reschedule
=
new
OrderReschedule
();
reschedule
.
setOrderId
(
orderInfo
.
getOrderId
());
reschedule
.
setHappenLocation
(
request
.
getHappenLocation
());
reschedule
.
setOrderId
(
orderInfo
.
getOrderId
());
reschedule
.
setBrand
(
request
.
getBrand
());
reschedule
.
setProductType
(
request
.
getProductType
());
reschedule
.
setServiceType
(
request
.
getServiceType
());
reschedule
.
setReschedulingReason
(
request
.
getReschedulingReason
());
reschedule
.
setExpectBegin
(
DateUtil
.
handleDate
(
request
.
getNewReservationTime
(),
orderInfo
.
getExpectTimeBegin
()));
reschedule
.
setExpectEnd
(
DateUtil
.
handleDate
(
request
.
getNewReservationTime
(),
orderInfo
.
getExpectTimeEnd
()));
Location
location
=
request
.
getHappenLocation
();
if
(
ObjectUtil
.
isNull
(
location
))
{
location
=
new
Location
();
location
.
setLongitude
(
Double
.
valueOf
(
orderInfo
.
getX
()));
location
.
setLatitude
(
Double
.
valueOf
(
orderInfo
.
getY
()));
location
.
setAddress
(
orderInfo
.
getAddress
());
location
.
setAddressId
(
orderInfo
.
getAddressId
());
}
else
{
orderInfo
.
setX
(
location
.
getLongitude
().
toString
());
orderInfo
.
setY
(
location
.
getLatitude
().
toString
());
orderInfo
.
setAddress
(
location
.
getAddress
());
orderInfo
.
setAddressId
(
location
.
getAddressId
());
}
reschedule
.
setHappenLocation
(
location
);
if
(
StringUtils
.
isNotBlank
(
request
.
getDescription
()))
{
orderInfo
.
setDescription
(
request
.
getDescription
());
reschedule
.
setDescription
(
request
.
getDescription
());
}
return
this
.
orderReschedule
(
reschedule
);
...
...
@@ -221,32 +210,90 @@ public class OrderInfoServiceImpl implements OrderInfoService {
}
LocalDateTime
expectEnd
=
TimeUtils
.
IsoDateTime2LocalDateTime
(
req
.
getExpectEnd
());
OrderInfoEntity
order
=
orderInfoDao
.
getByOrderId
(
req
.
getOrderId
());
if
(
ObjectUtil
.
isNull
(
order
))
{
throw
new
BusinessException
(
"订单不存在"
);
}
LocalDate
orderDt
=
order
.
getDt
();
order
.
setDt
(
expectBegin
.
toLocalDate
());
order
.
setExpectTimeBegin
(
expectBegin
);
order
.
setExpectTimeEnd
(
expectEnd
);
order
.
setExpectTimeDesc
(
req
.
getExpectDesc
());
order
.
setOrderStatus
(
OrderStatusEnum
.
RESCHEDULED
.
getCode
());
if
(
order
==
null
)
{
throw
new
BusinessException
(
"订单不存在"
);
boolean
skillUpdate
=
false
;
if
(
StringUtils
.
isNotBlank
(
req
.
getBrand
())
&&
!
CommonUtil
.
fixBrand
(
req
.
getBrand
()).
equals
(
order
.
getBrand
()))
{
order
.
setBrand
(
CommonUtil
.
fixBrand
(
req
.
getBrand
()));
skillUpdate
=
true
;
}
if
(
StringUtils
.
isNotBlank
(
req
.
getServiceType
())
&&
!
req
.
getServiceType
().
equals
(
order
.
getType
()))
{
order
.
setSkill
(
req
.
getServiceType
());
skillUpdate
=
true
;
}
if
(
StringUtils
.
isNotBlank
(
req
.
getProductType
())
&&
!
req
.
getProductType
().
equals
(
order
.
getSkill
()))
{
order
.
setType
(
req
.
getProductType
());
skillUpdate
=
true
;
}
//渲染地址,判断地址是否变更
Location
location
=
req
.
getHappenLocation
();
if
(
ObjectUtil
.
isNull
(
location
))
{
location
=
new
Location
();
location
.
setLongitude
(
Double
.
valueOf
(
order
.
getX
()));
location
.
setLatitude
(
Double
.
valueOf
(
order
.
getY
()));
location
.
setAddress
(
order
.
getAddress
());
location
.
setAddressId
(
order
.
getAddressId
());
}
else
{
order
.
setX
(
location
.
getLongitude
().
toString
());
order
.
setY
(
location
.
getLatitude
().
toString
());
order
.
setAddress
(
location
.
getAddress
());
order
.
setAddressId
(
location
.
getAddressId
());
if
(!
order
.
getAddressId
().
equals
(
location
.
getAddressId
()))
{
skillUpdate
=
true
;
//更正省市区
AdministrativeDistrictReq
administrativeDistrictReq
=
new
AdministrativeDistrictReq
();
administrativeDistrictReq
.
setPoints
(
location
.
getLongitude
()
+
","
+
location
.
getLatitude
());
Result
<
AdministrativeDistrictResp
>
adminDistrict
=
fendanService
.
getAdminDistrict
(
administrativeDistrictReq
);
if
(
ObjectUtil
.
isNotEmpty
(
adminDistrict
)
&&
ObjectUtil
.
isNotEmpty
(
adminDistrict
.
getResult
()))
{
order
.
setProvince
(
adminDistrict
.
getResult
().
getSubNames
().
getProvince
());
order
.
setCity
(
adminDistrict
.
getResult
().
getSubNames
().
getCity
());
order
.
setCounty
(
adminDistrict
.
getResult
().
getSubNames
().
getCounty
());
}
}
}
order
.
setReschedulingReason
(
StringUtils
.
isNotBlank
(
req
.
getReschedulingReason
())
?
req
.
getReschedulingReason
()
:
order
.
getReschedulingReason
());
OrgGroupEntity
groupEntity
=
orgGroupDao
.
getByGroupId
(
order
.
getOrgGroupId
());
//是否今天
boolean
isToday
=
DateUtil
.
judgeTimeIsToday
(
expectBegin
);
//是否到人
boolean
isBelong
=
StringUtils
.
isNotEmpty
(
order
.
getEngineerCode
());
// 是否网点
//网点都需要重新指派
boolean
isNetwork
=
ObjectUtil
.
isNull
(
groupEntity
)
?
false
:
groupEntity
.
getCategory
()
==
2
;
String
branchId
=
order
.
getOrgBranchId
();
String
clusterId
=
order
.
getOrgClusterId
();
//网点都需要重新指派
String
teamId
=
order
.
getOrgTeamId
();
// 当天单变更技能直接人工指派
if
(
isToday
&&
skillUpdate
)
{
order
.
setOrgTeamId
(
null
);
order
.
setOrgGroupId
(
null
);
order
.
setEngineerPhone
(
null
);
order
.
setEngineerName
(
null
);
order
.
setEngineerCode
(
null
);
order
.
setEngineerPhone
(
null
);
teamId
=
null
;
sendMsg
(
order
.
getOrgBranchId
(),
order
.
getOrderId
(),
req
.
getExpectBegin
());
}
else
{
// a.已派人-改约到未来
// i.自有:优先改约指派给当前工程师
// ii.网点:优先改约指派给当前网点
// (不给当前工程师)
if
(!
isToday
&&
isBelong
)
{
}
else
if
(
isToday
&&
isBelong
)
{
if
(!
isToday
&&
isBelong
&&
skillUpdate
)
{
//地址变更需要从新分单
order
=
orderFendan
(
order
,
req
,
location
);
clusterId
=
order
.
getOrgClusterId
();
branchId
=
order
.
getOrgBranchId
();
}
else
if
(
isToday
&&
isBelong
&&
order
.
getIsAppointEngineer
()
!=
1
)
{
// b.已派人-改约到当天
// i.自有:优先改约指派给当前工程师
// (会影响该工程师当天后续工单的时
...
...
@@ -270,29 +317,70 @@ public class OrderInfoServiceImpl implements OrderInfoService {
order
.
setEngineerCode
(
null
);
clusterId
=
order
.
getOrgClusterId
();
branchId
=
order
.
getOrgBranchId
();
teamId
=
null
;
sendMsg
(
order
.
getOrgBranchId
(),
order
.
getOrderId
(),
req
.
getExpectBegin
());
}
}
}
else
if
(!
isToday
&&
!
isBelong
)
{
// a.未派人-改约到未来
// i.动态排班
order
=
orderFendan
(
order
,
req
,
location
);
clusterId
=
order
.
getOrgClusterId
();
branchId
=
order
.
getOrgBranchId
();
}
else
if
(
isToday
&&
!
isBelong
)
{
// b.未派人-改约到当天
// i.人工指派
order
.
setOrgTeamId
(
null
);
order
.
setOrgGroupId
(
null
);
order
.
setEngineerPhone
(
null
);
order
.
setEngineerName
(
null
);
order
.
setEngineerCode
(
null
);
teamId
=
null
;
sendMsg
(
order
.
getOrgBranchId
(),
order
.
getOrderId
(),
req
.
getExpectBegin
());
}
}
//处理一家多单
// order = handleMultipleOrders(order);
if
(!
orderDt
.
isEqual
(
expectBegin
.
toLocalDate
()))
{
order
=
handleMultipleOrders
(
order
);
}
// 处理特殊时间,cutoff
Integer
special
=
0
;
Integer
cutoff
=
0
;
if
(
StringUtils
.
isNotBlank
(
teamId
))
{
OrgTeamEntity
teamInfo
=
orgTeamDao
.
getByTeamId
(
teamId
);
special
=
CommonUtil
.
isSpecial
(
order
.
getExpectTimeBegin
().
toLocalTime
(),
order
.
getExpectTimeEnd
().
toLocalTime
(),
teamInfo
.
getWorkOn
(),
teamInfo
.
getWorkOff
());
cutoff
=
CommonUtil
.
isCutoff
(
order
.
getExpectTimeBegin
(),
teamInfo
.
getWorkOff
());
}
else
{
cutoff
=
CommonUtil
.
isCutoff
(
order
.
getExpectTimeBegin
(),
null
);
}
order
.
setIsCutoff
(
cutoff
);
order
.
setIsSpecialTime
(
special
);
order
.
setOrgClusterId
(
clusterId
);
order
.
setOrgBranchId
(
branchId
);
orderInfoDao
.
save
(
order
);
// 登记事件
commonService
.
addOrderEvent
(
req
.
getOrderId
(),
""
,
"PEA"
,
req
.
getOperator
(),
OrderStatusEnum
.
RESCHEDULED
.
getDescription
(),
OrderStatusEnum
.
RESCHEDULED
.
getDescription
(),
""
);
return
Result
.
success
(
null
);
}
/**
* 订单重新分单
*
* @param order
* @param req
* @param location
* @return
*/
private
OrderInfoEntity
orderFendan
(
OrderInfoEntity
order
,
OrderReschedule
req
,
Location
location
)
{
order
.
setServiceStatus
(
ServiceStatusEnum
.
INIT
.
getCode
());
if
(
StringUtils
.
isBlank
(
req
.
getDescription
()))
{
order
.
setDescription
(
order
.
getDescription
());
}
Location
location
=
req
.
getHappenLocation
();
if
(
ObjectUtil
.
isNull
(
location
))
{
location
=
new
Location
();
location
.
setLongitude
(
Double
.
valueOf
(
order
.
getX
()));
location
.
setLatitude
(
Double
.
valueOf
(
order
.
getY
()));
location
.
setAddress
(
order
.
getAddress
());
location
.
setAddressId
(
order
.
getAddressId
());
}
else
{
order
.
setX
(
location
.
getLongitude
().
toString
());
order
.
setY
(
location
.
getLongitude
().
toString
());
order
.
setAddress
(
location
.
getAddress
());
order
.
setAddressId
(
location
.
getAddressId
());
}
//获取省市区
AdministrativeDistrictReq
administrativeDistrictReq
=
new
AdministrativeDistrictReq
();
administrativeDistrictReq
.
setPoints
(
location
.
getLongitude
()
+
","
+
location
.
getLatitude
());
...
...
@@ -309,49 +397,23 @@ public class OrderInfoServiceImpl implements OrderInfoService {
fendanReq
.
setProductType
(
order
.
getType
());
fendanReq
.
setServiceType
(
order
.
getSkill
());
fendanReq
.
setLocation
(
location
);
Result
<
OrgTeamInfo
>
fendanResult
=
fendanService
.
fendanToGroupCapacity
(
fendanReq
,
2
,
order
.
getDt
(),
expectBegin
.
toLocalTime
(),
expectEnd
.
toLocalTime
());
Result
<
OrgTeamInfo
>
fendanResult
=
fendanService
.
fendanToGroupCapacity
(
fendanReq
,
2
,
order
.
getDt
(),
order
.
getExpectTimeBegin
().
toLocalTime
(),
order
.
getExpectTimeEnd
()
.
toLocalTime
());
if
(!
fendanResult
.
getCode
().
equals
(
ResultEnum
.
SUCCESS
.
getCode
())
||
ObjectUtil
.
isNull
(
fendanResult
.
getResult
()))
{
if
(
fendanResult
.
getCode
().
equals
(
StatusCodeEnum
.
FENDAN_IS_TRANSCEND
.
getCode
()))
{
order
.
setTranscend
(
1
);
}
OrgBranchEntity
branchEntity
=
orgBranchDao
.
findByCitycodeListLike
(
"%"
+
adminDistrict
.
getResult
().
getSubNames
().
getCity
()
+
"%"
);
clusterId
=
branchEntity
.
getClusterId
();
branchId
=
branchEntity
.
getBranchId
();
sendMsg
(
branchEntity
.
getBranchId
(),
order
.
getOrderId
(),
req
.
getExpectBegin
());
}
else
{
// 根据分单工作队,填写clusterId/branchId/groupId/teamId等
OrgTeamInfo
teamInfo
=
fendanResult
.
getResult
();
clusterId
=
teamInfo
.
getClusterId
();
branchId
=
teamInfo
.
getBranchId
();
order
.
setOrgGroupId
(
teamInfo
.
getGroupId
());
order
.
setOrgTeamId
(
teamInfo
.
getTeamId
());
//处理超派,特殊时间段
order
.
setIsSpecialTime
(
CommonUtil
.
isSpecial
(
order
.
getExpectTimeBegin
().
toLocalTime
(),
order
.
getExpectTimeEnd
().
toLocalTime
(),
teamInfo
.
getWorkOn
(),
teamInfo
.
getWorkOff
()));
}
}
else
if
(
isToday
&&
!
isBelong
)
{
// b.未派人-改约到当天
// i.人工指派
OrgBranchEntity
branchEntity
=
orgBranchDao
.
getByBranchId
(
order
.
getOrgBranchId
());
clusterId
=
branchEntity
.
getClusterId
();
branchId
=
branchEntity
.
getBranchId
();
order
.
setOrgTeamId
(
null
);
order
.
setOrgGroupId
(
null
);
sendMsg
(
branchEntity
.
getBranchId
(),
order
.
getOrderId
(),
req
.
getExpectBegin
());
// order.setIsSpecialTime(CommonUtil.isSpecial(order.getExpectTimeBegin().toLocalTime(),
// order.getExpectTimeEnd().toLocalTime(), teamInfo.getWorkOn(), teamInfo.getWorkOff()));
}
//处理一家多单
// order = handleMultipleOrders(order);
if
(!
orderDt
.
isEqual
(
expectBegin
.
toLocalDate
()))
{
order
=
handleMultipleOrders
(
order
);
}
order
.
setOrgClusterId
(
clusterId
);
order
.
setOrgBranchId
(
branchId
);
orderInfoDao
.
save
(
order
);
// 登记事件
commonService
.
addOrderEvent
(
req
.
getOrderId
(),
""
,
"PEA-WEB"
,
req
.
getOperator
(),
OrderStatusEnum
.
RESCHEDULED
.
getDescription
(),
OrderStatusEnum
.
RESCHEDULED
.
getDescription
(),
""
);
return
Result
.
success
(
null
);
return
order
;
}
private
void
sendMsg
(
String
branchId
,
String
orderId
,
String
reservationTime
)
{
...
...
project-order/src/main/java/com/dituhui/pea/order/utils/CommonUtil.java
View file @
a98de2b
...
...
@@ -85,6 +85,7 @@ public class CommonUtil {
/**
* 判断是否cutoff
* 今日单或今日cutoff之后的次日单
*
* @return
*/
...
...
@@ -96,7 +97,7 @@ public class CommonUtil {
return
0
;
}
LocalDateTime
workOff
=
LocalDate
.
now
().
atTime
(
Integer
.
parseInt
(
strOff
.
split
(
":"
)[
0
]),
Integer
.
parseInt
(
strOff
.
split
(
":"
)[
1
]),
0
);
if
(
localTime
.
isAfter
(
workOff
))
{
if
(
LocalDateTime
.
now
().
isAfter
(
workOff
)
&&
DateUtil
.
judgeTimeIsisTomorrow
(
localTime
))
{
return
1
;
}
return
0
;
...
...
@@ -111,4 +112,8 @@ public class CommonUtil {
}
}
public
static
void
main
(
String
[]
args
)
{
isCutoff
(
LocalDateTime
.
now
(),
"18:00"
);
}
}
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