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 0c5828bd
authored
Nov 23, 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
06e41c0d
5bd34645
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
453 additions
and
67 deletions
project-dispatch/src/main/java/com/dituhui/pea/dispatch/dao/DispatchOrderRepository.java
project-dispatch/src/main/java/com/dituhui/pea/dispatch/service/impl/ExtractServiceImpl.java
project-dispatch/src/main/resources/application-dev.yaml
project-interface/src/main/java/com/dituhui/pea/pojo/DistanceDTO.java
project-interface/src/main/java/com/dituhui/pea/pojo/user/UserMenuSettingInfo.java
project-interface/src/main/java/com/dituhui/pea/user/IUser.java
project-order/src/main/java/com/dituhui/pea/order/controller/BusinessBlockController.java
project-order/src/main/java/com/dituhui/pea/order/dao/OrderInfoDao.java
project-order/src/main/java/com/dituhui/pea/order/dto/OrderServiceListReq.java
project-order/src/main/java/com/dituhui/pea/order/dto/ScheduleEngineerOverviewResp.java
project-order/src/main/java/com/dituhui/pea/order/enums/OrderFlowEnum.java
project-order/src/main/java/com/dituhui/pea/order/service/BusinessBlockService.java
project-order/src/main/java/com/dituhui/pea/order/service/EngineerCalendarService.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/BusinessBlockServiceImpl.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/EngineerCalendarServiceImpl.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/OrderInfoServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderServiceDetailImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderServiceListServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/ScheduleServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/utils/OrderUtil.java
project-user/src/main/java/com/dituhui/pea/user/Application.java → project-user/src/main/java/com/dituhui/pea/user/UserApplication.java
project-user/src/main/java/com/dituhui/pea/user/controller/UserController.java
project-user/src/main/java/com/dituhui/pea/user/dao/UserMenuSettingDao.java
project-user/src/main/java/com/dituhui/pea/user/entity/UserMenuSettingEntity.java
project-user/src/main/java/com/dituhui/pea/user/service/UserService.java
project-user/src/main/resources/application-dev.yaml
project-user/src/main/resources/application.yaml
project-dispatch/src/main/java/com/dituhui/pea/dispatch/dao/DispatchOrderRepository.java
View file @
0c5828b
...
@@ -44,7 +44,7 @@ public interface DispatchOrderRepository extends CrudRepository<DispatchOrder, L
...
@@ -44,7 +44,7 @@ public interface DispatchOrderRepository extends CrudRepository<DispatchOrder, L
+
" CONCAT(a.brand, '-', a.type, '-', a.skill) skills , a.take_time , a.appointment_status status\n"
+
" CONCAT(a.brand, '-', a.type, '-', a.skill) skills , a.take_time , a.appointment_status status\n"
+
" FROM order_info a \n"
+
" WHERE a.org_team_id=?3 AND a.dt = ?4 AND bean_status='OPEN'\n"
+
" FROM order_info a \n"
+
" WHERE a.org_team_id=?3 AND a.dt = ?4 AND bean_status='OPEN'\n"
+
" AND (appointment_method like 'AUTO%' or appointment_method='MANUAL') AND a.appointment_status IN ('INIT', 'PRE')\n"
+
" AND (appointment_method like 'AUTO%' or appointment_method='MANUAL') AND a.appointment_status IN ('INIT', 'PRE')\n"
+
" AND order_status
='NORMAL'
AND service_status='INIT'\n"
+
" AND order_status
in ('NORMAL','RESCHEDULED')
AND service_status='INIT'\n"
+
" ORDER BY a.expect_time_begin ASC \n"
,
+
" ORDER BY a.expect_time_begin ASC \n"
,
nativeQuery
=
true
)
nativeQuery
=
true
)
List
<
Map
<
String
,
Object
>>
getNewDispatchOrder
(
String
groupId
,
String
batchNo
,
String
teamId
,
String
batchDay
);
List
<
Map
<
String
,
Object
>>
getNewDispatchOrder
(
String
groupId
,
String
batchNo
,
String
teamId
,
String
batchDay
);
...
@@ -58,7 +58,7 @@ public interface DispatchOrderRepository extends CrudRepository<DispatchOrder, L
...
@@ -58,7 +58,7 @@ public interface DispatchOrderRepository extends CrudRepository<DispatchOrder, L
" from order_info a \n"
+
" from order_info a \n"
+
" where a.org_team_id=?3 and a.dt = ?4 and bean_status='OPEN'\n"
+
" where a.org_team_id=?3 and a.dt = ?4 and bean_status='OPEN'\n"
+
" and (appointment_method like 'AUTO%' or appointment_method='MANUAL') and a.appointment_status in ('CONFIRM')\n"
+
" and (appointment_method like 'AUTO%' or appointment_method='MANUAL') and a.appointment_status in ('CONFIRM')\n"
+
" and order_status
='NORMAL'
and service_status='INIT'\n"
+
" and order_status
in ('NORMAL','RESCHEDULED')
and service_status='INIT'\n"
+
" order by a.expect_time_begin asc "
,
" order by a.expect_time_begin asc "
,
nativeQuery
=
true
)
nativeQuery
=
true
)
List
<
Map
<
String
,
Object
>>
getNewDispatchConfirmOrder
(
String
groupId
,
String
batchNo
,
String
teamId
,
String
batchDay
);
List
<
Map
<
String
,
Object
>>
getNewDispatchConfirmOrder
(
String
groupId
,
String
batchNo
,
String
teamId
,
String
batchDay
);
...
...
project-dispatch/src/main/java/com/dituhui/pea/dispatch/service/impl/ExtractServiceImpl.java
View file @
0c5828b
...
@@ -106,10 +106,11 @@ public class ExtractServiceImpl implements ExtractService {
...
@@ -106,10 +106,11 @@ public class ExtractServiceImpl implements ExtractService {
OrderInfo
orderInfo
=
orderOpt
.
get
();
OrderInfo
orderInfo
=
orderOpt
.
get
();
if
(!(
"OPEN"
.
equals
(
orderInfo
.
getBeanStatus
())
&&
if
(!(
"OPEN"
.
equals
(
orderInfo
.
getBeanStatus
())
Set
.
of
(
"AUTO_NOW"
,
"AUTO_BATCH"
).
contains
(
orderInfo
.
getAppointmentMethod
())
&&
&&
Set
.
of
(
"AUTO_NOW"
,
"AUTO_BATCH"
,
"MANUAL"
).
contains
(
orderInfo
.
getAppointmentMethod
())
Set
.
of
(
"INIT"
,
"PRE"
).
contains
(
orderInfo
.
getAppointmentStatus
())
&&
&&
Set
.
of
(
"INIT"
,
"PRE"
,
"CONFIRM"
).
contains
(
orderInfo
.
getAppointmentStatus
())
"NORMAL"
.
equals
(
orderInfo
.
getOrderStatus
())
&&
"INIT"
.
equals
(
orderInfo
.
getServiceStatus
())))
{
&&
Set
.
of
(
"NORMAL"
,
"RESCHEDULED"
).
contains
(
orderInfo
.
getOrderStatus
())
&&
"INIT"
.
equals
(
orderInfo
.
getServiceStatus
())))
{
log
.
warn
(
"算法结果更新到工单, step1.1-loop, 工单状态异常, groupId:{}, batchNo:{}, orderId:{}, bean-status:{}, appointment-status:{}, order-status:{}, service-status:{}"
,
log
.
warn
(
"算法结果更新到工单, step1.1-loop, 工单状态异常, groupId:{}, batchNo:{}, orderId:{}, bean-status:{}, appointment-status:{}, order-status:{}, service-status:{}"
,
groupId
,
batchNo
,
orderId
,
orderInfo
.
getBeanStatus
(),
orderInfo
.
getAppointmentStatus
(),
orderInfo
.
getOrderStatus
(),
orderInfo
.
getServiceStatus
());
groupId
,
batchNo
,
orderId
,
orderInfo
.
getBeanStatus
(),
orderInfo
.
getAppointmentStatus
(),
orderInfo
.
getOrderStatus
(),
orderInfo
.
getServiceStatus
());
...
@@ -236,7 +237,7 @@ public class ExtractServiceImpl implements ExtractService {
...
@@ -236,7 +237,7 @@ public class ExtractServiceImpl implements ExtractService {
if
(!(
"OPEN"
.
equals
(
orderInfo
.
getBeanStatus
())
if
(!(
"OPEN"
.
equals
(
orderInfo
.
getBeanStatus
())
&&
Set
.
of
(
"AUTO_NOW"
,
"AUTO_BATCH"
,
"MANUAL"
).
contains
(
orderInfo
.
getAppointmentMethod
())
&&
Set
.
of
(
"AUTO_NOW"
,
"AUTO_BATCH"
,
"MANUAL"
).
contains
(
orderInfo
.
getAppointmentMethod
())
&&
Set
.
of
(
"INIT"
,
"PRE"
,
"CONFIRM"
).
contains
(
orderInfo
.
getAppointmentStatus
())
&&
Set
.
of
(
"INIT"
,
"PRE"
,
"CONFIRM"
).
contains
(
orderInfo
.
getAppointmentStatus
())
&&
"NORMAL"
.
equal
s
(
orderInfo
.
getOrderStatus
())
&&
Set
.
of
(
"NORMAL"
,
"RESCHEDULED"
).
contain
s
(
orderInfo
.
getOrderStatus
())
&&
"INIT"
.
equals
(
orderInfo
.
getServiceStatus
())))
{
&&
"INIT"
.
equals
(
orderInfo
.
getServiceStatus
())))
{
log
.
warn
(
"算法结果更新到工单, step1.1-loop, 工单状态异常, teamId:{}, batchNo:{}, orderId:{}, bean-status:{}, appointment-status:{}, order-status:{}, service-status:{}"
,
log
.
warn
(
"算法结果更新到工单, step1.1-loop, 工单状态异常, teamId:{}, batchNo:{}, orderId:{}, bean-status:{}, appointment-status:{}, order-status:{}, service-status:{}"
,
...
@@ -293,8 +294,8 @@ public class ExtractServiceImpl implements ExtractService {
...
@@ -293,8 +294,8 @@ public class ExtractServiceImpl implements ExtractService {
orderInfo
.
setEngineerCode
(
""
);
orderInfo
.
setEngineerCode
(
""
);
orderInfo
.
setEngineerName
(
""
);
orderInfo
.
setEngineerName
(
""
);
orderInfo
.
setEngineerPhone
(
""
);
orderInfo
.
setEngineerPhone
(
""
);
orderInfo
.
setPlanStartTime
(
null
);
orderInfo
.
setPlanStartTime
(
orderInfo
.
getExpectTimeBegin
()
);
orderInfo
.
setPlanEndTime
(
null
);
orderInfo
.
setPlanEndTime
(
orderInfo
.
getExpectTimeEnd
()
);
orderInfo
.
setArriveElapsed
(
0
);
orderInfo
.
setArriveElapsed
(
0
);
orderInfo
.
setArriveDistance
(
0
);
orderInfo
.
setArriveDistance
(
0
);
orderInfo
.
setAppointmentStatus
(
"INIT"
);
orderInfo
.
setAppointmentStatus
(
"INIT"
);
...
...
project-dispatch/src/main/resources/application-dev.yaml
View file @
0c5828b
...
@@ -3,7 +3,7 @@ server:
...
@@ -3,7 +3,7 @@ server:
dispatch
:
dispatch
:
cron
:
cron
:
expr
:
0
58
8-23 * * ?
expr
:
0
22
8-23 * * ?
next-day-limit
:
2
next-day-limit
:
2
scheduler
:
scheduler
:
...
...
project-interface/src/main/java/com/dituhui/pea/pojo/DistanceDTO.java
View file @
0c5828b
...
@@ -6,7 +6,7 @@ import lombok.Data;
...
@@ -6,7 +6,7 @@ import lombok.Data;
public
class
DistanceDTO
{
public
class
DistanceDTO
{
/**
/**
* 单位 公里
* 单位 米
*/
*/
float
dis
;
float
dis
;
/**
/**
...
...
project-interface/src/main/java/com/dituhui/pea/pojo/user/UserMenuSettingInfo.java
0 → 100644
View file @
0c5828b
package
com
.
dituhui
.
pea
.
pojo
.
user
;
import
lombok.Data
;
import
org.springframework.data.annotation.CreatedDate
;
import
org.springframework.data.annotation.LastModifiedDate
;
import
java.io.Serializable
;
import
java.util.Date
;
@Data
public
class
UserMenuSettingInfo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
7231322653202273612L
;
/**
* 主键
*/
private
String
id
;
/**
* 账号
*/
private
String
userId
;
/**
* 菜单
*/
private
String
menu
;
/**
* 设置
*/
private
String
setting
;
}
project-interface/src/main/java/com/dituhui/pea/user/IUser.java
View file @
0c5828b
...
@@ -3,6 +3,7 @@ package com.dituhui.pea.user;
...
@@ -3,6 +3,7 @@ package com.dituhui.pea.user;
import
com.dituhui.pea.common.PageResult
;
import
com.dituhui.pea.common.PageResult
;
import
com.dituhui.pea.pojo.*
;
import
com.dituhui.pea.pojo.*
;
import
com.dituhui.pea.pojo.user.OrgInfo
;
import
com.dituhui.pea.pojo.user.OrgInfo
;
import
com.dituhui.pea.pojo.user.UserMenuSettingInfo
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestHeader
;
import
org.springframework.web.bind.annotation.RequestHeader
;
...
@@ -184,4 +185,21 @@ public interface IUser {
...
@@ -184,4 +185,21 @@ public interface IUser {
@RequestMapping
(
value
=
"/pea-user/orgsNoName"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/pea-user/orgsNoName"
,
method
=
RequestMethod
.
GET
)
Result
<
List
<
OrgInfo
>>
orgsNoName
(
@RequestParam
(
"userId"
)
String
userId
);
Result
<
List
<
OrgInfo
>>
orgsNoName
(
@RequestParam
(
"userId"
)
String
userId
);
/**
* 获取用户组织
*
* @param userId 查询条件
* @return
*/
@RequestMapping
(
value
=
"/pea-user/getSettings"
,
method
=
RequestMethod
.
GET
)
Result
<
List
<
UserMenuSettingInfo
>>
getSettings
(
@RequestHeader
(
"userId"
)
String
userId
);
/**
* 获取用户组织
*
* @return
*/
@RequestMapping
(
value
=
"/pea-user/saveSetting"
,
method
=
RequestMethod
.
POST
)
Result
saveSetting
(
@RequestBody
UserMenuSettingInfo
menuSettingInfo
);
}
}
project-order/src/main/java/com/dituhui/pea/order/controller/BusinessBlockController.java
View file @
0c5828b
...
@@ -6,6 +6,8 @@ import com.dituhui.pea.order.dto.BusinessServiceBlockAddReqDTO;
...
@@ -6,6 +6,8 @@ import com.dituhui.pea.order.dto.BusinessServiceBlockAddReqDTO;
import
com.dituhui.pea.order.dto.BusinessServiceBlockRemoveReqDTO
;
import
com.dituhui.pea.order.dto.BusinessServiceBlockRemoveReqDTO
;
import
com.dituhui.pea.order.dto.BusinessServiceBlockUpdateReqDTO
;
import
com.dituhui.pea.order.dto.BusinessServiceBlockUpdateReqDTO
;
import
com.dituhui.pea.order.service.BusinessBlockService
;
import
com.dituhui.pea.order.service.BusinessBlockService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -26,16 +28,29 @@ public class BusinessBlockController {
...
@@ -26,16 +28,29 @@ public class BusinessBlockController {
* @param size 分页-页大小
* @param size 分页-页大小
* @param layerId 图层ID(筛选项)
* @param layerId 图层ID(筛选项)
* @param teamId 小队ID(筛选项)
* @param teamId 小队ID(筛选项)
* @param orderBy 排序字段 默认"updateTime"
* @param direction 排序方向 desc降序/asc升序 默认"desc"
* @return
* @return
*/
*/
@GetMapping
(
"/business/service/block/list"
)
@GetMapping
(
"/business/service/block/list"
)
public
Result
<?>
businessSeverBlocks
(
@RequestParam
String
levelType
,
@RequestParam
String
levelValue
,
public
Result
<?>
businessSeverBlocks
(
@RequestParam
String
levelType
,
@RequestParam
String
levelValue
,
@RequestParam
int
page
,
@RequestParam
int
size
,
@RequestParam
int
page
,
@RequestParam
int
size
,
@RequestParam
(
required
=
false
)
String
layerId
,
@RequestParam
(
required
=
false
)
String
layerId
,
@RequestParam
(
required
=
false
)
String
teamId
)
{
@RequestParam
(
required
=
false
)
String
teamId
,
@RequestParam
(
required
=
false
)
String
orderBy
,
@RequestParam
(
required
=
false
)
String
direction
)
{
if
(
StringUtils
.
isEmpty
(
orderBy
))
{
orderBy
=
"updateTime"
;
}
if
(
StringUtils
.
isEmpty
(
direction
))
{
direction
=
"desc"
;
}
Result
<?>
res
=
null
;
Result
<?>
res
=
null
;
try
{
try
{
res
=
businessBlockService
.
businessServerBlocks
(
levelType
,
levelValue
,
page
,
size
,
layerId
,
teamId
);
res
=
businessBlockService
.
businessServerBlocks
(
levelType
,
levelValue
,
page
,
size
,
layerId
,
teamId
,
orderBy
,
direction
);
}
catch
(
BusinessException
e
)
{
}
catch
(
BusinessException
e
)
{
return
Result
.
failed
(
e
.
getMessage
());
return
Result
.
failed
(
e
.
getMessage
());
}
}
...
...
project-order/src/main/java/com/dituhui/pea/order/dao/OrderInfoDao.java
View file @
0c5828b
...
@@ -32,6 +32,8 @@ public interface OrderInfoDao extends JpaRepository<OrderInfoEntity, Long>, JpaS
...
@@ -32,6 +32,8 @@ public interface OrderInfoDao extends JpaRepository<OrderInfoEntity, Long>, JpaS
List
<
OrderInfoEntity
>
findByEngineerCodeAndDtAndAppointmentStatusIn
(
String
engineerCode
,
LocalDate
dt
,
List
<
String
>
appointmentStatus
,
Sort
sort
);
List
<
OrderInfoEntity
>
findByEngineerCodeAndDtAndAppointmentStatusIn
(
String
engineerCode
,
LocalDate
dt
,
List
<
String
>
appointmentStatus
,
Sort
sort
);
List
<
OrderInfoEntity
>
findByDtAndEngineerCode
(
LocalDate
dt
,
String
engineerCode
,
Sort
sort
);
List
<
OrderInfoEntity
>
findByDtAndOrgTeamIdAndAppointmentStatusIn
(
LocalDate
dt
,
String
orgTeamId
,
List
<
String
>
appointmentStatus
);
List
<
OrderInfoEntity
>
findByDtAndOrgTeamIdAndAppointmentStatusIn
(
LocalDate
dt
,
String
orgTeamId
,
List
<
String
>
appointmentStatus
);
OrderInfoEntity
findTopBySkillAndAppointmentStatus
(
String
skill
,
String
status
);
OrderInfoEntity
findTopBySkillAndAppointmentStatus
(
String
skill
,
String
status
);
...
@@ -82,27 +84,27 @@ public interface OrderInfoDao extends JpaRepository<OrderInfoEntity, Long>, JpaS
...
@@ -82,27 +84,27 @@ public interface OrderInfoDao extends JpaRepository<OrderInfoEntity, Long>, JpaS
@Query
(
value
=
"SELECT count(*) from order_info WHERE dt =:dt and (service_status ='INIT' or service_status ='CONTACTED') "
+
@Query
(
value
=
"SELECT count(*) from order_info WHERE dt =:dt and (service_status ='INIT' or service_status ='CONTACTED') "
+
"and DATE_
ADD(NOW(), INTERVAL 10 MINUTE) > expect_time_begin
and org_cluster_id = :orgCusterId"
,
nativeQuery
=
true
)
"and DATE_
SUB(NOW(), INTERVAL 10 MINUTE) > plan_start_time
and org_cluster_id = :orgCusterId"
,
nativeQuery
=
true
)
long
countDelayByDtAndOrgClusterId
(
LocalDate
dt
,
String
orgCusterId
);
long
countDelayByDtAndOrgClusterId
(
LocalDate
dt
,
String
orgCusterId
);
@Query
(
value
=
"SELECT count(*) from order_info WHERE dt =:dt and (service_status ='INIT' or service_status ='CONTACTED') "
+
@Query
(
value
=
"SELECT count(*) from order_info WHERE dt =:dt and (service_status ='INIT' or service_status ='CONTACTED') "
+
"and DATE_
ADD(NOW(), INTERVAL 10 MINUTE) > expect_time_begin
and org_group_id = :orgGroupId"
,
nativeQuery
=
true
)
"and DATE_
SUB(NOW(), INTERVAL 10 MINUTE) > plan_start_time
and org_group_id = :orgGroupId"
,
nativeQuery
=
true
)
long
countDelayByDtAndOrgGroupId
(
LocalDate
dt
,
String
orgGroupId
);
long
countDelayByDtAndOrgGroupId
(
LocalDate
dt
,
String
orgGroupId
);
@Query
(
value
=
"SELECT count(*) from order_info WHERE dt =:dt and (service_status ='INIT' or service_status ='CONTACTED') "
+
@Query
(
value
=
"SELECT count(*) from order_info WHERE dt =:dt and (service_status ='INIT' or service_status ='CONTACTED') "
+
"and DATE_
ADD(NOW(), INTERVAL 10 MINUTE) > expect_time_begin
and org_branch_id = :orgBranchId"
,
nativeQuery
=
true
)
"and DATE_
SUB(NOW(), INTERVAL 10 MINUTE) > plan_start_time
and org_branch_id = :orgBranchId"
,
nativeQuery
=
true
)
long
countDelayByDtAndOrgBranchId
(
LocalDate
dt
,
String
orgBranchId
);
long
countDelayByDtAndOrgBranchId
(
LocalDate
dt
,
String
orgBranchId
);
@Query
(
value
=
"SELECT count(*) from order_info WHERE dt =:dt and service_status ='STARTED' and actual_end_time is null "
+
@Query
(
value
=
"SELECT count(*) from order_info WHERE dt =:dt and service_status ='STARTED' and actual_end_time is null "
+
"and DATE_
ADD
(NOW(), INTERVAL 10 MINUTE) > plan_end_time and org_cluster_id = :orgCusterId"
,
nativeQuery
=
true
)
"and DATE_
SUB
(NOW(), INTERVAL 10 MINUTE) > plan_end_time and org_cluster_id = :orgCusterId"
,
nativeQuery
=
true
)
long
countOvertimeByDtAndOrgClusterId
(
LocalDate
dt
,
String
orgCusterId
);
long
countOvertimeByDtAndOrgClusterId
(
LocalDate
dt
,
String
orgCusterId
);
@Query
(
value
=
"SELECT count(*) from order_info WHERE dt =:dt and service_status ='STARTED' and actual_end_time is null "
+
@Query
(
value
=
"SELECT count(*) from order_info WHERE dt =:dt and service_status ='STARTED' and actual_end_time is null "
+
"and DATE_
ADD
(NOW(), INTERVAL 10 MINUTE) > plan_end_time and org_group_id = :orgGroupId"
,
nativeQuery
=
true
)
"and DATE_
SUB
(NOW(), INTERVAL 10 MINUTE) > plan_end_time and org_group_id = :orgGroupId"
,
nativeQuery
=
true
)
long
countOvertimeByDtAndOrgGroupId
(
LocalDate
dt
,
String
orgGroupId
);
long
countOvertimeByDtAndOrgGroupId
(
LocalDate
dt
,
String
orgGroupId
);
@Query
(
value
=
"SELECT count(*) from order_info WHERE dt =:dt and service_status ='STARTED' and actual_end_time is null "
+
@Query
(
value
=
"SELECT count(*) from order_info WHERE dt =:dt and service_status ='STARTED' and actual_end_time is null "
+
"and DATE_
ADD
(NOW(), INTERVAL 10 MINUTE) > plan_end_time and org_branch_id = :orgBranchId"
,
nativeQuery
=
true
)
"and DATE_
SUB
(NOW(), INTERVAL 10 MINUTE) > plan_end_time and org_branch_id = :orgBranchId"
,
nativeQuery
=
true
)
long
countOvertimeByDtAndOrgBranchId
(
LocalDate
dt
,
String
orgBranchId
);
long
countOvertimeByDtAndOrgBranchId
(
LocalDate
dt
,
String
orgBranchId
);
@Query
(
value
=
"from OrderInfoEntity where orderStatus <> 'CANCELED'"
@Query
(
value
=
"from OrderInfoEntity where orderStatus <> 'CANCELED'"
...
...
project-order/src/main/java/com/dituhui/pea/order/dto/OrderServiceListReq.java
View file @
0c5828b
...
@@ -43,4 +43,14 @@ public class OrderServiceListReq {
...
@@ -43,4 +43,14 @@ public class OrderServiceListReq {
* 服务状态
* 服务状态
*/
*/
private
List
<
String
>
serviceStatus
;
private
List
<
String
>
serviceStatus
;
/**
* 1所需工时、2创建时间、3预约单状态、4指派状态、5指派策略、6服务状态 默认2创建时间
*/
private
Integer
orderByField
=
2
;
/**
* 1正序、2倒序 默认2倒序
*/
private
Integer
orderBy
=
2
;
}
}
\ No newline at end of file
project-order/src/main/java/com/dituhui/pea/order/dto/ScheduleEngineerOverviewResp.java
View file @
0c5828b
...
@@ -22,6 +22,7 @@ public class ScheduleEngineerOverviewResp {
...
@@ -22,6 +22,7 @@ public class ScheduleEngineerOverviewResp {
private
String
type
;
private
String
type
;
private
String
skill
;
private
String
skill
;
private
String
orderStatus
;
private
String
orderStatus
;
private
String
serviceStatus
;
private
String
orderStatusName
;
private
String
orderStatusName
;
/**
/**
* 在途公里数
* 在途公里数
...
...
project-order/src/main/java/com/dituhui/pea/order/enums/OrderFlowEnum.java
View file @
0c5828b
...
@@ -4,6 +4,6 @@ package com.dituhui.pea.order.enums;
...
@@ -4,6 +4,6 @@ package com.dituhui.pea.order.enums;
* 订单流程枚举类
* 订单流程枚举类
*/
*/
public
enum
OrderFlowEnum
{
public
enum
OrderFlowEnum
{
// 指派状态: INIT-待指派/PRE-预指派/CONFIRM-确认指派(通知BEAN)
// 指派状态: INIT-待指派/PRE-预指派/CONFIRM-确认指派(通知BEAN)
/CANCELED-已取消
INIT
,
PRE
,
CONFIRM
,
INIT
,
PRE
,
CONFIRM
,
CANCELED
}
}
project-order/src/main/java/com/dituhui/pea/order/service/BusinessBlockService.java
View file @
0c5828b
...
@@ -4,7 +4,7 @@ import com.dituhui.pea.common.Result;
...
@@ -4,7 +4,7 @@ import com.dituhui.pea.common.Result;
public
interface
BusinessBlockService
{
public
interface
BusinessBlockService
{
Result
<?>
businessServerBlocks
(
String
levelType
,
String
levelValue
,
int
page
,
int
size
,
String
layerId
,
String
teamId
);
Result
<?>
businessServerBlocks
(
String
levelType
,
String
levelValue
,
int
page
,
int
size
,
String
layerId
,
String
teamId
,
String
orderBy
,
String
direction
);
Result
<?>
businessServiceBlockAdd
(
String
layerId
,
String
teamId
);
Result
<?>
businessServiceBlockAdd
(
String
layerId
,
String
teamId
);
...
...
project-order/src/main/java/com/dituhui/pea/order/service/EngineerCalendarService.java
View file @
0c5828b
...
@@ -102,4 +102,14 @@ public interface EngineerCalendarService {
...
@@ -102,4 +102,14 @@ public interface EngineerCalendarService {
* @return 全天休息(含请假)返回true, 否则false
* @return 全天休息(含请假)返回true, 否则false
*/
*/
boolean
engineerTargetLeave
(
String
engineerCode
,
LocalDate
targetDate
);
boolean
engineerTargetLeave
(
String
engineerCode
,
LocalDate
targetDate
);
/**
* 判定工程师当天是否请假(非派工时间)或者休息
*
* @param engineerCode 工程师编号
* @param targetDate 目标日期
* @return 休息(含请假)返回true, 否则false
*/
boolean
engineerDayLeave
(
String
engineerCode
,
LocalDate
targetDate
);
}
}
project-order/src/main/java/com/dituhui/pea/order/service/impl/BusinessBlockServiceImpl.java
View file @
0c5828b
...
@@ -62,7 +62,7 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
...
@@ -62,7 +62,7 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
private
EncryptionUtil
encryptionUtil
;
private
EncryptionUtil
encryptionUtil
;
@Override
@Override
public
Result
<?>
businessServerBlocks
(
String
levelType
,
String
levelValue
,
int
page
,
int
size
,
String
layerId
,
String
teamId
)
{
public
Result
<?>
businessServerBlocks
(
String
levelType
,
String
levelValue
,
int
page
,
int
size
,
String
layerId
,
String
teamId
,
String
orderBy
,
String
direction
)
{
BusinessServerBlocksRespDTO
resp
=
new
BusinessServerBlocksRespDTO
();
BusinessServerBlocksRespDTO
resp
=
new
BusinessServerBlocksRespDTO
();
List
<
OrgTeamEntity
>
teams
=
new
ArrayList
<>();
List
<
OrgTeamEntity
>
teams
=
new
ArrayList
<>();
...
@@ -116,7 +116,19 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
...
@@ -116,7 +116,19 @@ public class BusinessBlockServiceImpl implements BusinessBlockService {
}
}
return
criteriaBuilder
.
and
(
statusPredicate
,
teamIdPredicate
,
layerIdPredicate
);
return
criteriaBuilder
.
and
(
statusPredicate
,
teamIdPredicate
,
layerIdPredicate
);
};
};
Sort
sort
=
Sort
.
by
(
Sort
.
Order
.
asc
(
"teamId"
));
Sort
sort
=
null
;
switch
(
direction
)
{
case
"asc"
:
case
"ASC"
:
case
"Asc"
:
sort
=
Sort
.
by
(
Sort
.
Order
.
asc
(
orderBy
));
break
;
case
"desc"
:
case
"DESC"
:
case
"Desc"
:
sort
=
Sort
.
by
(
Sort
.
Order
.
desc
(
orderBy
));
break
;
}
PageRequest
pageRequest
=
PageRequest
.
of
(
page
-
1
,
size
,
sort
);
PageRequest
pageRequest
=
PageRequest
.
of
(
page
-
1
,
size
,
sort
);
Page
<
MapBlockInfoEntity
>
pg
=
mapBlockInfoDao
.
findAll
(
specification
,
pageRequest
);
Page
<
MapBlockInfoEntity
>
pg
=
mapBlockInfoDao
.
findAll
(
specification
,
pageRequest
);
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/DispatchServiceImpl.java
View file @
0c5828b
...
@@ -7,6 +7,7 @@ import com.dituhui.pea.common.ResultEnum;
...
@@ -7,6 +7,7 @@ import com.dituhui.pea.common.ResultEnum;
import
com.dituhui.pea.enums.StatusCodeEnum
;
import
com.dituhui.pea.enums.StatusCodeEnum
;
import
com.dituhui.pea.order.common.ListUtils
;
import
com.dituhui.pea.order.common.ListUtils
;
import
com.dituhui.pea.order.common.TimeUtils
;
import
com.dituhui.pea.order.common.TimeUtils
;
import
com.dituhui.pea.order.common.jackson.JsonUtil
;
import
com.dituhui.pea.order.dao.*
;
import
com.dituhui.pea.order.dao.*
;
import
com.dituhui.pea.order.dto.DispatchEngineerOrderListReq
;
import
com.dituhui.pea.order.dto.DispatchEngineerOrderListReq
;
import
com.dituhui.pea.order.dto.DispatchEngineerOrderListResp
;
import
com.dituhui.pea.order.dto.DispatchEngineerOrderListResp
;
...
@@ -348,6 +349,7 @@ public class DispatchServiceImpl implements DispatchService {
...
@@ -348,6 +349,7 @@ public class DispatchServiceImpl implements DispatchService {
SkillInfoEntity
skill
=
skillInfoDao
.
getByBrandAndTypeAndSkill
(
CommonUtil
.
fixBrand
(
entity
.
getBrand
()),
entity
.
getType
(),
entity
.
getSkill
());
SkillInfoEntity
skill
=
skillInfoDao
.
getByBrandAndTypeAndSkill
(
CommonUtil
.
fixBrand
(
entity
.
getBrand
()),
entity
.
getType
(),
entity
.
getSkill
());
List
<
OrderInfoEntity
>
engineerOrders
=
orderInfoDao
.
findByDtAndEngineerCode
(
localDate
,
engineer
.
getEngineerCode
());
List
<
OrderInfoEntity
>
engineerOrders
=
orderInfoDao
.
findByDtAndEngineerCode
(
localDate
,
engineer
.
getEngineerCode
());
Result
<
OrderInfoEntity
>
entityResult
=
orderInfoService
.
insterEngineerOrders
(
engineerOrders
,
entity
,
skill
,
byTeamId
,
engineer
);
Result
<
OrderInfoEntity
>
entityResult
=
orderInfoService
.
insterEngineerOrders
(
engineerOrders
,
entity
,
skill
,
byTeamId
,
engineer
);
log
.
info
(
"插入订单信息------------->{}"
,
JsonUtil
.
toJson
(
entityResult
));
if
(!
entityResult
.
getCode
().
equals
(
ResultEnum
.
SUCCESS
.
getCode
()))
{
if
(!
entityResult
.
getCode
().
equals
(
ResultEnum
.
SUCCESS
.
getCode
()))
{
// return Result.failed("当前工程师无法预约合适时间");
// return Result.failed("当前工程师无法预约合适时间");
errorList
.
add
(
"单号:"
+
entity
.
getOrderId
());
errorList
.
add
(
"单号:"
+
entity
.
getOrderId
());
...
@@ -361,6 +363,7 @@ public class DispatchServiceImpl implements DispatchService {
...
@@ -361,6 +363,7 @@ public class DispatchServiceImpl implements DispatchService {
entity
.
setAppointmentStatus
(
OrderFlowEnum
.
CONFIRM
.
name
());
entity
.
setAppointmentStatus
(
OrderFlowEnum
.
CONFIRM
.
name
());
entity
.
setAppointmentMethod
(
AppointmentMethodEnum
.
MANUAL
.
name
());
entity
.
setAppointmentMethod
(
AppointmentMethodEnum
.
MANUAL
.
name
());
entity
.
setOrgTeamId
(
byTeamId
.
getTeamId
());
entity
.
setOrgTeamId
(
byTeamId
.
getTeamId
());
entity
.
setOrgGroupId
(
byTeamId
.
getGroupId
());
entity
.
setOrgBranchId
(
byTeamId
.
getBranchId
());
entity
.
setOrgBranchId
(
byTeamId
.
getBranchId
());
entity
.
setOrgClusterId
(
byTeamId
.
getClusterId
());
entity
.
setOrgClusterId
(
byTeamId
.
getClusterId
());
orderInfoDao
.
save
(
entity
);
orderInfoDao
.
save
(
entity
);
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerCalendarServiceImpl.java
View file @
0c5828b
...
@@ -748,6 +748,18 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
...
@@ -748,6 +748,18 @@ public class EngineerCalendarServiceImpl implements EngineerCalendarService {
return
true
;
return
true
;
}
}
@Override
public
boolean
engineerDayLeave
(
String
engineerCode
,
LocalDate
targetDate
)
{
boolean
leaveDay
=
engineerWorkDay
(
engineerCode
,
targetDate
);
if
(!
leaveDay
)
{
return
leaveDay
;
}
//日程表事件记录时间
List
<
CapacityEngineerCalendarEntity
>
configs
=
capacityEngineerCalendarDao
.
findCalendarByWorkdayAndEngineerCode
(
DateTimeUtil
.
formatDate
(
targetDate
),
engineerCode
);
return
!
CollectionUtils
.
isEmpty
(
configs
);
}
private
EngineerCalendarDTO
.
Calendar
getEmptyCalendar
(
String
teamId
,
String
date
)
{
private
EngineerCalendarDTO
.
Calendar
getEmptyCalendar
(
String
teamId
,
String
date
)
{
// 初始化一天的日历
// 初始化一天的日历
EngineerCalendarDTO
.
Calendar
calendar
=
new
EngineerCalendarDTO
.
Calendar
();
EngineerCalendarDTO
.
Calendar
calendar
=
new
EngineerCalendarDTO
.
Calendar
();
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderAssignImpl.java
View file @
0c5828b
...
@@ -10,6 +10,7 @@ import com.dituhui.pea.order.common.OrderAssignCheck;
...
@@ -10,6 +10,7 @@ import com.dituhui.pea.order.common.OrderAssignCheck;
import
com.dituhui.pea.order.common.Stapial4jUtil
;
import
com.dituhui.pea.order.common.Stapial4jUtil
;
import
com.dituhui.pea.order.common.TimeUtils
;
import
com.dituhui.pea.order.common.TimeUtils
;
import
com.dituhui.pea.order.common.jackson.DateUtil
;
import
com.dituhui.pea.order.common.jackson.DateUtil
;
import
com.dituhui.pea.order.common.jackson.JsonUtil
;
import
com.dituhui.pea.order.dao.EngineerInfoDao
;
import
com.dituhui.pea.order.dao.EngineerInfoDao
;
import
com.dituhui.pea.order.dao.EngineerSkillGroupDao
;
import
com.dituhui.pea.order.dao.EngineerSkillGroupDao
;
import
com.dituhui.pea.order.dao.OrderInfoDao
;
import
com.dituhui.pea.order.dao.OrderInfoDao
;
...
@@ -232,6 +233,7 @@ public class OrderAssignImpl implements OrderAssign {
...
@@ -232,6 +233,7 @@ public class OrderAssignImpl implements OrderAssign {
//判断工程师订单当日工单时间安排
//判断工程师订单当日工单时间安排
List
<
OrderInfoEntity
>
engineerOrders
=
orderInfoDao
.
findByDtAndEngineerCode
(
entity
.
getDt
(),
engineer
.
getEngineerCode
());
List
<
OrderInfoEntity
>
engineerOrders
=
orderInfoDao
.
findByDtAndEngineerCode
(
entity
.
getDt
(),
engineer
.
getEngineerCode
());
Result
<
OrderInfoEntity
>
entityResult
=
orderInfoService
.
insterEngineerOrders
(
engineerOrders
,
entity
,
skill
,
byTeamId
,
engineer
);
Result
<
OrderInfoEntity
>
entityResult
=
orderInfoService
.
insterEngineerOrders
(
engineerOrders
,
entity
,
skill
,
byTeamId
,
engineer
);
log
.
info
(
"插入订单信息------------->{}"
,
JsonUtil
.
toJson
(
entityResult
));
if
(!
entityResult
.
getCode
().
equals
(
ResultEnum
.
SUCCESS
.
getCode
()))
{
if
(!
entityResult
.
getCode
().
equals
(
ResultEnum
.
SUCCESS
.
getCode
()))
{
String
desc
=
StatusCodeEnum
.
ENGINEER_IS_LEAVE_TIME
.
getDesc
();
String
desc
=
StatusCodeEnum
.
ENGINEER_IS_LEAVE_TIME
.
getDesc
();
desc
=
String
.
format
(
desc
,
orderId
,
engineer
.
getName
());
desc
=
String
.
format
(
desc
,
orderId
,
engineer
.
getName
());
...
@@ -245,6 +247,7 @@ public class OrderAssignImpl implements OrderAssign {
...
@@ -245,6 +247,7 @@ public class OrderAssignImpl implements OrderAssign {
entity
.
setAppointmentStatus
(
OrderFlowEnum
.
CONFIRM
.
name
());
entity
.
setAppointmentStatus
(
OrderFlowEnum
.
CONFIRM
.
name
());
entity
.
setAppointmentMethod
(
AppointmentMethodEnum
.
MANUAL
.
name
());
entity
.
setAppointmentMethod
(
AppointmentMethodEnum
.
MANUAL
.
name
());
entity
.
setOrgTeamId
(
byTeamId
.
getTeamId
());
entity
.
setOrgTeamId
(
byTeamId
.
getTeamId
());
entity
.
setOrgGroupId
(
byTeamId
.
getGroupId
());
entity
.
setOrgBranchId
(
byTeamId
.
getBranchId
());
entity
.
setOrgBranchId
(
byTeamId
.
getBranchId
());
entity
.
setOrgClusterId
(
byTeamId
.
getClusterId
());
entity
.
setOrgClusterId
(
byTeamId
.
getClusterId
());
orderInfoDao
.
save
(
entity
);
orderInfoDao
.
save
(
entity
);
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderInfoServiceImpl.java
View file @
0c5828b
This diff is collapsed.
Click to expand it.
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderServiceDetailImpl.java
View file @
0c5828b
...
@@ -21,6 +21,7 @@ import com.dituhui.pea.order.entity.OrderInfoEntity;
...
@@ -21,6 +21,7 @@ import com.dituhui.pea.order.entity.OrderInfoEntity;
import
com.dituhui.pea.order.entity.OrgGroupEntity
;
import
com.dituhui.pea.order.entity.OrgGroupEntity
;
import
com.dituhui.pea.order.entity.SkillInfoEntity
;
import
com.dituhui.pea.order.entity.SkillInfoEntity
;
import
com.dituhui.pea.order.service.OrderServiceDetail
;
import
com.dituhui.pea.order.service.OrderServiceDetail
;
import
com.dituhui.pea.order.utils.OrderUtil
;
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
;
...
@@ -82,7 +83,7 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
...
@@ -82,7 +83,7 @@ public class OrderServiceDetailImpl implements OrderServiceDetail {
res
.
setStatus
(
order
.
getOrderStatus
());
res
.
setStatus
(
order
.
getOrderStatus
());
res
.
setAppointmentStatus
(
order
.
getAppointmentStatus
());
res
.
setAppointmentStatus
(
order
.
getAppointmentStatus
());
res
.
setOrderStatus
(
order
.
getOrderStatus
());
res
.
setOrderStatus
(
order
.
getOrderStatus
());
res
.
setServiceStatus
(
order
.
getServiceStatus
(
));
res
.
setServiceStatus
(
OrderUtil
.
handleServiceStatus
(
order
));
res
.
setLocation
(
String
.
format
(
"%s,%s"
,
order
.
getX
(),
order
.
getY
()));
res
.
setLocation
(
String
.
format
(
"%s,%s"
,
order
.
getX
(),
order
.
getY
()));
res
.
setItems
(
items
);
res
.
setItems
(
items
);
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderServiceListServiceImpl.java
View file @
0c5828b
...
@@ -13,13 +13,16 @@ import com.dituhui.pea.order.dto.OrderServiceList;
...
@@ -13,13 +13,16 @@ import com.dituhui.pea.order.dto.OrderServiceList;
import
com.dituhui.pea.order.dto.OrderServiceListReq
;
import
com.dituhui.pea.order.dto.OrderServiceListReq
;
import
com.dituhui.pea.order.dto.OrderServiceListResp
;
import
com.dituhui.pea.order.dto.OrderServiceListResp
;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.enums.ServiceStatusEnum
;
import
com.dituhui.pea.order.service.OrderServiceListService
;
import
com.dituhui.pea.order.service.OrderServiceListService
;
import
com.dituhui.pea.order.utils.OrderUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -61,7 +64,21 @@ public class OrderServiceListServiceImpl implements OrderServiceListService {
...
@@ -61,7 +64,21 @@ public class OrderServiceListServiceImpl implements OrderServiceListService {
lqw
.
in
(
StringUtils
.
isNotEmpty
(
reqDTO
.
getOrderId
()),
OrderInfo:
:
getOrderId
,
reqDTO
.
getOrderId
().
split
(
","
));
lqw
.
in
(
StringUtils
.
isNotEmpty
(
reqDTO
.
getOrderId
()),
OrderInfo:
:
getOrderId
,
reqDTO
.
getOrderId
().
split
(
","
));
}
}
lqw
.
eq
(
StringUtils
.
isNotEmpty
(
reqDTO
.
getPhone
()),
OrderInfo:
:
getPhone
,
reqDTO
.
getPhone
());
lqw
.
eq
(
StringUtils
.
isNotEmpty
(
reqDTO
.
getPhone
()),
OrderInfo:
:
getPhone
,
reqDTO
.
getPhone
());
lqw
.
in
(
ListUtils
.
isNotEmpty
(
reqDTO
.
getServiceStatus
()),
OrderInfo:
:
getServiceStatus
,
reqDTO
.
getServiceStatus
());
if
(
ListUtils
.
isNotEmpty
(
reqDTO
.
getServiceStatus
()))
{
List
<
String
>
serviceStatus
=
reqDTO
.
getServiceStatus
();
if
(
serviceStatus
.
contains
(
ServiceStatusEnum
.
DELAY
.
getCode
()))
{
serviceStatus
.
add
(
ServiceStatusEnum
.
INIT
.
getCode
());
serviceStatus
.
add
(
ServiceStatusEnum
.
CONTACTED
.
getCode
());
lqw
.
le
(
OrderInfo:
:
getPlanStartTime
,
LocalDateTime
.
now
().
minusMinutes
(
10
));
}
if
(
serviceStatus
.
contains
(
ServiceStatusEnum
.
UNFINISHED
.
getCode
()))
{
serviceStatus
.
add
(
ServiceStatusEnum
.
STARTED
.
getCode
());
lqw
.
isNotNull
(
OrderInfo:
:
getActualEndTime
);
lqw
.
le
(
OrderInfo:
:
getPlanEndTime
,
LocalDateTime
.
now
().
minusMinutes
(
10
));
}
serviceStatus
=
serviceStatus
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
lqw
.
in
(
OrderInfo:
:
getServiceStatus
,
serviceStatus
);
}
lqw
.
in
(
ListUtils
.
isNotEmpty
(
reqDTO
.
getOrderStatus
()),
OrderInfo:
:
getOrderStatus
,
reqDTO
.
getOrderStatus
());
lqw
.
in
(
ListUtils
.
isNotEmpty
(
reqDTO
.
getOrderStatus
()),
OrderInfo:
:
getOrderStatus
,
reqDTO
.
getOrderStatus
());
lqw
.
in
(
ListUtils
.
isNotEmpty
(
reqDTO
.
getBranchIds
()),
OrderInfo:
:
getOrgBranchId
,
reqDTO
.
getBranchIds
());
lqw
.
in
(
ListUtils
.
isNotEmpty
(
reqDTO
.
getBranchIds
()),
OrderInfo:
:
getOrgBranchId
,
reqDTO
.
getBranchIds
());
lqw
.
in
(
ListUtils
.
isNotEmpty
(
reqDTO
.
getGroupIds
()),
OrderInfo:
:
getOrgGroupId
,
reqDTO
.
getGroupIds
());
lqw
.
in
(
ListUtils
.
isNotEmpty
(
reqDTO
.
getGroupIds
()),
OrderInfo:
:
getOrgGroupId
,
reqDTO
.
getGroupIds
());
...
@@ -69,8 +86,7 @@ public class OrderServiceListServiceImpl implements OrderServiceListService {
...
@@ -69,8 +86,7 @@ public class OrderServiceListServiceImpl implements OrderServiceListService {
lqw
.
in
(
ListUtils
.
isNotEmpty
(
reqDTO
.
getAppointmentType
()),
OrderInfo:
:
getAppointmentMethod
,
reqDTO
.
getAppointmentType
());
lqw
.
in
(
ListUtils
.
isNotEmpty
(
reqDTO
.
getAppointmentType
()),
OrderInfo:
:
getAppointmentMethod
,
reqDTO
.
getAppointmentType
());
lqw
.
in
(
ListUtils
.
isNotEmpty
(
reqDTO
.
getAppointmentStatus
()),
OrderInfo:
:
getAppointmentStatus
,
reqDTO
.
getAppointmentStatus
());
lqw
.
in
(
ListUtils
.
isNotEmpty
(
reqDTO
.
getAppointmentStatus
()),
OrderInfo:
:
getAppointmentStatus
,
reqDTO
.
getAppointmentStatus
());
lqw
.
in
(
ListUtils
.
isNotEmpty
(
reqDTO
.
getPriorities
()),
OrderInfo:
:
getBeanPriority
,
reqDTO
.
getPriorities
());
lqw
.
in
(
ListUtils
.
isNotEmpty
(
reqDTO
.
getPriorities
()),
OrderInfo:
:
getBeanPriority
,
reqDTO
.
getPriorities
());
lqw
.
orderByDesc
(
OrderInfo:
:
getCreateTime
);
lqw
=
handleOrderBy
(
lqw
,
reqDTO
);
if
(
ListUtils
.
isNotEmpty
(
reqDTO
.
getEngineerCodes
()))
{
if
(
ListUtils
.
isNotEmpty
(
reqDTO
.
getEngineerCodes
()))
{
lqw
.
and
(
w
->
lqw
.
and
(
w
->
w
.
in
(
OrderInfo:
:
getEngineerCode
,
reqDTO
.
getEngineerCodes
())
w
.
in
(
OrderInfo:
:
getEngineerCode
,
reqDTO
.
getEngineerCodes
())
...
@@ -149,7 +165,7 @@ public class OrderServiceListServiceImpl implements OrderServiceListService {
...
@@ -149,7 +165,7 @@ public class OrderServiceListServiceImpl implements OrderServiceListService {
record
.
setAppointmentType
(
o
.
getAppointmentMethod
());
record
.
setAppointmentType
(
o
.
getAppointmentMethod
());
record
.
setAppointmentStatus
(
o
.
getAppointmentStatus
());
record
.
setAppointmentStatus
(
o
.
getAppointmentStatus
());
record
.
setOrderStatus
(
o
.
getOrderStatus
());
record
.
setOrderStatus
(
o
.
getOrderStatus
());
record
.
setServiceStatus
(
o
.
getServiceStatus
(
));
record
.
setServiceStatus
(
OrderUtil
.
handleServiceStatus
(
o
));
record
.
setDispatcher
(
o
.
getDispatcher
());
record
.
setDispatcher
(
o
.
getDispatcher
());
record
.
setCreateTime
(
TimeUtils
.
IsoTimestamp2DateTime
(
o
.
getCreateTime
()));
record
.
setCreateTime
(
TimeUtils
.
IsoTimestamp2DateTime
(
o
.
getCreateTime
()));
...
@@ -195,6 +211,35 @@ public class OrderServiceListServiceImpl implements OrderServiceListService {
...
@@ -195,6 +211,35 @@ public class OrderServiceListServiceImpl implements OrderServiceListService {
}
}
/**
/**
* 处理订单排序
*
* @param lqw
* @param reqDTO
* @return
*/
private
LambdaQueryWrapper
<
OrderInfo
>
handleOrderBy
(
LambdaQueryWrapper
<
OrderInfo
>
lqw
,
OrderServiceListReq
reqDTO
)
{
if
(
reqDTO
.
getOrderByField
()
==
1
)
{
lqw
.
orderBy
(
true
,
reqDTO
.
getOrderBy
()
==
1
,
OrderInfo:
:
getTakeTime
);
}
if
(
reqDTO
.
getOrderByField
()
==
2
)
{
lqw
.
orderBy
(
true
,
reqDTO
.
getOrderBy
()
==
1
,
OrderInfo:
:
getCreateTime
);
}
if
(
reqDTO
.
getOrderByField
()
==
3
)
{
lqw
.
orderBy
(
true
,
reqDTO
.
getOrderBy
()
==
1
,
OrderInfo:
:
getOrderStatus
);
}
if
(
reqDTO
.
getOrderByField
()
==
4
)
{
lqw
.
orderBy
(
true
,
reqDTO
.
getOrderBy
()
==
1
,
OrderInfo:
:
getAppointmentStatus
);
}
if
(
reqDTO
.
getOrderByField
()
==
5
)
{
lqw
.
orderBy
(
true
,
reqDTO
.
getOrderBy
()
==
1
,
OrderInfo:
:
getAppointmentMethod
);
}
if
(
reqDTO
.
getOrderByField
()
==
6
)
{
lqw
.
orderBy
(
true
,
reqDTO
.
getOrderBy
()
==
1
,
OrderInfo:
:
getServiceStatus
);
}
return
lqw
;
}
/**
* 获取团队配件仓地址
* 获取团队配件仓地址
*
*
* @param orders
* @param orders
...
@@ -271,7 +316,7 @@ public class OrderServiceListServiceImpl implements OrderServiceListService {
...
@@ -271,7 +316,7 @@ public class OrderServiceListServiceImpl implements OrderServiceListService {
record
.
setAppointmentType
(
o
.
getAppointmentMethod
());
record
.
setAppointmentType
(
o
.
getAppointmentMethod
());
record
.
setAppointmentStatus
(
o
.
getAppointmentStatus
());
record
.
setAppointmentStatus
(
o
.
getAppointmentStatus
());
record
.
setOrderStatus
(
o
.
getOrderStatus
());
record
.
setOrderStatus
(
o
.
getOrderStatus
());
record
.
setServiceStatus
(
o
.
getServiceStatus
(
));
record
.
setServiceStatus
(
OrderUtil
.
handleServiceStatus
(
o
));
record
.
setDispatcher
(
o
.
getDispatcher
());
record
.
setDispatcher
(
o
.
getDispatcher
());
record
.
setCreateTime
(
TimeUtils
.
IsoLocalDateTime2String
(
o
.
getCreateTime
()));
record
.
setCreateTime
(
TimeUtils
.
IsoLocalDateTime2String
(
o
.
getCreateTime
()));
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/ScheduleServiceImpl.java
View file @
0c5828b
...
@@ -14,9 +14,13 @@ import com.dituhui.pea.order.dao.*;
...
@@ -14,9 +14,13 @@ import com.dituhui.pea.order.dao.*;
import
com.dituhui.pea.order.dto.*
;
import
com.dituhui.pea.order.dto.*
;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.entity.*
;
import
com.dituhui.pea.order.enums.OrderFlowEnum
;
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.enums.VehicleEnum
;
import
com.dituhui.pea.order.enums.VehicleEnum
;
import
com.dituhui.pea.order.service.EngineerCalendarService
;
import
com.dituhui.pea.order.service.ScheduleService
;
import
com.dituhui.pea.order.service.ScheduleService
;
import
com.dituhui.pea.order.utils.CommonUtil
;
import
com.dituhui.pea.order.utils.CommonUtil
;
import
com.dituhui.pea.order.utils.OrderUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.PageRequest
;
...
@@ -62,6 +66,9 @@ public class ScheduleServiceImpl implements ScheduleService {
...
@@ -62,6 +66,9 @@ public class ScheduleServiceImpl implements ScheduleService {
@Autowired
@Autowired
private
SkillInfoDao
skillInfoDao
;
private
SkillInfoDao
skillInfoDao
;
@Autowired
private
EngineerCalendarService
engineerCalendarService
;
@Override
@Override
public
Result
<?>
getScheduleSummary
(
LocalDate
date
,
String
levelType
,
List
<
String
>
levelValue
)
{
public
Result
<?>
getScheduleSummary
(
LocalDate
date
,
String
levelType
,
List
<
String
>
levelValue
)
{
List
<
ScheduleSummaryResp
.
ItemDTO
>
items
=
new
ArrayList
<>();
List
<
ScheduleSummaryResp
.
ItemDTO
>
items
=
new
ArrayList
<>();
...
@@ -210,7 +217,7 @@ public class ScheduleServiceImpl implements ScheduleService {
...
@@ -210,7 +217,7 @@ public class ScheduleServiceImpl implements ScheduleService {
EngineerInfoEntity
engineer
=
engineerInfoDao
.
getByEngineerCode
(
engineerCode
);
EngineerInfoEntity
engineer
=
engineerInfoDao
.
getByEngineerCode
(
engineerCode
);
if
(
engineer
==
null
)
{
if
(
engineer
==
null
)
{
throw
new
BusinessException
(
"
分销员
不存在"
);
throw
new
BusinessException
(
"
工程师
不存在"
);
}
}
EngineerBusinessEntity
engineerBusinessEntity
=
engineerBusinessDao
.
getByEngineerCode
(
engineerCode
);
EngineerBusinessEntity
engineerBusinessEntity
=
engineerBusinessDao
.
getByEngineerCode
(
engineerCode
);
List
<
LabelValueDTO
>
emptyTips
=
new
ArrayList
<>();
List
<
LabelValueDTO
>
emptyTips
=
new
ArrayList
<>();
...
@@ -222,9 +229,11 @@ public class ScheduleServiceImpl implements ScheduleService {
...
@@ -222,9 +229,11 @@ public class ScheduleServiceImpl implements ScheduleService {
sortType
=
"asc"
;
sortType
=
"asc"
;
}
}
Sort
sort
=
Sort
.
by
(
Sort
.
Direction
.
valueOf
(
sortType
.
toUpperCase
()),
sortColumn
);
Sort
sort
=
Sort
.
by
(
Sort
.
Direction
.
valueOf
(
sortType
.
toUpperCase
()),
sortColumn
);
//查询包含已取消在内所以工单,后续数据筛选只用预指派和确认指派数据
List
<
OrderInfoEntity
>
orderAppointments
=
orderInfoDao
.
findByEngineerCodeAndDtAndAppointmentStatusIn
(
List
<
OrderInfoEntity
>
orderAppointmentsAll
=
orderInfoDao
.
findByDtAndEngineerCode
(
date
,
engineerCode
,
sort
);
engineerCode
,
date
,
List
.
of
(
OrderFlowEnum
.
PRE
.
name
(),
OrderFlowEnum
.
CONFIRM
.
name
()),
sort
);
List
<
OrderInfoEntity
>
orderAppointments
=
orderAppointmentsAll
.
stream
().
filter
(
e
->
(
e
.
getAppointmentStatus
()
.
equals
(
OrderFlowEnum
.
PRE
.
name
()))
||
e
.
getAppointmentStatus
().
equals
(
OrderFlowEnum
.
CONFIRM
.
name
()))
.
collect
(
Collectors
.
toList
());
List
<
TimeLineDTO
>
timelines
=
new
ArrayList
<>();
List
<
TimeLineDTO
>
timelines
=
new
ArrayList
<>();
int
sumDistance
=
0
;
int
sumDistance
=
0
;
int
sumElapsed
=
0
;
int
sumElapsed
=
0
;
...
@@ -247,8 +256,11 @@ public class ScheduleServiceImpl implements ScheduleService {
...
@@ -247,8 +256,11 @@ public class ScheduleServiceImpl implements ScheduleService {
}
}
Map
<
String
,
List
<
OrderInfoEntity
>>
statusGroup
=
orderAppointments
.
stream
().
collect
(
Collectors
.
groupingBy
(
OrderInfoEntity:
:
getServiceStatus
));
Map
<
String
,
List
<
OrderInfoEntity
>>
statusGroup
=
orderAppointments
.
stream
().
collect
(
Collectors
.
groupingBy
(
OrderInfoEntity:
:
getServiceStatus
));
Map
<
String
,
List
<
OrderInfoEntity
>>
orderStatusGroup
=
orderAppointmentsAll
.
stream
().
collect
(
Collectors
.
groupingBy
(
OrderInfoEntity:
:
getOrderStatus
));
List
<
OrderInfoEntity
>
empty
=
new
ArrayList
<>();
List
<
OrderInfoEntity
>
empty
=
new
ArrayList
<>();
Integer
countPending
=
statusGroup
.
getOrDefault
(
"INIT"
,
empty
).
size
()
+
statusGroup
.
getOrDefault
(
"CONTACTED"
,
empty
).
size
()
+
statusGroup
.
getOrDefault
(
"PENDING"
,
empty
).
size
();
Integer
countPending
=
statusGroup
.
getOrDefault
(
ServiceStatusEnum
.
CONTACTED
.
getCode
(),
empty
).
size
()
+
statusGroup
.
getOrDefault
(
ServiceStatusEnum
.
PENDING
.
getCode
(),
empty
).
size
();
// statusGroup.getOrDefault(ServiceStatusEnum.INIT.getCode(), empty).size() +
ScheduleEngineerOverviewDynamics
dynamics
=
new
ScheduleEngineerOverviewDynamics
();
ScheduleEngineerOverviewDynamics
dynamics
=
new
ScheduleEngineerOverviewDynamics
();
dynamics
.
setGroupName
(
groupName
);
dynamics
.
setGroupName
(
groupName
);
...
@@ -257,13 +269,14 @@ public class ScheduleServiceImpl implements ScheduleService {
...
@@ -257,13 +269,14 @@ public class ScheduleServiceImpl implements ScheduleService {
dynamics
.
setPhone
(
engineer
.
getPhone
());
dynamics
.
setPhone
(
engineer
.
getPhone
());
dynamics
.
setGrade
(
engineer
.
getGrade
());
dynamics
.
setGrade
(
engineer
.
getGrade
());
dynamics
.
setDate
(
TimeUtils
.
IsoLocalDate2String
(
date
));
dynamics
.
setDate
(
TimeUtils
.
IsoLocalDate2String
(
date
));
dynamics
.
setStatus
(
"上班"
);
// 判断工程师是否请假
dynamics
.
setStatus
(
engineerCalendarService
.
engineerDayLeave
(
engineer
.
getEngineerCode
(),
date
)
?
"非派工类出勤"
:
"上班"
);
dynamics
.
setOrderCount
(
orderAppointments
.
size
());
dynamics
.
setOrderCount
(
orderAppointments
.
size
());
dynamics
.
setToServiceCount
(
countPending
);
dynamics
.
setToServiceCount
(
countPending
);
dynamics
.
setInServiceCount
(
statusGroup
.
getOrDefault
(
"STARTED"
,
empty
).
size
());
dynamics
.
setInServiceCount
(
statusGroup
.
getOrDefault
(
ServiceStatusEnum
.
STARTED
.
getCode
()
,
empty
).
size
());
dynamics
.
setFinishedCount
(
statusGroup
.
getOrDefault
(
"FINISHED"
,
empty
).
size
());
dynamics
.
setFinishedCount
(
statusGroup
.
getOrDefault
(
ServiceStatusEnum
.
FINISHED
.
getCode
()
,
empty
).
size
());
dynamics
.
setCanceledCount
(
statusGroup
.
getOrDefault
(
"CANCELED"
,
empty
).
size
());
dynamics
.
setCanceledCount
(
orderStatusGroup
.
getOrDefault
(
OrderStatusEnum
.
CANCELED
.
getCode
()
,
empty
).
size
());
dynamics
.
setRescheduledCount
(
statusGroup
.
getOrDefault
(
"RESCHEDULED"
,
empty
).
size
());
dynamics
.
setRescheduledCount
(
orderStatusGroup
.
getOrDefault
(
OrderStatusEnum
.
RESCHEDULED
.
getCode
()
,
empty
).
size
());
dynamics
.
setRoadTotalElapsedTime
(
new
BigDecimal
(
sumElapsed
)
dynamics
.
setRoadTotalElapsedTime
(
new
BigDecimal
(
sumElapsed
)
.
divide
(
new
BigDecimal
(
60
),
2
,
RoundingMode
.
HALF_UP
)
.
divide
(
new
BigDecimal
(
60
),
2
,
RoundingMode
.
HALF_UP
)
.
stripTrailingZeros
()
.
stripTrailingZeros
()
...
@@ -288,7 +301,8 @@ public class ScheduleServiceImpl implements ScheduleService {
...
@@ -288,7 +301,8 @@ public class ScheduleServiceImpl implements ScheduleService {
item
.
setLocation
(
String
.
format
(
"%s,%s"
,
o
.
getX
(),
o
.
getY
()));
item
.
setLocation
(
String
.
format
(
"%s,%s"
,
o
.
getX
(),
o
.
getY
()));
item
.
setType
(
o
.
getType
());
item
.
setType
(
o
.
getType
());
item
.
setSkill
(
o
.
getSkill
());
item
.
setSkill
(
o
.
getSkill
());
item
.
setOrderStatus
(
o
.
getAppointmentStatus
());
item
.
setOrderStatus
(
o
.
getOrderStatus
());
item
.
setServiceStatus
(
OrderUtil
.
handleServiceStatus
(
o
));
item
.
setOrderStatusName
(
""
);
item
.
setOrderStatusName
(
""
);
item
.
setDistance
(
CommonUtil
.
converMToKm
(
o
.
getArriveDistance
()));
item
.
setDistance
(
CommonUtil
.
converMToKm
(
o
.
getArriveDistance
()));
item
.
setTimeType
(
"auto"
);
item
.
setTimeType
(
"auto"
);
...
...
project-order/src/main/java/com/dituhui/pea/order/utils/OrderUtil.java
View file @
0c5828b
package
com
.
dituhui
.
pea
.
order
.
utils
;
package
com
.
dituhui
.
pea
.
order
.
utils
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.dituhui.pea.order.entity.OrderInfo
;
import
com.dituhui.pea.order.entity.OrderInfoEntity
;
import
com.dituhui.pea.order.entity.OrderInfoEntity
;
import
com.dituhui.pea.order.enums.OrderPeaTagsEnum
;
import
com.dituhui.pea.order.enums.OrderPeaTagsEnum
;
import
com.dituhui.pea.order.enums.ServiceStatusEnum
;
import
com.dituhui.pea.order.enums.ServiceStatusEnum
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
...
@@ -60,16 +62,88 @@ public class OrderUtil {
...
@@ -60,16 +62,88 @@ public class OrderUtil {
/**
/**
* 处理工单状态,主要处理以延迟和已超时
*
* @param order
* @return
*/
public
static
String
handleServiceStatus
(
OrderInfo
order
)
{
if
(
isDelay
(
order
))
{
return
ServiceStatusEnum
.
DELAY
.
getCode
();
}
if
(
isOvertime
(
order
))
{
return
ServiceStatusEnum
.
UNFINISHED
.
getCode
();
}
return
order
.
getServiceStatus
();
}
/**
* 判断订单是否是延迟订单
*
* @param order
* @return
*/
public
static
Boolean
isDelay
(
OrderInfo
order
)
{
if
(
order
.
getDt
().
isAfter
(
LocalDate
.
now
()))
{
return
false
;
}
if
(!
order
.
getServiceStatus
().
equals
(
ServiceStatusEnum
.
INIT
.
getCode
())
&&
!
order
.
getServiceStatus
().
equals
(
ServiceStatusEnum
.
CONTACTED
.
getCode
()))
{
return
false
;
}
if
(
ObjectUtil
.
isNull
(
order
.
getPlanStartTime
()))
{
if
(
order
.
getExpectTimeBegin
().
getTime
()
+
10
*
60
*
1000
<
System
.
currentTimeMillis
())
{
return
true
;
}
}
else
if
(
order
.
getPlanStartTime
().
getTime
()
+
10
*
60
*
1000
<
System
.
currentTimeMillis
())
{
return
true
;
}
return
false
;
}
/**
* 判断订单是否是延迟订单
*
* @param order
* @return
*/
public
static
Boolean
isOvertime
(
OrderInfo
order
)
{
if
(
order
.
getDt
().
isAfter
(
LocalDate
.
now
()))
{
return
false
;
}
if
(!
order
.
getServiceStatus
().
equals
(
ServiceStatusEnum
.
STARTED
.
getCode
())
||
ObjectUtil
.
isNotNull
(
order
.
getActualEndTime
()))
{
return
false
;
}
if
(
ObjectUtil
.
isNull
(
order
.
getPlanEndTime
()))
{
if
(
order
.
getExpectTimeEnd
().
getTime
()
+
10
*
60
*
1000
<
System
.
currentTimeMillis
())
{
return
true
;
}
}
else
if
(
order
.
getPlanEndTime
().
getTime
()
+
10
*
60
*
1000
<
System
.
currentTimeMillis
())
{
return
true
;
}
return
false
;
}
/**
* 判断订单是否是延迟订单
* 判断订单是否是延迟订单
*
*
* @param order
* @param order
* @return
* @return
*/
*/
public
static
Boolean
isDelay
(
OrderInfoEntity
order
)
{
public
static
Boolean
isDelay
(
OrderInfoEntity
order
)
{
if
(
order
.
getDt
().
isAfter
(
LocalDate
.
now
()))
{
return
false
;
}
if
(!
order
.
getServiceStatus
().
equals
(
ServiceStatusEnum
.
INIT
.
getCode
())
&&
!
order
.
getServiceStatus
().
equals
(
ServiceStatusEnum
.
CONTACTED
.
getCode
()))
{
if
(!
order
.
getServiceStatus
().
equals
(
ServiceStatusEnum
.
INIT
.
getCode
())
&&
!
order
.
getServiceStatus
().
equals
(
ServiceStatusEnum
.
CONTACTED
.
getCode
()))
{
return
false
;
return
false
;
}
}
if
(
order
.
getExpectTimeBegin
().
plusMinutes
(
10
).
isBefore
(
LocalDateTime
.
now
()))
{
if
(
ObjectUtil
.
isNull
(
order
.
getPlanEndTime
()))
{
if
(
order
.
getExpectTimeEnd
().
plusMinutes
(
10
).
isBefore
(
LocalDateTime
.
now
()))
{
return
true
;
}
}
else
if
(
order
.
getPlanStartTime
().
plusMinutes
(
10
).
isBefore
(
LocalDateTime
.
now
()))
{
return
true
;
return
true
;
}
}
return
false
;
return
false
;
...
@@ -83,10 +157,17 @@ public class OrderUtil {
...
@@ -83,10 +157,17 @@ public class OrderUtil {
* @return
* @return
*/
*/
public
static
Boolean
isOvertime
(
OrderInfoEntity
order
)
{
public
static
Boolean
isOvertime
(
OrderInfoEntity
order
)
{
if
(
order
.
getDt
().
isAfter
(
LocalDate
.
now
()))
{
return
false
;
}
if
(!
order
.
getServiceStatus
().
equals
(
ServiceStatusEnum
.
STARTED
.
getCode
())
||
ObjectUtil
.
isNotNull
(
order
.
getActualEndTime
()))
{
if
(!
order
.
getServiceStatus
().
equals
(
ServiceStatusEnum
.
STARTED
.
getCode
())
||
ObjectUtil
.
isNotNull
(
order
.
getActualEndTime
()))
{
return
false
;
return
false
;
}
}
if
(
order
.
getPlanEndTime
().
plusMinutes
(
10
).
isBefore
(
LocalDateTime
.
now
()))
{
if
(
ObjectUtil
.
isNull
(
order
.
getPlanEndTime
()))
{
if
(
order
.
getExpectTimeEnd
().
plusMinutes
(
10
).
isBefore
(
LocalDateTime
.
now
()))
{
return
true
;
}
}
else
if
(
order
.
getPlanEndTime
().
plusMinutes
(
10
).
isBefore
(
LocalDateTime
.
now
()))
{
return
true
;
return
true
;
}
}
return
false
;
return
false
;
...
...
project-user/src/main/java/com/dituhui/pea/user/Application.java
→
project-user/src/main/java/com/dituhui/pea/user/
User
Application.java
View file @
0c5828b
...
@@ -12,10 +12,10 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
...
@@ -12,10 +12,10 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableFeignClients
(
basePackages
=
{
"com.dituhui.pea.order"
})
@EnableFeignClients
(
basePackages
=
{
"com.dituhui.pea.order"
})
@EnableJpaAuditing
@EnableJpaAuditing
@EnableTransactionManagement
@EnableTransactionManagement
public
class
Application
{
public
class
User
Application
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
Application
.
class
,
args
);
SpringApplication
.
run
(
User
Application
.
class
,
args
);
}
}
}
}
project-user/src/main/java/com/dituhui/pea/user/controller/UserController.java
View file @
0c5828b
...
@@ -4,6 +4,7 @@ package com.dituhui.pea.user.controller;
...
@@ -4,6 +4,7 @@ package com.dituhui.pea.user.controller;
import
com.dituhui.pea.common.PageResult
;
import
com.dituhui.pea.common.PageResult
;
import
com.dituhui.pea.pojo.*
;
import
com.dituhui.pea.pojo.*
;
import
com.dituhui.pea.pojo.user.OrgInfo
;
import
com.dituhui.pea.pojo.user.OrgInfo
;
import
com.dituhui.pea.pojo.user.UserMenuSettingInfo
;
import
com.dituhui.pea.user.dao.UserOrgDao
;
import
com.dituhui.pea.user.dao.UserOrgDao
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -173,4 +174,24 @@ public class UserController implements IUser {
...
@@ -173,4 +174,24 @@ public class UserController implements IUser {
return
Result
.
success
(
orgInfos
);
return
Result
.
success
(
orgInfos
);
}
}
@Override
public
Result
<
List
<
UserMenuSettingInfo
>>
getSettings
(
String
userId
)
{
if
(
StringUtils
.
isBlank
(
userId
))
{
return
Result
.
failed
(
StatusCodeEnum
.
COMMON_PARAM_EMPTY
);
}
List
<
UserMenuSettingInfo
>
settingInfos
=
userService
.
getSettings
(
userId
);
return
Result
.
success
(
settingInfos
);
}
@Override
public
Result
<
List
<
UserMenuSettingInfo
>>
saveSetting
(
UserMenuSettingInfo
userMenuSettingInfo
)
{
if
(
StringUtils
.
isBlank
(
userMenuSettingInfo
.
getSetting
())
||
StringUtils
.
isBlank
(
userMenuSettingInfo
.
getMenu
())
||
StringUtils
.
isBlank
(
userMenuSettingInfo
.
getUserId
()))
{
return
Result
.
failed
(
StatusCodeEnum
.
COMMON_PARAM_EMPTY
);
}
userService
.
saveSetting
(
userMenuSettingInfo
);
return
Result
.
success
();
}
}
}
project-user/src/main/java/com/dituhui/pea/user/dao/UserMenuSettingDao.java
0 → 100644
View file @
0c5828b
package
com
.
dituhui
.
pea
.
user
.
dao
;
import
com.dituhui.pea.user.entity.UserMenuSettingEntity
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.repository.CrudRepository
;
import
java.util.List
;
public
interface
UserMenuSettingDao
extends
JpaRepository
<
UserMenuSettingEntity
,
String
>,
JpaSpecificationExecutor
<
UserMenuSettingEntity
>,
CrudRepository
<
UserMenuSettingEntity
,
String
>
{
List
<
UserMenuSettingEntity
>
findByUserId
(
String
userId
);
UserMenuSettingEntity
findByUserIdAndMenu
(
String
userId
,
String
menu
);
}
project-user/src/main/java/com/dituhui/pea/user/entity/UserMenuSettingEntity.java
0 → 100644
View file @
0c5828b
package
com
.
dituhui
.
pea
.
user
.
entity
;
import
lombok.Data
;
import
org.hibernate.annotations.GenericGenerator
;
import
org.springframework.data.annotation.CreatedDate
;
import
org.springframework.data.annotation.LastModifiedDate
;
import
org.springframework.data.jpa.domain.support.AuditingEntityListener
;
import
javax.persistence.*
;
import
java.io.Serializable
;
import
java.util.Date
;
@Entity
@Table
(
name
=
"sys_user_menu_setting"
)
@Data
@EntityListeners
(
AuditingEntityListener
.
class
)
public
class
UserMenuSettingEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
2359135550756920074L
;
/**
* 主键
*/
@Id
@GeneratedValue
(
generator
=
"uuid"
)
@GenericGenerator
(
name
=
"uuid"
,
strategy
=
"uuid"
)
@Column
(
name
=
"ID"
,
unique
=
true
,
nullable
=
false
,
length
=
32
)
private
String
id
;
/**
* 账号
*/
@Column
(
name
=
"user_id"
)
private
String
userId
;
/**
* 菜单
*/
@Column
(
name
=
"menu"
)
private
String
menu
;
/**
* 设置
*/
@Column
(
name
=
"setting"
)
private
String
setting
;
/**
* 创建人
*/
@Column
(
name
=
"CREATED_BY"
)
private
String
createdBy
;
/**
* 创建时间
*/
@Column
(
name
=
"CREATED_TIME"
)
@CreatedDate
private
Date
createdTime
;
/**
* 更新人
*/
@Column
(
name
=
"UPDATED_BY"
)
private
String
updatedBy
;
/**
* 更新时间
*/
@Column
(
name
=
"UPDATED_TIME"
)
@LastModifiedDate
private
Date
updatedTime
;
}
project-user/src/main/java/com/dituhui/pea/user/service/UserService.java
View file @
0c5828b
...
@@ -14,6 +14,7 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -14,6 +14,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.dituhui.pea.common.PageResult
;
import
com.dituhui.pea.common.PageResult
;
import
com.dituhui.pea.pojo.*
;
import
com.dituhui.pea.pojo.*
;
import
com.dituhui.pea.pojo.user.OrgInfo
;
import
com.dituhui.pea.pojo.user.OrgInfo
;
import
com.dituhui.pea.pojo.user.UserMenuSettingInfo
;
import
com.dituhui.pea.user.dao.*
;
import
com.dituhui.pea.user.dao.*
;
import
com.dituhui.pea.user.entity.*
;
import
com.dituhui.pea.user.entity.*
;
import
com.dituhui.pea.user.utils.LevelUtils
;
import
com.dituhui.pea.user.utils.LevelUtils
;
...
@@ -100,6 +101,9 @@ public class UserService {
...
@@ -100,6 +101,9 @@ public class UserService {
@Autowired
@Autowired
UserOrgDao
userOrgDao
;
UserOrgDao
userOrgDao
;
@Autowired
UserMenuSettingDao
userMenuSettingDao
;
public
Result
<
UserLoginDTO
>
userLogin
(
String
account
,
String
password
)
{
public
Result
<
UserLoginDTO
>
userLogin
(
String
account
,
String
password
)
{
UserEntity
user
=
userDao
.
findByLoginnameAndPass
(
account
,
SecureUtil
.
md5
(
password
));
UserEntity
user
=
userDao
.
findByLoginnameAndPass
(
account
,
SecureUtil
.
md5
(
password
));
log
.
info
(
"{}/{} login"
,
account
,
password
);
log
.
info
(
"{}/{} login"
,
account
,
password
);
...
@@ -915,4 +919,45 @@ public class UserService {
...
@@ -915,4 +919,45 @@ public class UserService {
});
});
return
orgInfos
;
return
orgInfos
;
}
}
/**
* 查询用户菜单配置
*
* @param userId
* @return
*/
public
List
<
UserMenuSettingInfo
>
getSettings
(
String
userId
)
{
List
<
UserMenuSettingInfo
>
settingInfos
=
new
ArrayList
<>();
// 获取角色
List
<
UserMenuSettingEntity
>
menuSettingEntities
=
userMenuSettingDao
.
findByUserId
(
userId
);
if
(
CollectionUtils
.
isEmpty
(
menuSettingEntities
))
{
return
settingInfos
;
}
menuSettingEntities
.
forEach
(
e
->
{
UserMenuSettingInfo
settingInfo
=
new
UserMenuSettingInfo
();
settingInfo
.
setId
(
e
.
getId
());
settingInfo
.
setUserId
(
e
.
getUserId
());
settingInfo
.
setMenu
(
e
.
getMenu
());
settingInfo
.
setSetting
(
e
.
getSetting
());
settingInfos
.
add
(
settingInfo
);
});
return
settingInfos
;
}
/**
* 用户菜单配置新增修改
*
* @param userMenuSettingInfo
* @return
*/
public
void
saveSetting
(
UserMenuSettingInfo
userMenuSettingInfo
)
{
UserMenuSettingEntity
menuSetting
=
userMenuSettingDao
.
findByUserIdAndMenu
(
userMenuSettingInfo
.
getUserId
(),
userMenuSettingInfo
.
getMenu
());
if
(
ObjectUtil
.
isNull
(
menuSetting
))
{
menuSetting
=
new
UserMenuSettingEntity
();
}
menuSetting
.
setSetting
(
userMenuSettingInfo
.
getSetting
());
menuSetting
.
setUserId
(
userMenuSettingInfo
.
getUserId
());
menuSetting
.
setMenu
(
userMenuSettingInfo
.
getMenu
());
userMenuSettingDao
.
save
(
menuSetting
);
}
}
}
project-user/src/main/resources/application-dev.yaml
View file @
0c5828b
...
@@ -25,17 +25,6 @@ spring:
...
@@ -25,17 +25,6 @@ spring:
username
:
boxi
username
:
boxi
password
:
boxi_dev_0725
password
:
boxi_dev_0725
type
:
com.alibaba.druid.pool.DruidDataSource
type
:
com.alibaba.druid.pool.DruidDataSource
redis
:
database
:
0
host
:
redis
port
:
6379
password
:
123456
jedis
:
pool
:
max-active
:
32
min-idle
:
0
max-idle
:
8
max-wait
:
-1
kafka
:
kafka
:
bootstrap-servers
:
http://kafka:9092
bootstrap-servers
:
http://kafka:9092
consumer
:
consumer
:
...
...
project-user/src/main/resources/application.yaml
View file @
0c5828b
...
@@ -24,17 +24,6 @@ spring:
...
@@ -24,17 +24,6 @@ spring:
username
:
boxi
username
:
boxi
password
:
boxi_dev_0725
password
:
boxi_dev_0725
type
:
com.alibaba.druid.pool.DruidDataSource
type
:
com.alibaba.druid.pool.DruidDataSource
redis
:
database
:
0
host
:
redis
port
:
6379
password
:
123456
jedis
:
pool
:
max-active
:
32
min-idle
:
0
max-idle
:
8
max-wait
:
-1
kafka
:
kafka
:
bootstrap-servers
:
http://kafka:9092
bootstrap-servers
:
http://kafka:9092
consumer
:
consumer
:
...
...
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