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 c3f5b81c
authored
Nov 02, 2023
by
huangjinxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:指定工程师,取消工单相关
1 parent
6e1de546
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
43 deletions
project-order/src/main/java/com/dituhui/pea/order/dao/OrgTeamEngineerDao.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/dao/OrgTeamEngineerDao.java
View file @
c3f5b81
...
...
@@ -34,4 +34,6 @@ public interface OrgTeamEngineerDao extends JpaRepository<OrgTeamEngineerEntity,
@Modifying
@Query
(
"UPDATE OrgTeamEngineerEntity tt SET tt.status = :status WHERE tt.teamId = :teamId AND tt.engineerCode IN :engineerCodes"
)
void
updateStatusByEngineerCodes
(
String
teamId
,
List
<
String
>
engineerCodes
,
int
status
);
OrgTeamEngineerEntity
findByEngineerCode
(
String
engineerCode
);
}
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderCreateServiceImpl.java
View file @
c3f5b81
...
...
@@ -80,6 +80,9 @@ public class OrderCreateServiceImpl implements OrderCreateService {
private
EngineerInfoDao
engineerInfoDao
;
@Autowired
private
OrgTeamEngineerDao
orgTeamEngineerDao
;
@Autowired
private
OrderInfoDao
orderInfoDao
;
@Autowired
...
...
@@ -147,7 +150,7 @@ public class OrderCreateServiceImpl implements OrderCreateService {
entity
.
setExpectTimeBegin
(
DateUtil
.
fromDate
(
req
.
getExpectBegin
()));
entity
.
setExpectTimeEnd
(
DateUtil
.
fromDate
(
req
.
getExpectEnd
()));
entity
.
setAppointmentStatus
(
OrderFlowEnum
.
INIT
.
name
());
entity
.
setAppointmentMethod
(
AppointmentMethodEnum
.
AUTO_
NOW
.
name
());
entity
.
setAppointmentMethod
(
AppointmentMethodEnum
.
AUTO_
BATCH
.
name
());
//获取省市区
AdministrativeDistrictReq
administrativeDistrictReq
=
new
AdministrativeDistrictReq
();
administrativeDistrictReq
.
setPoints
(
location
.
getLongitude
()
+
","
+
location
.
getLatitude
());
...
...
@@ -157,47 +160,76 @@ public class OrderCreateServiceImpl implements OrderCreateService {
entity
.
setCity
(
adminDistrict
.
getResult
().
getSubNames
().
getCity
());
entity
.
setCounty
(
adminDistrict
.
getResult
().
getSubNames
().
getCounty
());
}
// 分单处理
Result
<
OrgTeamInfo
>
fendanResult
=
fendanService
.
fendanToGroupCapacity
(
req
,
2
,
entity
.
getExpectTimeBegin
().
toLocalDate
(),
entity
.
getExpectTimeBegin
().
toLocalTime
(),
entity
.
getExpectTimeEnd
().
toLocalTime
());
if
(
fendanResult
.
getCode
().
equals
(
StatusCodeEnum
.
ORDER_SKILL_NOT_EXISTS
.
getCode
()))
{
return
fendanResult
;
}
if
(!
fendanResult
.
getCode
().
equals
(
ResultEnum
.
SUCCESS
.
getCode
())
||
ObjectUtil
.
isNull
(
fendanResult
.
getResult
()))
{
if
(
fendanResult
.
getCode
().
equals
(
StatusCodeEnum
.
FENDAN_IS_TRANSCEND
.
getCode
()))
{
// 处理超派
entity
.
setTranscend
(
1
);
}
OrgBranchEntity
branchEntity
=
orgBranchDao
.
findByCitycodeListLike
(
"%"
+
adminDistrict
.
getResult
().
getSubNames
().
getCity
()
+
"%"
);
entity
.
setOrgClusterId
(
branchEntity
.
getClusterId
());
entity
.
setOrgBranchId
(
branchEntity
.
getBranchId
());
entity
.
setAppointmentMethod
(
AppointmentMethodEnum
.
MANUAL
.
name
());
//发送通知分部消息
sendMsg
(
branchEntity
.
getBranchId
(),
orderId
,
entity
.
getExpectTimeBegin
().
toLocalDate
());
}
else
{
// 根据分单工作队,填写clusterId/branchId/groupId/teamId等
OrgTeamInfo
teamInfo
=
fendanResult
.
getResult
();
entity
.
setOrgClusterId
(
teamInfo
.
getClusterId
());
entity
.
setOrgBranchId
(
teamInfo
.
getBranchId
());
entity
.
setOrgGroupId
(
teamInfo
.
getGroupId
());
entity
.
setOrgTeamId
(
teamInfo
.
getTeamId
());
entity
.
setAppointmentStatus
(
OrderFlowEnum
.
PRE
.
name
());
// 处理指派工程师
entity
.
setIsAppointEngineer
(
req
.
getIsAppointEngineer
());
String
appointEngineerCodes
=
CollectionUtils
.
isEmpty
(
req
.
getAppointEngineerCodes
())
?
""
:
String
.
join
(
","
,
req
.
getAppointEngineerCodes
());
entity
.
setAppointEngineerCodes
(
appointEngineerCodes
);
if
(
req
.
getIsAppointEngineer
()
==
1
)
{
EngineerInfoEntity
engineerInfo
=
engineerInfoDao
.
getByEngineerCode
(
req
.
getAppointEngineerCodes
().
get
(
0
));
OrgTeamEngineerEntity
orgTeamEngineer
=
orgTeamEngineerDao
.
findByEngineerCode
(
req
.
getAppointEngineerCodes
().
get
(
0
));
OrgTeamEntity
byTeamId
=
orgTeamDao
.
getByTeamId
(
orgTeamEngineer
.
getTeamId
());
entity
.
setEngineerCode
(
engineerInfo
.
getEngineerCode
());
entity
.
setEngineerName
(
engineerInfo
.
getName
());
entity
.
setEngineerPhone
(
engineerInfo
.
getPhone
());
entity
.
setEngineerPhone
(
engineerInfo
.
getPhone
());
entity
.
setOrgClusterId
(
byTeamId
.
getClusterId
());
entity
.
setOrgBranchId
(
byTeamId
.
getBranchId
());
entity
.
setOrgGroupId
(
byTeamId
.
getGroupId
());
entity
.
setOrgTeamId
(
byTeamId
.
getTeamId
());
entity
.
setAppointmentMethod
(
AppointmentMethodEnum
.
AUTO_NOW
.
name
());
entity
.
setAppointmentStatus
(
OrderFlowEnum
.
CONFIRM
.
name
());
//特殊时间段
Integer
special
=
CommonUtil
.
isSpecial
(
entity
.
getExpectTimeBegin
().
toLocalTime
(),
entity
.
getExpectTimeEnd
().
toLocalTime
(),
teamInfo
.
getWorkOn
(),
teamInfo
.
getWorkOff
());
Integer
cutoff
=
CommonUtil
.
isCutoff
(
LocalDateTime
.
now
(),
teamInfo
.
getWorkOff
());
// 处理cutoff 动态排班结束后创建的当日单和次日单
boolean
isToday
=
DateUtil
.
judgeTimeIsToday
(
entity
.
getExpectTimeBegin
());
boolean
isTomorrow
=
DateUtil
.
judgeTimeIsisTomorrow
(
entity
.
getExpectTimeBegin
());
// 特殊时间段,当天单,cutoff需要人工处理
if
(
isToday
||
(
isTomorrow
&&
cutoff
==
1
)
||
special
==
1
)
{
//判断是否在今天cutoff之后
entity
.
setIsCutoff
(
cutoff
);
entity
.
setIsSpecialTime
(
special
);
entity
.
getExpectTimeEnd
().
toLocalTime
(),
byTeamId
.
getWorkOn
(),
byTeamId
.
getWorkOff
());
Integer
cutoff
=
CommonUtil
.
isCutoff
(
LocalDateTime
.
now
(),
byTeamId
.
getWorkOff
());
entity
.
setIsCutoff
(
cutoff
);
entity
.
setIsSpecialTime
(
special
);
}
else
{
// 分单处理
Result
<
OrgTeamInfo
>
fendanResult
=
fendanService
.
fendanToGroupCapacity
(
req
,
2
,
entity
.
getExpectTimeBegin
().
toLocalDate
(),
entity
.
getExpectTimeBegin
().
toLocalTime
(),
entity
.
getExpectTimeEnd
().
toLocalTime
());
if
(
fendanResult
.
getCode
().
equals
(
StatusCodeEnum
.
ORDER_SKILL_NOT_EXISTS
.
getCode
()))
{
return
fendanResult
;
}
if
(!
fendanResult
.
getCode
().
equals
(
ResultEnum
.
SUCCESS
.
getCode
())
||
ObjectUtil
.
isNull
(
fendanResult
.
getResult
()))
{
if
(
fendanResult
.
getCode
().
equals
(
StatusCodeEnum
.
FENDAN_IS_TRANSCEND
.
getCode
()))
{
// 处理超派
entity
.
setTranscend
(
1
);
}
OrgBranchEntity
branchEntity
=
orgBranchDao
.
findByCitycodeListLike
(
"%"
+
adminDistrict
.
getResult
().
getSubNames
().
getCity
()
+
"%"
);
entity
.
setOrgClusterId
(
branchEntity
.
getClusterId
());
entity
.
setOrgBranchId
(
branchEntity
.
getBranchId
());
entity
.
setAppointmentMethod
(
AppointmentMethodEnum
.
MANUAL
.
name
());
//发送通知分部消息
sendMsg
(
teamInfo
.
getBranchId
(),
orderId
,
entity
.
getExpectTimeBegin
().
toLocalDate
());
sendMsg
(
branchEntity
.
getBranchId
(),
orderId
,
entity
.
getExpectTimeBegin
().
toLocalDate
());
}
else
{
// 根据分单工作队,填写clusterId/branchId/groupId/teamId等
OrgTeamInfo
teamInfo
=
fendanResult
.
getResult
();
entity
.
setOrgClusterId
(
teamInfo
.
getClusterId
());
entity
.
setOrgBranchId
(
teamInfo
.
getBranchId
());
entity
.
setOrgGroupId
(
teamInfo
.
getGroupId
());
entity
.
setOrgTeamId
(
teamInfo
.
getTeamId
());
entity
.
setAppointmentStatus
(
OrderFlowEnum
.
PRE
.
name
());
//特殊时间段
Integer
special
=
CommonUtil
.
isSpecial
(
entity
.
getExpectTimeBegin
().
toLocalTime
(),
entity
.
getExpectTimeEnd
().
toLocalTime
(),
teamInfo
.
getWorkOn
(),
teamInfo
.
getWorkOff
());
Integer
cutoff
=
CommonUtil
.
isCutoff
(
LocalDateTime
.
now
(),
teamInfo
.
getWorkOff
());
// 处理cutoff 动态排班结束后创建的当日单和次日单
boolean
isToday
=
DateUtil
.
judgeTimeIsToday
(
entity
.
getExpectTimeBegin
());
boolean
isTomorrow
=
DateUtil
.
judgeTimeIsisTomorrow
(
entity
.
getExpectTimeBegin
());
// 特殊时间段,当天单,cutoff需要人工处理
if
(
isToday
||
(
isTomorrow
&&
cutoff
==
1
)
||
special
==
1
)
{
//判断是否在今天cutoff之后
entity
.
setIsCutoff
(
cutoff
);
entity
.
setIsSpecialTime
(
special
);
entity
.
setAppointmentMethod
(
AppointmentMethodEnum
.
MANUAL
.
name
());
entity
.
setAppointmentStatus
(
OrderFlowEnum
.
INIT
.
name
());
//发送通知分部消息
sendMsg
(
teamInfo
.
getBranchId
(),
orderId
,
entity
.
getExpectTimeBegin
().
toLocalDate
());
}
}
}
// 字段转换
entity
.
setSource
(
req
.
getSource
());
entity
.
setOrderId
(
orderId
);
...
...
@@ -226,11 +258,6 @@ public class OrderCreateServiceImpl implements OrderCreateService {
entity
.
setBeanSubStatus
(
""
);
entity
.
setWorkshop
(
false
);
// 处理工程师
entity
.
setIsAppointEngineer
(
req
.
getIsAppointEngineer
());
String
appointEngineerCodes
=
CollectionUtils
.
isEmpty
(
req
.
getAppointEngineerCodes
())
?
""
:
String
.
join
(
","
,
req
.
getAppointEngineerCodes
());
entity
.
setAppointEngineerCodes
(
appointEngineerCodes
);
// 处理技能和标签
SkillInfoEntity
skillInfoEntity
=
skillInfoDao
.
getByBrandAndTypeAndSkill
(
peaBrand
,
req
.
getProductType
(),
req
.
getServiceType
());
assert
skillInfoEntity
!=
null
;
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderInfoServiceImpl.java
View file @
c3f5b81
...
...
@@ -154,8 +154,9 @@ public class OrderInfoServiceImpl implements OrderInfoService {
//记录流程
commonService
.
addOrderEvent
(
request
.
getOrderId
(),
""
,
"BEAN"
,
"BEAN"
,
OrderStatusEnum
.
NORMAL
.
getDescription
(),
request
.
getStage
(),
""
,
LocalDateTimeUtil
.
of
(
request
.
getHappen
()));
}
else
if
(
request
.
getOrderStatus
().
equalsIgnoreCase
(
OrderStatusEnum
.
CANCELED
.
getCode
()))
{
orderInfo
.
setServiceStatus
(
BeanServiceFlowEnum
.
FINISHED
.
getStatus
());
orderInfo
.
setOrderStatus
(
OrderStatusEnum
.
CANCELED
.
getDescription
());
orderInfo
.
setServiceStatus
(
""
);
orderInfo
.
setOrderStatus
(
OrderStatusEnum
.
CANCELED
.
getCode
());
orderInfo
.
setAppointmentStatus
(
""
);
if
(
StringUtils
.
isBlank
(
request
.
getDescription
()))
{
orderInfo
.
setDescription
(
request
.
getDescription
());
}
...
...
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