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 1eec3c49
authored
Nov 10, 2023
by
huangjinxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:创单,工单动态,消息提醒
1 parent
2c4d0cd3
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
140 additions
and
105 deletions
project-order/src/main/java/com/dituhui/pea/order/constant/OrderReschedulingReason.java
project-order/src/main/java/com/dituhui/pea/order/enums/OrderPeaTagsEnum.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/DispatchServiceImpl.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/OrderInfoServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/utils/OrderUtil.java
project-order/src/main/java/com/dituhui/pea/order/constant/OrderReschedulingReason.java
View file @
1eec3c4
...
@@ -10,7 +10,7 @@ import java.util.Map;
...
@@ -10,7 +10,7 @@ import java.util.Map;
*/
*/
public
class
OrderReschedulingReason
{
public
class
OrderReschedulingReason
{
public
static
Map
<
String
,
List
<
String
>>
ReschedulingReasonMap
=
new
HashMap
<>()
{
public
final
static
Map
<
String
,
List
<
String
>>
ReschedulingReasonMap
=
new
HashMap
<>()
{
{
{
put
(
"服务设备/工具相关"
,
new
ArrayList
<>()
{
put
(
"服务设备/工具相关"
,
new
ArrayList
<>()
{
{
{
...
@@ -25,7 +25,6 @@ public class OrderReschedulingReason {
...
@@ -25,7 +25,6 @@ public class OrderReschedulingReason {
add
(
"加单服务,没有所需配件"
);
add
(
"加单服务,没有所需配件"
);
add
(
"缺少可用的安装类附件"
);
add
(
"缺少可用的安装类附件"
);
add
(
"缺少可用的清洁类产品"
);
add
(
"缺少可用的清洁类产品"
);
add
(
"缺少可用的清洁类产品"
);
add
(
"缺少可用的消耗品(生料带、鞋套等)"
);
add
(
"缺少可用的消耗品(生料带、鞋套等)"
);
add
(
"缺少服务所需纸质工单"
);
add
(
"缺少服务所需纸质工单"
);
}
}
...
...
project-order/src/main/java/com/dituhui/pea/order/enums/OrderPeaTagsEnum.java
0 → 100644
View file @
1eec3c4
package
com
.
dituhui
.
pea
.
order
.
enums
;
public
enum
OrderPeaTagsEnum
{
// 特殊时段, 一家多台, 当日加单, 紧急
special
(
"特殊时段"
),
cutoff
(
"当日加单"
),
multipleOrders
(
"一家多台"
),
urgent
(
"紧急"
);
private
String
tag
;
OrderPeaTagsEnum
(
String
tag
)
{
this
.
tag
=
tag
;
}
public
String
getTag
()
{
return
tag
;
}
}
project-order/src/main/java/com/dituhui/pea/order/service/impl/DispatchServiceImpl.java
View file @
1eec3c4
package
com
.
dituhui
.
pea
.
order
.
service
.
impl
;
package
com
.
dituhui
.
pea
.
order
.
service
.
impl
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.dituhui.pea.common.BusinessException
;
import
com.dituhui.pea.common.BusinessException
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.enums.StatusCodeEnum
;
import
com.dituhui.pea.enums.StatusCodeEnum
;
...
@@ -11,10 +12,8 @@ import com.dituhui.pea.order.dto.DispatchEngineerOrderListResp;
...
@@ -11,10 +12,8 @@ import com.dituhui.pea.order.dto.DispatchEngineerOrderListResp;
import
com.dituhui.pea.order.dto.DispatchOrderListReq
;
import
com.dituhui.pea.order.dto.DispatchOrderListReq
;
import
com.dituhui.pea.order.dto.DispatchOrderListResp
;
import
com.dituhui.pea.order.dto.DispatchOrderListResp
;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.enums.AppointmentMethodEnum
;
import
com.dituhui.pea.order.enums.*
;
import
com.dituhui.pea.order.enums.OrderFlowEnum
;
import
com.dituhui.pea.order.service.CommonService
;
import
com.dituhui.pea.order.enums.OrderGroupEnum
;
import
com.dituhui.pea.order.enums.OrderStatusEnum
;
import
com.dituhui.pea.order.service.DispatchService
;
import
com.dituhui.pea.order.service.DispatchService
;
import
com.dituhui.pea.order.utils.CommonUtil
;
import
com.dituhui.pea.order.utils.CommonUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -67,6 +66,9 @@ public class DispatchServiceImpl implements DispatchService {
...
@@ -67,6 +66,9 @@ public class DispatchServiceImpl implements DispatchService {
@Autowired
@Autowired
private
OrgTeamEngineerDao
orgTeamEngineerDao
;
private
OrgTeamEngineerDao
orgTeamEngineerDao
;
@Autowired
private
CommonService
commonService
;
@Transactional
@Transactional
@Override
@Override
public
Result
<?>
getDispatchOrderList
(
DispatchOrderListReq
reqDTO
)
{
public
Result
<?>
getDispatchOrderList
(
DispatchOrderListReq
reqDTO
)
{
...
@@ -308,37 +310,11 @@ public class DispatchServiceImpl implements DispatchService {
...
@@ -308,37 +310,11 @@ public class DispatchServiceImpl implements DispatchService {
entity
.
setOrgBranchId
(
byTeamId
.
getBranchId
());
entity
.
setOrgBranchId
(
byTeamId
.
getBranchId
());
entity
.
setOrgClusterId
(
byTeamId
.
getClusterId
());
entity
.
setOrgClusterId
(
byTeamId
.
getClusterId
());
orderInfoDao
.
save
(
entity
);
orderInfoDao
.
save
(
entity
);
//记录流程
commonService
.
addOrderEvent
(
entity
.
getOrderId
(),
""
,
"BEAN"
,
"BEAN"
,
OrderEventEnum
.
reassignment
.
getEvent
(),
String
.
format
(
OrderEventEnum
.
reassignment
.
getMsg
(),
engineer
.
getName
()
+
"-"
+
(
ObjectUtil
.
isNotNull
(
byTeamId
)
?
byTeamId
.
getTeamName
()
:
""
)),
""
,
LocalDateTime
.
now
());
}
}
//
// // 已经指派的订单
// List<OrderInfoEntity> engineerOrders = orderInfoDao.findByDtAndEngineerCode(localDate, engineerCode);
// engineerOrders.sort(Comparator.comparing(OrderInfoEntity::getPlanStartTime)); // 按照planStartTime排序
// List<OrderInfoEntity> orderAppointments = engineerOrders.stream()
// .filter(o -> o.getOrderStatus().equals("NORMAL"))
// .collect(Collectors.toList()); // 过滤,只有NORMAL订单才需要处理,取消订单不需要处理
//
// // TODO,临时处理方案,后续调用派单引擎处理
// OrderRequestScheduler scheduler = new OrderRequestScheduler();
// List<LineSegment> results = scheduler.scheduler(orders, orderAppointments);
// for (LineSegment r : results) {
// String orderId = r.id;
// LocalDateTime planStartTime = scheduler.linePoint2DateTime(r.start, date);
// LocalDateTime planEndTime = scheduler.linePoint2DateTime(r.end, date);
//
// CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
// CriteriaUpdate<OrderInfoEntity> update = criteriaBuilder.createCriteriaUpdate(OrderInfoEntity.class);
// Root<OrderInfoEntity> root = update.from(OrderInfoEntity.class);
// update.set(root.get("planStartTime"), planStartTime);
// update.set(root.get("planEndTime"), planEndTime);
// update.set(root.get("appointmentStatus"), OrderFlowEnum.CONFIRM.name());
// update.set(root.get("appointmentMethod"), "MANUAL");
// update.set(root.get("engineerCode"), engineerCode);
// update.where(
// criteriaBuilder.equal(root.get("orderId"), orderId),
// criteriaBuilder.equal(root.get("dt"), localDate)
// );
// entityManager.createQuery(update).executeUpdate();
// }
return
Result
.
success
(
null
);
return
Result
.
success
(
null
);
}
}
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderAssignImpl.java
View file @
1eec3c4
...
@@ -9,20 +9,11 @@ import com.dituhui.pea.order.common.OrderAssignCheck;
...
@@ -9,20 +9,11 @@ import com.dituhui.pea.order.common.OrderAssignCheck;
import
com.dituhui.pea.order.common.TimeUtils
;
import
com.dituhui.pea.order.common.TimeUtils
;
import
com.dituhui.pea.order.dao.*
;
import
com.dituhui.pea.order.dao.*
;
import
com.dituhui.pea.order.dto.*
;
import
com.dituhui.pea.order.dto.*
;
import
com.dituhui.pea.order.dto.param.CapacityQueryDTO
;
import
com.dituhui.pea.order.dto.param.Location
;
import
com.dituhui.pea.order.dto.param.OrderDTO
;
import
com.dituhui.pea.order.dto.param.OrgTeamInfo
;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.enums.AppointmentMethodEnum
;
import
com.dituhui.pea.order.enums.*
;
import
com.dituhui.pea.order.enums.OrderFlowEnum
;
import
com.dituhui.pea.order.enums.OrderStatusEnum
;
import
com.dituhui.pea.order.enums.ServiceStatusEnum
;
import
com.dituhui.pea.order.service.*
;
import
com.dituhui.pea.order.service.*
;
import
com.dituhui.pea.order.utils.CommonUtil
;
import
com.dituhui.pea.order.utils.CommonUtil
;
import
com.dituhui.pea.pojo.saas.req.AdministrativeDistrictReq
;
import
com.dituhui.pea.order.utils.OrderUtil
;
import
com.dituhui.pea.pojo.saas.resp.AdministrativeDistrictResp
;
import
com.dituhui.pea.util.DateUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -35,7 +26,6 @@ import javax.persistence.criteria.CriteriaBuilder;
...
@@ -35,7 +26,6 @@ import javax.persistence.criteria.CriteriaBuilder;
import
javax.persistence.criteria.CriteriaQuery
;
import
javax.persistence.criteria.CriteriaQuery
;
import
javax.persistence.criteria.Predicate
;
import
javax.persistence.criteria.Predicate
;
import
javax.persistence.criteria.Root
;
import
javax.persistence.criteria.Root
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -170,7 +160,7 @@ public class OrderAssignImpl implements OrderAssign {
...
@@ -170,7 +160,7 @@ public class OrderAssignImpl implements OrderAssign {
}
}
OrgTeamEntity
byTeamId
=
orgTeamDao
.
getByTeamId
(
orgTeamEngineers
.
get
(
0
).
getTeamId
());
OrgTeamEntity
byTeamId
=
orgTeamDao
.
getByTeamId
(
orgTeamEngineers
.
get
(
0
).
getTeamId
());
if
(
entity
!=
null
&&
!
entity
.
getAppointmentStatus
().
equals
(
"NOT_ASSIGNED"
)
&&
entity
.
getEngineerCode
().
equals
(
req
.
getEngineerCode
()))
{
if
(
entity
!=
null
&&
!
entity
.
getAppointmentStatus
().
equals
(
"NOT_ASSIGNED"
)
&&
StringUtils
.
isNotBlank
(
entity
.
getEngineerCode
())
&&
entity
.
getEngineerCode
().
equals
(
req
.
getEngineerCode
()))
{
throw
new
BusinessException
(
String
.
format
(
"订单已指派个技术员[%s], 不必重复指派给同一个技术员"
,
engineer
.
getName
()));
throw
new
BusinessException
(
String
.
format
(
"订单已指派个技术员[%s], 不必重复指派给同一个技术员"
,
engineer
.
getName
()));
}
}
...
@@ -190,28 +180,28 @@ public class OrderAssignImpl implements OrderAssign {
...
@@ -190,28 +180,28 @@ public class OrderAssignImpl implements OrderAssign {
// entity.setEngineerCode(engineer.getEngineerCode());
// entity.setEngineerCode(engineer.getEngineerCode());
// orderInfoDao.save(order);
// orderInfoDao.save(order);
// 工单变更登记
// 工单变更登记
commonService
.
addOrderEvent
(
req
.
getOrderId
(),
""
,
"PEA-WEB"
,
req
.
getOperator
(),
OrderStatusEnum
.
ASSIGN
.
getDescription
(),
OrderStatusEnum
.
ASSIGN
.
getDescription
(),
""
);
commonService
.
addOrderEvent
(
entity
.
getOrderId
(),
""
,
"BEAN"
,
"BEAN"
,
OrderEventEnum
.
reassignment
.
getEvent
(),
String
.
format
(
OrderEventEnum
.
reassignment
.
getMsg
(),
engineer
.
getName
()
+
"-"
+
(
ObjectUtil
.
isNotNull
(
byTeamId
)
?
byTeamId
.
getTeamName
()
:
""
)),
""
,
LocalDateTime
.
now
());
return
Result
.
success
(
null
);
return
Result
.
success
(
null
);
}
}
@Override
@Override
@Transactional
public
Result
<?>
orderRevokeAssign
(
String
orderId
)
throws
BusinessException
{
public
Result
<?>
orderRevokeAssign
(
String
orderId
)
throws
BusinessException
{
// 放回工单池
// 放回工单池
OrderInfoEntity
order
=
orderInfoDao
.
getByOrderId
(
orderId
);
OrderInfoEntity
order
=
orderInfoDao
.
getByOrderId
(
orderId
);
if
(
order
==
null
)
{
if
(
order
==
null
)
{
throw
new
BusinessException
(
"订单不存在"
);
return
Result
.
failed
(
"订单不存在"
);
}
}
// 更新order_request表为未指派
// 更新order_request表为未指派
order
.
setAppointmentStatus
(
OrderFlowEnum
.
INIT
.
name
());
order
.
setAppointmentStatus
(
OrderFlowEnum
.
INIT
.
name
());
entityManager
.
merge
(
order
);
order
.
setServiceStatus
(
OrderFlowEnum
.
INIT
.
name
());
order
=
OrderUtil
.
handleErrorOrder
(
order
);
// 操作员ID TODO-用户系统
orderInfoDao
.
save
(
order
);
// 登记事件
commonService
.
addOrderEvent
(
orderId
,
""
,
"PEA-WEB"
,
"123"
,
"放回工单池"
,
"放回工单池"
,
""
);
commonService
.
addOrderEvent
(
orderId
,
""
,
"PEA"
,
"PEA"
,
OrderEventEnum
.
backOrderPool
.
getEvent
(),
OrderEventEnum
.
backOrderPool
.
getMsg
(),
""
);
return
Result
.
success
(
null
);
return
Result
.
success
(
null
);
}
}
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderCreateServiceImpl.java
View file @
1eec3c4
...
@@ -51,10 +51,7 @@ import com.dituhui.pea.order.entity.OrgBranchEntity;
...
@@ -51,10 +51,7 @@ import com.dituhui.pea.order.entity.OrgBranchEntity;
import
com.dituhui.pea.order.entity.OrgTeamEngineerEntity
;
import
com.dituhui.pea.order.entity.OrgTeamEngineerEntity
;
import
com.dituhui.pea.order.entity.OrgTeamEntity
;
import
com.dituhui.pea.order.entity.OrgTeamEntity
;
import
com.dituhui.pea.order.entity.SkillInfoEntity
;
import
com.dituhui.pea.order.entity.SkillInfoEntity
;
import
com.dituhui.pea.order.enums.AppointmentMethodEnum
;
import
com.dituhui.pea.order.enums.*
;
import
com.dituhui.pea.order.enums.OrderEventEnum
;
import
com.dituhui.pea.order.enums.OrderFlowEnum
;
import
com.dituhui.pea.order.enums.OrderStatusEnum
;
import
com.dituhui.pea.order.service.CommonService
;
import
com.dituhui.pea.order.service.CommonService
;
import
com.dituhui.pea.order.service.FendanService
;
import
com.dituhui.pea.order.service.FendanService
;
import
com.dituhui.pea.order.service.MsgService
;
import
com.dituhui.pea.order.service.MsgService
;
...
@@ -307,6 +304,19 @@ public class OrderCreateServiceImpl implements OrderCreateService {
...
@@ -307,6 +304,19 @@ public class OrderCreateServiceImpl implements OrderCreateService {
entity
.
setCity
(
adminDistrict
.
getResult
().
getSubNames
().
getCity
());
entity
.
setCity
(
adminDistrict
.
getResult
().
getSubNames
().
getCity
());
entity
.
setCounty
(
adminDistrict
.
getResult
().
getSubNames
().
getCounty
());
entity
.
setCounty
(
adminDistrict
.
getResult
().
getSubNames
().
getCounty
());
}
}
List
<
String
>
tags
=
req
.
getOrderTags
();
// 处理技能和标签
entity
.
setTakeTime
(
skillInfoEntity
.
getTakeTime
());
String
joinTags
=
CollectionUtils
.
isEmpty
(
req
.
getOrderTags
())
?
""
:
String
.
join
(
","
,
req
.
getOrderTags
());
entity
.
setBeanTags
(
joinTags
);
entity
.
setIsMultiple
(
joinTags
.
contains
(
"重物搬运"
)
?
1
:
0
);
entity
.
setBeanPriority
(
req
.
getPriority
());
if
(
req
.
getPriority
().
equals
(
"1"
)
&&
!
DateUtil
.
judgeTimeIsToday
(
entity
.
getExpectTimeBegin
()))
{
entity
.
setAppointmentMethod
(
AppointmentMethodEnum
.
AUTO_NOW
.
name
());
tags
.
add
(
OrderPeaTagsEnum
.
urgent
.
getTag
());
//发送通知分部消息
// sendMsg(entity.getOrgBranchId(), orderId, entity.getExpectTimeBegin().toLocalDate());
}
// 处理指派工程师
// 处理指派工程师
entity
.
setIsAppointEngineer
(
req
.
getIsAppointEngineer
());
entity
.
setIsAppointEngineer
(
req
.
getIsAppointEngineer
());
...
@@ -353,11 +363,11 @@ public class OrderCreateServiceImpl implements OrderCreateService {
...
@@ -353,11 +363,11 @@ public class OrderCreateServiceImpl implements OrderCreateService {
entity
.
setOrgClusterId
(
branchEntity
.
getClusterId
());
entity
.
setOrgClusterId
(
branchEntity
.
getClusterId
());
entity
.
setOrgBranchId
(
branchEntity
.
getBranchId
());
entity
.
setOrgBranchId
(
branchEntity
.
getBranchId
());
entity
.
setAppointmentMethod
(
AppointmentMethodEnum
.
MANUAL
.
name
());
entity
.
setAppointmentMethod
(
AppointmentMethodEnum
.
MANUAL
.
name
());
//发送通知分部消息
sendMsg
(
branchEntity
.
getBranchId
(),
orderId
,
entity
.
getExpectTimeBegin
().
toLocalDate
());
Integer
cutoff
=
CommonUtil
.
isCutoff
(
entity
.
getExpectTimeBegin
(),
null
);
Integer
cutoff
=
CommonUtil
.
isCutoff
(
entity
.
getExpectTimeBegin
(),
null
);
entity
.
setIsCutoff
(
cutoff
);
entity
.
setIsCutoff
(
cutoff
);
//发送通知分部消息
sendMsg
(
branchEntity
.
getBranchId
(),
orderId
,
entity
.
getExpectTimeBegin
().
toLocalDate
(),
tags
,
cutoff
,
0
);
}
else
{
}
else
{
// 根据分单工作队,填写clusterId/branchId/groupId/teamId等
// 根据分单工作队,填写clusterId/branchId/groupId/teamId等
OrgTeamInfo
teamInfo
=
fendanResult
.
getResult
();
OrgTeamInfo
teamInfo
=
fendanResult
.
getResult
();
...
@@ -384,7 +394,7 @@ public class OrderCreateServiceImpl implements OrderCreateService {
...
@@ -384,7 +394,7 @@ public class OrderCreateServiceImpl implements OrderCreateService {
entity
.
setAppointmentMethod
(
AppointmentMethodEnum
.
MANUAL
.
name
());
entity
.
setAppointmentMethod
(
AppointmentMethodEnum
.
MANUAL
.
name
());
entity
.
setAppointmentStatus
(
OrderFlowEnum
.
INIT
.
name
());
entity
.
setAppointmentStatus
(
OrderFlowEnum
.
INIT
.
name
());
//发送通知分部消息
//发送通知分部消息
sendMsg
(
teamInfo
.
getBranchId
(),
orderId
,
entity
.
getExpectTimeBegin
().
toLocalDate
());
sendMsg
(
teamInfo
.
getBranchId
(),
orderId
,
entity
.
getExpectTimeBegin
().
toLocalDate
()
,
tags
,
cutoff
,
special
);
}
}
}
}
}
}
...
@@ -417,18 +427,6 @@ public class OrderCreateServiceImpl implements OrderCreateService {
...
@@ -417,18 +427,6 @@ public class OrderCreateServiceImpl implements OrderCreateService {
entity
.
setBeanSubStatus
(
""
);
entity
.
setBeanSubStatus
(
""
);
entity
.
setWorkshop
(
false
);
entity
.
setWorkshop
(
false
);
// 处理技能和标签
entity
.
setTakeTime
(
skillInfoEntity
.
getTakeTime
());
String
joinTags
=
CollectionUtils
.
isEmpty
(
req
.
getOrderTags
())
?
""
:
String
.
join
(
","
,
req
.
getOrderTags
());
entity
.
setBeanTags
(
joinTags
);
entity
.
setIsMultiple
(
joinTags
.
contains
(
"重物搬运"
)
?
1
:
0
);
entity
.
setBeanPriority
(
req
.
getPriority
());
if
(
req
.
getPriority
().
equals
(
"1"
)
&&
!
DateUtil
.
judgeTimeIsToday
(
entity
.
getExpectTimeBegin
()))
{
entity
.
setAppointmentMethod
(
AppointmentMethodEnum
.
AUTO_NOW
.
name
());
//发送通知分部消息
// sendMsg(entity.getOrgBranchId(), orderId, entity.getExpectTimeBegin().toLocalDate());
}
//一家多单
//一家多单
Result
<
String
>
addMultipleOrders
=
orderInfoService
.
addMultipleOrders
(
entity
.
getDt
(),
location
.
getAddressId
(),
orderId
);
Result
<
String
>
addMultipleOrders
=
orderInfoService
.
addMultipleOrders
(
entity
.
getDt
(),
location
.
getAddressId
(),
orderId
);
entity
.
setMultipleOrders
(
addMultipleOrders
.
getResult
());
entity
.
setMultipleOrders
(
addMultipleOrders
.
getResult
());
...
@@ -443,12 +441,18 @@ public class OrderCreateServiceImpl implements OrderCreateService {
...
@@ -443,12 +441,18 @@ public class OrderCreateServiceImpl implements OrderCreateService {
return
Result
.
success
(
null
);
return
Result
.
success
(
null
);
}
}
private
void
sendMsg
(
String
branchId
,
String
orderId
,
LocalDate
toLocalDate
)
{
private
void
sendMsg
(
String
branchId
,
String
orderId
,
LocalDate
toLocalDate
,
List
<
String
>
tags
,
Integer
cutoff
,
Integer
special
)
{
if
(
cutoff
==
1
)
{
tags
.
add
(
OrderPeaTagsEnum
.
cutoff
.
getTag
());
}
if
(
special
==
1
)
{
tags
.
add
(
OrderPeaTagsEnum
.
special
.
getTag
());
}
MsgDTO
msgDTO
=
new
MsgDTO
();
MsgDTO
msgDTO
=
new
MsgDTO
();
msgDTO
.
setBranchId
(
branchId
);
msgDTO
.
setBranchId
(
branchId
);
msgDTO
.
setType
(
0
);
msgDTO
.
setType
(
0
);
msgDTO
.
setOrderIds
(
orderId
);
msgDTO
.
setOrderIds
(
orderId
);
msgDTO
.
setContent
(
"有1条预约日期在"
+
toLocalDate
+
"的工单需人工外理"
);
msgDTO
.
setContent
(
String
.
format
(
"有1条预约日期在%s的工单需人工外理,标签是(%s),单号:%S"
,
toLocalDate
,
String
.
join
(
","
,
tags
),
orderId
)
);
msgService
.
add
(
msgDTO
);
msgService
.
add
(
msgDTO
);
}
}
...
@@ -458,6 +462,7 @@ public class OrderCreateServiceImpl implements OrderCreateService {
...
@@ -458,6 +462,7 @@ public class OrderCreateServiceImpl implements OrderCreateService {
.
map
(
EngineerInfoEntity:
:
getEngineerCode
).
collect
(
Collectors
.
toList
());
.
map
(
EngineerInfoEntity:
:
getEngineerCode
).
collect
(
Collectors
.
toList
());
List
<
String
>
matchEngineerCodes
=
engineerSkillDao
.
findAllByBrandAndTypeAndSkillAndEngineerCodeIn
(
thisOrderEntity
.
getBrand
(),
thisOrderEntity
.
getType
(),
thisOrderEntity
.
getSkill
(),
engineerCodes
).
stream
()
List
<
String
>
matchEngineerCodes
=
engineerSkillDao
.
findAllByBrandAndTypeAndSkillAndEngineerCodeIn
(
thisOrderEntity
.
getBrand
(),
thisOrderEntity
.
getType
(),
thisOrderEntity
.
getSkill
(),
engineerCodes
).
stream
()
.
map
(
EngineerSkillEntity:
:
getEngineerCode
).
collect
(
Collectors
.
toList
());
.
map
(
EngineerSkillEntity:
:
getEngineerCode
).
collect
(
Collectors
.
toList
());
String
assignEngineerCode
=
null
;
String
assignEngineerCode
=
null
;
OrderAssignCheck
.
Result
checkResult
=
null
;
OrderAssignCheck
.
Result
checkResult
=
null
;
log
.
info
(
"=== 准备调用指派,候选的技术员列表: {}"
,
matchEngineerCodes
);
log
.
info
(
"=== 准备调用指派,候选的技术员列表: {}"
,
matchEngineerCodes
);
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderInfoServiceImpl.java
View file @
1eec3c4
...
@@ -13,12 +13,10 @@ import com.dituhui.pea.order.dto.MsgDTO;
...
@@ -13,12 +13,10 @@ import com.dituhui.pea.order.dto.MsgDTO;
import
com.dituhui.pea.order.dto.OrderReschedule
;
import
com.dituhui.pea.order.dto.OrderReschedule
;
import
com.dituhui.pea.order.dto.param.*
;
import
com.dituhui.pea.order.dto.param.*
;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.enums.AppointmentMethodEnum
;
import
com.dituhui.pea.order.enums.*
;
import
com.dituhui.pea.order.enums.BeanServiceFlowEnum
;
import
com.dituhui.pea.order.enums.OrderStatusEnum
;
import
com.dituhui.pea.order.enums.ServiceStatusEnum
;
import
com.dituhui.pea.order.service.*
;
import
com.dituhui.pea.order.service.*
;
import
com.dituhui.pea.order.utils.CommonUtil
;
import
com.dituhui.pea.order.utils.CommonUtil
;
import
com.dituhui.pea.order.utils.OrderUtil
;
import
com.dituhui.pea.pojo.saas.req.AdministrativeDistrictReq
;
import
com.dituhui.pea.pojo.saas.req.AdministrativeDistrictReq
;
import
com.dituhui.pea.pojo.saas.resp.AdministrativeDistrictResp
;
import
com.dituhui.pea.pojo.saas.resp.AdministrativeDistrictResp
;
import
com.dituhui.pea.util.DateUtil
;
import
com.dituhui.pea.util.DateUtil
;
...
@@ -32,8 +30,6 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -32,8 +30,6 @@ import org.springframework.transaction.annotation.Transactional;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -157,7 +153,7 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -157,7 +153,7 @@ public class OrderInfoServiceImpl implements OrderInfoService {
}
}
orderInfoDao
.
save
(
orderInfo
);
orderInfoDao
.
save
(
orderInfo
);
//记录流程
//记录流程
commonService
.
addOrderEvent
(
request
.
getOrderId
(),
""
,
"BEAN"
,
"BEAN"
,
OrderStatusEnum
.
NORMAL
.
getDescription
(),
request
.
getStage
(),
""
,
LocalDateTimeUtil
.
of
(
request
.
getHappen
()));
//
commonService.addOrderEvent(request.getOrderId(), "", "BEAN", "BEAN", OrderStatusEnum.NORMAL.getDescription(), request.getStage(), "", LocalDateTimeUtil.of(request.getHappen()));
}
else
if
(
request
.
getOrderStatus
().
equalsIgnoreCase
(
OrderStatusEnum
.
CANCELED
.
getCode
()))
{
}
else
if
(
request
.
getOrderStatus
().
equalsIgnoreCase
(
OrderStatusEnum
.
CANCELED
.
getCode
()))
{
orderInfo
.
setServiceStatus
(
BeanServiceFlowEnum
.
CANCELED
.
getStatus
());
orderInfo
.
setServiceStatus
(
BeanServiceFlowEnum
.
CANCELED
.
getStatus
());
orderInfo
.
setOrderStatus
(
OrderStatusEnum
.
CANCELED
.
getCode
());
orderInfo
.
setOrderStatus
(
OrderStatusEnum
.
CANCELED
.
getCode
());
...
@@ -170,9 +166,21 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -170,9 +166,21 @@ public class OrderInfoServiceImpl implements OrderInfoService {
if
(!
deleteMultipleOrders
.
getCode
().
equals
(
ResultEnum
.
SUCCESS
.
getCode
()))
{
if
(!
deleteMultipleOrders
.
getCode
().
equals
(
ResultEnum
.
SUCCESS
.
getCode
()))
{
throw
new
BusinessException
(
"改约日期失败"
);
throw
new
BusinessException
(
"改约日期失败"
);
}
}
OrgGroupEntity
orgGroupEntity
=
null
;
if
(
StringUtils
.
isNotBlank
(
orderInfo
.
getOrgGroupId
()))
{
orgGroupEntity
=
orgGroupDao
.
getByGroupId
(
orderInfo
.
getOrgGroupId
());
}
OrgTeamEntity
orgTeamEntity
=
null
;
if
(
StringUtils
.
isNotBlank
(
orderInfo
.
getOrgTeamId
()))
{
orgTeamEntity
=
orgTeamDao
.
getByTeamId
(
orderInfo
.
getOrgTeamId
());
}
String
engineerName
=
orderInfo
.
getEngineerName
();
orderInfoDao
.
save
(
orderInfo
);
orderInfoDao
.
save
(
orderInfo
);
//记录流程
//记录流程
commonService
.
addOrderEvent
(
request
.
getOrderId
(),
""
,
"BEAN"
,
"BEAN"
,
OrderStatusEnum
.
CANCELED
.
getDescription
(),
request
.
getStage
(),
""
,
LocalDateTimeUtil
.
of
(
request
.
getHappen
()));
commonService
.
addOrderEvent
(
request
.
getOrderId
(),
""
,
"BEAN"
,
"BEAN"
,
OrderEventEnum
.
cancel
.
getEvent
(),
String
.
format
(
OrderEventEnum
.
cancel
.
getMsg
(),
engineerName
+
"-"
+
(
ObjectUtil
.
isNotNull
(
orgTeamEntity
)
?
orgTeamEntity
.
getTeamName
()
:
""
)),
""
,
LocalDateTimeUtil
.
of
(
request
.
getHappen
()));
}
else
if
(
request
.
getOrderStatus
().
equalsIgnoreCase
(
OrderStatusEnum
.
RESCHEDULED
.
getCode
()))
{
}
else
if
(
request
.
getOrderStatus
().
equalsIgnoreCase
(
OrderStatusEnum
.
RESCHEDULED
.
getCode
()))
{
//组装改约接口
//组装改约接口
OrderReschedule
reschedule
=
new
OrderReschedule
();
OrderReschedule
reschedule
=
new
OrderReschedule
();
...
@@ -189,6 +197,7 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -189,6 +197,7 @@ public class OrderInfoServiceImpl implements OrderInfoService {
if
(
StringUtils
.
isNotBlank
(
request
.
getDescription
()))
{
if
(
StringUtils
.
isNotBlank
(
request
.
getDescription
()))
{
reschedule
.
setDescription
(
request
.
getDescription
());
reschedule
.
setDescription
(
request
.
getDescription
());
}
}
reschedule
.
setOperator
(
"BEAN"
);
return
this
.
orderReschedule
(
reschedule
);
return
this
.
orderReschedule
(
reschedule
);
}
}
...
@@ -222,9 +231,19 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -222,9 +231,19 @@ public class OrderInfoServiceImpl implements OrderInfoService {
order
.
setExpectTimeDesc
(
req
.
getExpectDesc
());
order
.
setExpectTimeDesc
(
req
.
getExpectDesc
());
order
.
setOrderStatus
(
OrderStatusEnum
.
RESCHEDULED
.
getCode
());
order
.
setOrderStatus
(
OrderStatusEnum
.
RESCHEDULED
.
getCode
());
boolean
skillUpdate
=
false
;
boolean
skillUpdate
=
false
;
if
(
CollectionUtils
.
isEmpty
(
req
.
getOrderTags
()))
{
OrgGroupEntity
orgGroupEntity
=
null
;
if
(
StringUtils
.
isNotBlank
(
order
.
getOrgGroupId
()))
{
orgGroupEntity
=
orgGroupDao
.
getByGroupId
(
order
.
getOrgGroupId
());
}
OrgTeamEntity
orgTeamEntity
=
null
;
if
(
StringUtils
.
isNotBlank
(
order
.
getOrgTeamId
()))
{
orgTeamEntity
=
orgTeamDao
.
getByTeamId
(
order
.
getOrgTeamId
());
}
String
engineerName
=
order
.
getEngineerName
();
//处理标签
if
(
CollectionUtils
.
isNotEmpty
(
req
.
getOrderTags
()))
{
if
(
StringUtils
.
isBlank
(
order
.
getBeanTags
()))
{
if
(
StringUtils
.
isBlank
(
order
.
getBeanTags
()))
{
String
joinTags
=
CollectionUtils
.
isEmpty
(
req
.
getOrderTags
())
?
""
:
String
.
join
(
","
,
req
.
getOrderTags
());
String
joinTags
=
String
.
join
(
","
,
req
.
getOrderTags
());
order
.
setBeanTags
(
joinTags
);
order
.
setBeanTags
(
joinTags
);
order
.
setIsMultiple
(
joinTags
.
contains
(
"重物搬运"
)
?
1
:
0
);
order
.
setIsMultiple
(
joinTags
.
contains
(
"重物搬运"
)
?
1
:
0
);
}
else
{
}
else
{
...
@@ -293,13 +312,10 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -293,13 +312,10 @@ public class OrderInfoServiceImpl implements OrderInfoService {
// 当天单变更技能直接人工指派
// 当天单变更技能直接人工指派
if
(
isToday
&&
skillUpdate
)
{
if
(
isToday
&&
skillUpdate
)
{
if
(
order
.
getIsAppointEngineer
()
!=
1
)
{
if
(
order
.
getIsAppointEngineer
()
!=
1
)
{
order
.
setOrgTeamId
(
null
);
order
=
OrderUtil
.
handleErrorOrder
(
order
);
order
.
setOrgGroupId
(
null
);
order
.
setEngineerPhone
(
null
);
order
.
setEngineerName
(
null
);
order
.
setEngineerCode
(
null
);
order
.
setEngineerPhone
(
null
);
teamId
=
null
;
teamId
=
null
;
order
.
setAppointmentMethod
(
AppointmentMethodEnum
.
MANUAL
.
name
());
order
.
setAppointmentStatus
(
OrderFlowEnum
.
INIT
.
name
());
sendMsg
(
order
.
getOrgBranchId
(),
order
.
getOrderId
(),
req
.
getExpectBegin
());
sendMsg
(
order
.
getOrgBranchId
(),
order
.
getOrderId
(),
req
.
getExpectBegin
());
}
}
}
else
{
}
else
{
...
@@ -331,12 +347,12 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -331,12 +347,12 @@ public class OrderInfoServiceImpl implements OrderInfoService {
SkillInfoEntity
skillInfo
=
skillInfoDao
.
getByBrandAndTypeAndSkill
(
order
.
getBrand
(),
order
.
getType
(),
order
.
getSkill
());
SkillInfoEntity
skillInfo
=
skillInfoDao
.
getByBrandAndTypeAndSkill
(
order
.
getBrand
(),
order
.
getType
(),
order
.
getSkill
());
if
(
ObjectUtil
.
isNull
(
capacity
)
||
capacity
.
getStatus
()
!=
1
||
capacity
.
getMaxDuration
()
>
skillInfo
.
getTakeTime
())
{
if
(
ObjectUtil
.
isNull
(
capacity
)
||
capacity
.
getStatus
()
!=
1
||
capacity
.
getMaxDuration
()
>
skillInfo
.
getTakeTime
())
{
order
.
setTranscend
(
1
);
order
.
setTranscend
(
1
);
order
.
setOrgGroupId
(
null
);
order
=
OrderUtil
.
handleErrorOrder
(
order
);
order
.
setOrgTeamId
(
null
);
order
.
setEngineerCode
(
null
);
clusterId
=
order
.
getOrgClusterId
();
clusterId
=
order
.
getOrgClusterId
();
branchId
=
order
.
getOrgBranchId
();
branchId
=
order
.
getOrgBranchId
();
teamId
=
null
;
teamId
=
null
;
order
.
setAppointmentMethod
(
AppointmentMethodEnum
.
MANUAL
.
name
());
order
.
setAppointmentStatus
(
OrderFlowEnum
.
INIT
.
name
());
sendMsg
(
order
.
getOrgBranchId
(),
order
.
getOrderId
(),
req
.
getExpectBegin
());
sendMsg
(
order
.
getOrgBranchId
(),
order
.
getOrderId
(),
req
.
getExpectBegin
());
}
}
}
}
...
@@ -349,12 +365,10 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -349,12 +365,10 @@ public class OrderInfoServiceImpl implements OrderInfoService {
}
else
if
(
isToday
&&
!
isBelong
)
{
}
else
if
(
isToday
&&
!
isBelong
)
{
// b.未派人-改约到当天
// b.未派人-改约到当天
// i.人工指派
// i.人工指派
order
.
setOrgTeamId
(
null
);
order
=
OrderUtil
.
handleErrorOrder
(
order
);
order
.
setOrgGroupId
(
null
);
order
.
setEngineerPhone
(
null
);
order
.
setEngineerName
(
null
);
order
.
setEngineerCode
(
null
);
teamId
=
null
;
teamId
=
null
;
order
.
setAppointmentMethod
(
AppointmentMethodEnum
.
MANUAL
.
name
());
order
.
setAppointmentStatus
(
OrderFlowEnum
.
INIT
.
name
());
sendMsg
(
order
.
getOrgBranchId
(),
order
.
getOrderId
(),
req
.
getExpectBegin
());
sendMsg
(
order
.
getOrgBranchId
(),
order
.
getOrderId
(),
req
.
getExpectBegin
());
}
}
}
}
...
@@ -368,8 +382,9 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -368,8 +382,9 @@ public class OrderInfoServiceImpl implements OrderInfoService {
// 处理特殊时间,cutoff
// 处理特殊时间,cutoff
Integer
special
=
0
;
Integer
special
=
0
;
Integer
cutoff
=
0
;
Integer
cutoff
=
0
;
OrgTeamEntity
teamInfo
=
null
;
if
(
StringUtils
.
isNotBlank
(
teamId
))
{
if
(
StringUtils
.
isNotBlank
(
teamId
))
{
OrgTeamEntity
teamInfo
=
orgTeamDao
.
getByTeamId
(
teamId
);
teamInfo
=
orgTeamDao
.
getByTeamId
(
teamId
);
special
=
CommonUtil
.
isSpecial
(
order
.
getExpectTimeBegin
().
toLocalTime
(),
special
=
CommonUtil
.
isSpecial
(
order
.
getExpectTimeBegin
().
toLocalTime
(),
order
.
getExpectTimeEnd
().
toLocalTime
(),
teamInfo
.
getWorkOn
(),
teamInfo
.
getWorkOff
());
order
.
getExpectTimeEnd
().
toLocalTime
(),
teamInfo
.
getWorkOn
(),
teamInfo
.
getWorkOff
());
cutoff
=
CommonUtil
.
isCutoff
(
order
.
getExpectTimeBegin
(),
teamInfo
.
getWorkOff
());
cutoff
=
CommonUtil
.
isCutoff
(
order
.
getExpectTimeBegin
(),
teamInfo
.
getWorkOff
());
...
@@ -382,11 +397,18 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -382,11 +397,18 @@ public class OrderInfoServiceImpl implements OrderInfoService {
order
.
setOrgBranchId
(
branchId
);
order
.
setOrgBranchId
(
branchId
);
orderInfoDao
.
save
(
order
);
orderInfoDao
.
save
(
order
);
// 登记事件
// 登记事件
commonService
.
addOrderEvent
(
req
.
getOrderId
(),
""
,
"PEA"
,
req
.
getOperator
(),
OrderStatusEnum
.
RESCHEDULED
.
getDescription
(),
OrderStatusEnum
.
RESCHEDULED
.
getDescription
(),
""
);
commonService
.
addOrderEvent
(
req
.
getOrderId
(),
""
,
req
.
getOperator
(),
req
.
getOperator
(),
OrderEventEnum
.
recontracting
.
getEvent
(),
String
.
format
(
OrderEventEnum
.
recontracting
.
getMsg
(),
engineerName
+
"-"
+
(
ObjectUtil
.
isNotNull
(
orgTeamEntity
)
?
orgTeamEntity
.
getTeamName
()
:
""
),
ObjectUtil
.
isNotNull
(
orgGroupEntity
)
?
orgGroupEntity
.
getGroupName
()
:
""
,
req
.
getExpectBegin
(),
req
.
getReschedulingReason
()),
""
);
return
Result
.
success
(
null
);
return
Result
.
success
(
null
);
}
}
/**
* 改约原因
*
* @return
*/
@Override
@Override
public
Result
<?>
orderReschedulingReason
()
{
public
Result
<?>
orderReschedulingReason
()
{
return
Result
.
success
(
OrderReschedulingReason
.
ReschedulingReasonMap
);
return
Result
.
success
(
OrderReschedulingReason
.
ReschedulingReasonMap
);
...
@@ -426,6 +448,9 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -426,6 +448,9 @@ public class OrderInfoServiceImpl implements OrderInfoService {
if
(
fendanResult
.
getCode
().
equals
(
StatusCodeEnum
.
FENDAN_IS_TRANSCEND
.
getCode
()))
{
if
(
fendanResult
.
getCode
().
equals
(
StatusCodeEnum
.
FENDAN_IS_TRANSCEND
.
getCode
()))
{
order
.
setTranscend
(
1
);
order
.
setTranscend
(
1
);
}
}
order
=
OrderUtil
.
handleErrorOrder
(
order
);
order
.
setAppointmentMethod
(
AppointmentMethodEnum
.
MANUAL
.
name
());
order
.
setAppointmentStatus
(
OrderFlowEnum
.
INIT
.
name
());
OrgBranchEntity
branchEntity
=
orgBranchDao
.
findByCitycodeListLike
(
"%"
+
adminDistrict
.
getResult
().
getSubNames
().
getCity
()
+
"%"
);
OrgBranchEntity
branchEntity
=
orgBranchDao
.
findByCitycodeListLike
(
"%"
+
adminDistrict
.
getResult
().
getSubNames
().
getCity
()
+
"%"
);
sendMsg
(
branchEntity
.
getBranchId
(),
order
.
getOrderId
(),
req
.
getExpectBegin
());
sendMsg
(
branchEntity
.
getBranchId
(),
order
.
getOrderId
(),
req
.
getExpectBegin
());
}
else
{
}
else
{
...
...
project-order/src/main/java/com/dituhui/pea/order/utils/OrderUtil.java
0 → 100644
View file @
1eec3c4
package
com
.
dituhui
.
pea
.
order
.
utils
;
import
com.dituhui.pea.order.entity.OrderInfoEntity
;
public
class
OrderUtil
{
/**
* 分单,超派,特殊时间等处理工单指派工程师,网点等数据
*
* @param order
* @return
*/
public
static
OrderInfoEntity
handleErrorOrder
(
OrderInfoEntity
order
)
{
order
.
setOrgTeamId
(
null
);
order
.
setOrgGroupId
(
null
);
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