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 7f60e171
authored
Nov 15, 2023
by
刘鑫
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
https://gitlab.dituhui.com/bsh/project/project
into develop
2 parents
381dd7a1
2ef8fc5d
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
131 additions
and
36 deletions
project-interface/src/main/java/com/dituhui/pea/user/IUser.java
project-order/src/main/java/com/dituhui/pea/order/controller/OrderAssignController.java
project-order/src/main/java/com/dituhui/pea/order/dao/OrgTeamDao.java
project-order/src/main/java/com/dituhui/pea/order/dto/OrderServiceList.java
project-order/src/main/java/com/dituhui/pea/order/dto/param/RecommendEngineersReq.java
project-order/src/main/java/com/dituhui/pea/order/service/OrderAssign.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerGanttServiceImpl.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/OrderServiceListServiceImpl.java
project-user/src/main/java/com/dituhui/pea/user/controller/UserController.java
project-user/src/main/java/com/dituhui/pea/user/service/UserService.java
project-interface/src/main/java/com/dituhui/pea/user/IUser.java
View file @
7f60e17
...
...
@@ -173,6 +173,15 @@ public interface IUser {
* @return
*/
@RequestMapping
(
value
=
"/pea-user/orgs"
,
method
=
RequestMethod
.
GET
)
Result
<
List
<
OrgInfo
>>
orgs
(
String
userId
);
Result
<
List
<
OrgInfo
>>
orgs
(
@RequestParam
(
"userId"
)
String
userId
);
/**
* 获取用户组织
*
* @param userId 查询条件
* @return
*/
@RequestMapping
(
value
=
"/pea-user/orgsNoName"
,
method
=
RequestMethod
.
GET
)
Result
<
List
<
OrgInfo
>>
orgsNoName
(
@RequestParam
(
"userId"
)
String
userId
);
}
project-order/src/main/java/com/dituhui/pea/order/controller/OrderAssignController.java
View file @
7f60e17
...
...
@@ -6,6 +6,7 @@ import com.dituhui.pea.order.common.TimeUtils;
import
com.dituhui.pea.order.dto.OrderAssignReq
;
import
com.dituhui.pea.order.dto.OrderReschedule
;
import
com.dituhui.pea.order.dto.OrderRevokeAssign
;
import
com.dituhui.pea.order.dto.param.RecommendEngineersReq
;
import
com.dituhui.pea.order.service.OrderAssign
;
import
com.dituhui.pea.order.service.OrderInfoService
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -27,14 +28,12 @@ public class OrderAssignController {
private
OrderInfoService
orderInfoService
;
@GetMapping
(
"/order/assign/recommend/engineers"
)
public
Result
<?>
getOrderAssignRecommendEngineers
(
@RequestParam
String
orderId
,
@RequestParam
(
required
=
false
)
String
key
,
@RequestParam
(
required
=
false
)
String
distance
,
@RequestParam
(
required
=
false
)
String
recommend
)
{
public
Result
<?>
getOrderAssignRecommendEngineers
(
RecommendEngineersReq
req
)
{
//服务单指派-推荐技术员列表
Result
<?>
res
=
null
;
try
{
res
=
orderAssign
.
getOrderAssignRecommendEngineers
(
orderId
,
key
,
distance
,
recommend
);
res
=
orderAssign
.
getOrderAssignRecommendEngineers
(
req
);
}
catch
(
BusinessException
e
)
{
return
Result
.
failed
(
e
.
getMessage
());
}
...
...
project-order/src/main/java/com/dituhui/pea/order/dao/OrgTeamDao.java
View file @
7f60e17
...
...
@@ -45,6 +45,12 @@ public interface OrgTeamDao extends JpaRepository<OrgTeamEntity, Integer>, JpaSp
public
List
<
OrgTeamEntity
>
findByTeamIdIn
(
List
<
String
>
ids
);
public
List
<
OrgTeamEntity
>
findByClusterIdIn
(
List
<
String
>
ids
);
public
List
<
OrgTeamEntity
>
findByBranchIdIn
(
List
<
String
>
ids
);
public
List
<
OrgTeamEntity
>
findByGroupIdIn
(
List
<
String
>
ids
);
/**
* 获取工程师所在的工作队
*
...
...
project-order/src/main/java/com/dituhui/pea/order/dto/OrderServiceList.java
View file @
7f60e17
...
...
@@ -34,6 +34,9 @@ public class OrderServiceList {
private
String
serviceStatus
;
private
String
createTime
;
private
String
engineerCode
;
private
String
engineerName
;
private
String
engineerPhone
;
/**
* bean优先级,例如:紧急、正常
*/
...
...
project-order/src/main/java/com/dituhui/pea/order/dto/param/RecommendEngineersReq.java
0 → 100644
View file @
7f60e17
package
com
.
dituhui
.
pea
.
order
.
dto
.
param
;
import
lombok.Data
;
@Data
public
class
RecommendEngineersReq
{
private
String
orderId
;
private
String
key
;
private
String
distance
;
private
String
recommend
;
private
String
userId
;
}
project-order/src/main/java/com/dituhui/pea/order/service/OrderAssign.java
View file @
7f60e17
...
...
@@ -3,6 +3,7 @@ package com.dituhui.pea.order.service;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.order.dto.OrderAssignReq
;
import
com.dituhui.pea.order.dto.OrderReschedule
;
import
com.dituhui.pea.order.dto.param.RecommendEngineersReq
;
import
org.bouncycastle.asn1.cms.TimeStampAndCRL
;
import
java.sql.Timestamp
;
...
...
@@ -12,7 +13,7 @@ import java.time.LocalDateTime;
public
interface
OrderAssign
{
// 服务单指派-推荐技术员列表
Result
<?>
getOrderAssignRecommendEngineers
(
String
orderId
,
String
key
,
String
distance
,
String
recommend
);
Result
<?>
getOrderAssignRecommendEngineers
(
RecommendEngineersReq
req
);
// 服务单指派-指派提交
Result
<?>
orderAssign
(
OrderAssignReq
req
);
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerGanttServiceImpl.java
View file @
7f60e17
...
...
@@ -180,19 +180,19 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
// 最后,还需要根据key进行过滤(需要结合数据库表)
engineerCodes
=
engineerUtils
.
filterEngineersByKey
(
engineerCodes
,
key
).
stream
().
map
(
EngineerInfoEntity:
:
getEngineerCode
).
collect
(
Collectors
.
toList
());
}
if
(
CollectionUtils
.
isNotEmpty
(
orderIds
))
{
List
<
OrderInfoEntity
>
infoEntities
=
orderInfoDao
.
findAllByOrderIdIn
(
orderIds
);
Set
<
String
>
skillGroupCodes
=
Sets
.
newConcurrentHashSet
();
for
(
OrderInfoEntity
orderInfo
:
infoEntities
)
{
//查询对应的技能信息
SkillInfoEntity
skill
=
skillInfoDao
.
getByBrandAndTypeAndSkill
(
orderInfo
.
getBrand
(),
orderInfo
.
getType
(),
orderInfo
.
getSkill
());
if
(
Objects
.
isNull
(
skill
))
{
throw
new
BusinessException
(
"查询不到对应的技能组信息:"
+
String
.
join
(
","
,
orderInfo
.
getType
(),
orderInfo
.
getSkill
()));
}
skillGroupCodes
.
add
(
skill
.
getSkillGroupCode
());
}
engineerCodes
=
engineerInfoDao
.
findByEngineerCodesBySkillCodes
(
engineerCodes
,
skillGroupCodes
);
}
//
if (CollectionUtils.isNotEmpty(orderIds)) {
//
List<OrderInfoEntity> infoEntities = orderInfoDao.findAllByOrderIdIn(orderIds);
//
Set<String> skillGroupCodes = Sets.newConcurrentHashSet();
//
for (OrderInfoEntity orderInfo : infoEntities) {
//
//查询对应的技能信息
//
SkillInfoEntity skill = skillInfoDao.getByBrandAndTypeAndSkill(orderInfo.getBrand(), orderInfo.getType(), orderInfo.getSkill());
//
if (Objects.isNull(skill)) {
//
throw new BusinessException("查询不到对应的技能组信息:" + String.join(",", orderInfo.getType(), orderInfo.getSkill()));
//
}
//
skillGroupCodes.add(skill.getSkillGroupCode());
//
}
//
engineerCodes = engineerInfoDao.findByEngineerCodesBySkillCodes(engineerCodes, skillGroupCodes);
//
}
return
engineerCodes
;
}
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderAssignImpl.java
View file @
7f60e17
...
...
@@ -9,11 +9,14 @@ import com.dituhui.pea.order.common.OrderAssignCheck;
import
com.dituhui.pea.order.common.TimeUtils
;
import
com.dituhui.pea.order.dao.*
;
import
com.dituhui.pea.order.dto.*
;
import
com.dituhui.pea.order.dto.param.RecommendEngineersReq
;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.enums.*
;
import
com.dituhui.pea.order.service.*
;
import
com.dituhui.pea.order.utils.CommonUtil
;
import
com.dituhui.pea.order.utils.OrderUtil
;
import
com.dituhui.pea.pojo.user.OrgInfo
;
import
com.dituhui.pea.user.IUser
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -79,24 +82,27 @@ public class OrderAssignImpl implements OrderAssign {
@Autowired
private
CapacityQueryService
capacityQueryService
;
@Autowired
private
IUser
userService
;
@Transactional
@Override
public
Result
<?>
getOrderAssignRecommendEngineers
(
String
orderId
,
String
key
,
String
distance
,
String
recommend
)
{
public
Result
<?>
getOrderAssignRecommendEngineers
(
RecommendEngineersReq
req
)
{
// 服务单指派-推荐技术员列表
OrderInfoEntity
order
=
orderInfoDao
.
getByOrderId
(
orderId
);
OrderInfoEntity
order
=
orderInfoDao
.
getByOrderId
(
req
.
getOrderId
()
);
if
(
order
==
null
)
{
throw
new
BusinessException
(
"订单不存在"
);
}
String
date
=
TimeUtils
.
IsoLocalDate2String
(
order
.
getDt
());
// 获取符合筛选条件的技术员
List
<
String
>
engineerCodes
=
this
.
searchEngineerCodes
(
order
,
distance
,
key
,
recommend
);
List
<
String
>
engineerCodes
=
this
.
searchEngineerCodes
(
order
,
req
.
getDistance
(),
req
.
getKey
(),
req
.
getRecommend
(),
req
.
getUserId
()
);
List
<
EngineerInfoEntity
>
engineers
=
engineerInfoDao
.
findByEngineerCodeIn
(
engineerCodes
);
List
<
OrderAssignRecommendResp
.
Engineer
>
items
=
new
ArrayList
<>();
for
(
EngineerInfoEntity
engineer
:
engineers
)
{
OrderAssignCheck
.
Result
result
=
orderAssignCheck
.
orderAssignCheck
(
orderId
,
order
.
getDt
(),
engineer
.
getEngineerCode
());
OrderAssignCheck
.
Result
result
=
orderAssignCheck
.
orderAssignCheck
(
req
.
getOrderId
()
,
order
.
getDt
(),
engineer
.
getEngineerCode
());
log
.
info
(
"指派检查结果:{}"
,
result
);
if
(
result
.
getIndex
()
<
0
)
{
continue
;
...
...
@@ -200,16 +206,15 @@ public class OrderAssignImpl implements OrderAssign {
OrgTeamEntity
orgTeam
=
orgTeamDao
.
getByTeamId
(
order
.
getOrgTeamId
());
// 判断cutoff
Integer
cutoff
=
CommonUtil
.
isCutoff
(
order
.
getExpectTimeBegin
(),
orgTeam
.
getWorkOff
());
order
.
setAppointmentStatus
(
OrderFlowEnum
.
INIT
.
name
());
order
.
setServiceStatus
(
OrderFlowEnum
.
INIT
.
name
());
if
(
cutoff
>
0
)
{
// cutoff更新order_request表为人工指派
order
.
setAppointmentStatus
(
AppointmentMethodEnum
.
MANUAL
.
name
());
order
.
setServiceStatus
(
OrderFlowEnum
.
INIT
.
name
());
order
.
setAppointmentMethod
(
AppointmentMethodEnum
.
MANUAL
.
name
());
order
=
OrderUtil
.
handleErrorOrder
(
order
);
order
.
setIsCutoff
(
cutoff
);
}
else
{
// 更新order_request表为未指派
order
.
setAppointmentStatus
(
OrderFlowEnum
.
INIT
.
name
());
order
.
setServiceStatus
(
OrderFlowEnum
.
INIT
.
name
());
order
=
OrderUtil
.
handleErrorOrder2
(
order
);
}
orderInfoDao
.
save
(
order
);
...
...
@@ -248,8 +253,8 @@ public class OrderAssignImpl implements OrderAssign {
return
order
;
}
private
List
<
String
>
searchEngineerCodes
(
OrderInfoEntity
order
,
String
distance
,
String
key
,
String
recommend
)
{
Set
<
String
>
engineerCodes1
=
this
.
searchEngineerByRecommend
(
order
,
recommend
);
private
List
<
String
>
searchEngineerCodes
(
OrderInfoEntity
order
,
String
distance
,
String
key
,
String
recommend
,
String
userId
)
{
Set
<
String
>
engineerCodes1
=
this
.
searchEngineerByRecommend
(
order
,
recommend
,
userId
);
if
(
engineerCodes1
.
isEmpty
())
{
log
.
info
(
"recommend:{}筛选条件未找到技术员"
,
recommend
);
return
new
ArrayList
<>();
...
...
@@ -295,27 +300,48 @@ public class OrderAssignImpl implements OrderAssign {
return
new
ArrayList
<>(
engineerCodes1
);
}
private
Set
<
String
>
searchEngineerByRecommend
(
OrderInfoEntity
order
,
String
recommend
)
{
private
Set
<
String
>
searchEngineerByRecommend
(
OrderInfoEntity
order
,
String
recommend
,
String
userId
)
{
if
(
StringUtils
.
isNotEmpty
(
recommend
)
&&
recommend
.
equals
(
"team"
))
{
return
orgTeamEngineerDao
.
findAllByTeamId
(
order
.
getOrgTeamId
()).
stream
().
map
(
OrgTeamEngineerEntity:
:
getEngineerCode
).
collect
(
Collectors
.
toSet
());
}
String
levelType
;
String
levelValue
;
String
levelType
=
null
;
String
levelValue
=
null
;
List
<
OrgTeamEntity
>
teams
=
new
ArrayList
<>();
if
(
StringUtils
.
isEmpty
(
recommend
)
||
recommend
.
equals
(
"branch"
))
{
levelType
=
"branch"
;
levelValue
=
order
.
getOrgBranchId
();
}
else
if
(
recommend
.
equals
(
"group"
))
{
levelType
=
"group"
;
levelValue
=
order
.
getOrgGroupId
();
}
else
if
(
recommend
.
equals
(
"all"
))
{
levelType
=
"cluster"
;
levelValue
=
order
.
getOrgClusterId
();
}
else
if
(
recommend
.
equals
(
"all"
)
&&
StringUtils
.
isNotBlank
(
userId
))
{
Result
<
List
<
OrgInfo
>>
listResult
=
userService
.
orgsNoName
(
userId
);
if
(
CollectionUtils
.
isEmpty
(
listResult
.
getResult
()))
{
return
new
HashSet
<>();
}
List
<
OrgInfo
>
orgInfos
=
listResult
.
getResult
();
Integer
orgLevel
=
orgInfos
.
get
(
0
).
getOrgLevel
();
List
<
String
>
collect
=
orgInfos
.
stream
().
map
(
OrgInfo:
:
getId
).
collect
(
Collectors
.
toList
());
switch
(
orgLevel
)
{
case
-
1
:
teams
=
orgTeamDao
.
findAll
();
break
;
case
0
:
teams
=
orgTeamDao
.
findByClusterIdIn
(
collect
);
break
;
case
1
:
teams
=
orgTeamDao
.
findByBranchIdIn
(
collect
);
break
;
case
2
:
teams
=
orgTeamDao
.
findByGroupIdIn
(
collect
);
break
;
}
List
<
String
>
groupIds
=
teams
.
stream
().
map
(
OrgTeamEntity:
:
getGroupId
).
collect
(
Collectors
.
toList
());
return
engineerInfoDao
.
findByGroupIdIn
(
groupIds
).
stream
().
map
(
EngineerInfoEntity:
:
getEngineerCode
).
collect
(
Collectors
.
toSet
());
}
else
{
return
new
HashSet
<>();
}
List
<
OrgTeamEntity
>
teams
=
new
ArrayList
<>();
if
(
levelType
.
equals
(
"cluster"
))
{
teams
=
orgTeamDao
.
findAllByClusterId
(
levelValue
);
}
else
if
(
levelType
.
equals
(
"branch"
))
{
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderServiceListServiceImpl.java
View file @
7f60e17
...
...
@@ -160,6 +160,9 @@ public class OrderServiceListServiceImpl implements OrderServiceListService {
record
.
setAddressId
(
o
.
getAddressId
());
record
.
setIsCutoff
(
o
.
getIsCutoff
());
record
.
setReschedulingReason
(
o
.
getReschedulingReason
());
record
.
setEngineerName
(
o
.
getEngineerName
());
record
.
setEngineerCode
(
o
.
getEngineerCode
());
record
.
setEngineerPhone
(
o
.
getEngineerPhone
());
record
.
setActualStartTime
(
ObjectUtil
.
isNull
(
o
.
getActualStartTime
())
?
""
:
TimeUtils
.
IsoTimestamp2DateTime
(
o
.
getActualStartTime
()));
record
.
setActualEndTime
(
ObjectUtil
.
isNull
(
o
.
getActualEndTime
())
?
""
:
TimeUtils
.
IsoTimestamp2DateTime
(
o
.
getActualEndTime
()));
...
...
project-user/src/main/java/com/dituhui/pea/user/controller/UserController.java
View file @
7f60e17
...
...
@@ -166,4 +166,11 @@ public class UserController implements IUser {
return
Result
.
success
(
orgInfos
);
}
@Override
public
Result
<
List
<
OrgInfo
>>
orgsNoName
(
String
userId
)
{
List
<
OrgInfo
>
orgInfos
=
userService
.
orgsNoName
(
userId
);
return
Result
.
success
(
orgInfos
);
}
}
project-user/src/main/java/com/dituhui/pea/user/service/UserService.java
View file @
7f60e17
...
...
@@ -887,4 +887,32 @@ public class UserService {
});
return
orgInfos
;
}
public
List
<
OrgInfo
>
orgsNoName
(
String
userId
)
{
List
<
OrgInfo
>
orgInfos
=
new
ArrayList
<>();
// 获取角色
List
<
UserRoleEntity
>
userRoles
=
userRoleDao
.
findByUserId
(
userId
);
if
(
CollectionUtils
.
isEmpty
(
userRoles
))
{
return
null
;
}
List
<
String
>
ids
=
userRoles
.
stream
().
map
(
r
->
r
.
getRoleId
()).
collect
(
Collectors
.
toList
());
if
(
ids
.
contains
(
Globals
.
SUPER_ADMIN_ID
))
{
OrgInfo
orgInfo
=
new
OrgInfo
();
orgInfo
.
setId
(
"admin"
);
orgInfo
.
setOrgLevel
(-
1
);
orgInfos
.
add
(
orgInfo
);
return
orgInfos
;
}
List
<
UserOrgEntity
>
byUserId
=
userOrgDao
.
findByUserId
(
userId
);
if
(
CollectionUtils
.
isEmpty
(
byUserId
))
{
return
orgInfos
;
}
byUserId
.
forEach
(
e
->
{
OrgInfo
orgInfo
=
new
OrgInfo
();
orgInfo
.
setId
(
e
.
getOrgId
());
orgInfo
.
setOrgLevel
(
e
.
getOrgLevel
());
orgInfos
.
add
(
orgInfo
);
});
return
orgInfos
;
}
}
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