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 7186b6c1
authored
Nov 22, 2023
by
Ren Ping
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop
2 parents
a4fe31c8
9b3a3543
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
215 additions
and
29 deletions
project-interface/src/main/java/com/dituhui/pea/pojo/DistanceDTO.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/service/BusinessBlockService.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/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/utils/OrderUtil.java
project-interface/src/main/java/com/dituhui/pea/pojo/DistanceDTO.java
View file @
7186b6c
...
@@ -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-order/src/main/java/com/dituhui/pea/order/controller/BusinessBlockController.java
View file @
7186b6c
...
@@ -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 排序字段 默认"teamId"
* @param direction 排序方向 desc降序/asc升序 默认"asc"
* @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
=
"teamId"
;
}
if
(
StringUtils
.
isEmpty
(
direction
))
{
direction
=
"asc"
;
}
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 @
7186b6c
...
@@ -82,27 +82,27 @@ public interface OrderInfoDao extends JpaRepository<OrderInfoEntity, Long>, JpaS
...
@@ -82,27 +82,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 @
7186b6c
...
@@ -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/service/BusinessBlockService.java
View file @
7186b6c
...
@@ -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/impl/BusinessBlockServiceImpl.java
View file @
7186b6c
...
@@ -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 @
7186b6c
...
@@ -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
());
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderAssignImpl.java
View file @
7186b6c
...
@@ -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
());
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderInfoServiceImpl.java
View file @
7186b6c
...
@@ -478,6 +478,7 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -478,6 +478,7 @@ public class OrderInfoServiceImpl implements OrderInfoService {
@Override
@Override
public
Result
<
OrderInfoEntity
>
insterEngineerOrders
(
List
<
OrderInfoEntity
>
engineerOrders
,
OrderInfoEntity
insertOrder
,
SkillInfoEntity
skillInfo
,
OrgTeamEntity
orgTeam
,
EngineerInfoEntity
engineer
)
{
public
Result
<
OrderInfoEntity
>
insterEngineerOrders
(
List
<
OrderInfoEntity
>
engineerOrders
,
OrderInfoEntity
insertOrder
,
SkillInfoEntity
skillInfo
,
OrgTeamEntity
orgTeam
,
EngineerInfoEntity
engineer
)
{
//查询工程师当天请假时间
//查询工程师当天请假时间
log
.
info
(
"待插入订单信息------------->{}"
,
JsonUtil
.
toJson
(
insertOrder
));
List
<
OccupyInfoDetail
>
engineerLeaveTimeSlice
=
engineerCalendarService
.
getEngineerWorkDayCalendar
(
engineer
.
getEngineerCode
(),
insertOrder
.
getDt
());
List
<
OccupyInfoDetail
>
engineerLeaveTimeSlice
=
engineerCalendarService
.
getEngineerWorkDayCalendar
(
engineer
.
getEngineerCode
(),
insertOrder
.
getDt
());
log
.
info
(
"【engineerWorkTimeSlice】结果------------->{}"
,
JsonUtil
.
toJson
(
engineerLeaveTimeSlice
));
log
.
info
(
"【engineerWorkTimeSlice】结果------------->{}"
,
JsonUtil
.
toJson
(
engineerLeaveTimeSlice
));
// 没有单直接返回
// 没有单直接返回
...
@@ -487,6 +488,8 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -487,6 +488,8 @@ public class OrderInfoServiceImpl implements OrderInfoService {
return
Result
.
failed
(
insertOrder
);
return
Result
.
failed
(
insertOrder
);
}
}
LocalDateTime
planStartTime
=
(
LocalDateTime
)
handleLeaveTimeResult
.
getResult
();
LocalDateTime
planStartTime
=
(
LocalDateTime
)
handleLeaveTimeResult
.
getResult
();
insertOrder
.
setArriveElapsed
(
0
);
insertOrder
.
setArriveDistance
(
0
);
insertOrder
.
setTakeTime
(
skillInfo
.
getTakeTime
());
insertOrder
.
setTakeTime
(
skillInfo
.
getTakeTime
());
insertOrder
.
setPlanStartTime
(
planStartTime
);
insertOrder
.
setPlanStartTime
(
planStartTime
);
insertOrder
.
setPlanEndTime
(
planStartTime
.
plusMinutes
(
skillInfo
.
getTakeTime
()));
insertOrder
.
setPlanEndTime
(
planStartTime
.
plusMinutes
(
skillInfo
.
getTakeTime
()));
...
@@ -517,6 +520,8 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -517,6 +520,8 @@ public class OrderInfoServiceImpl implements OrderInfoService {
return
Result
.
failed
(
insertOrder
);
return
Result
.
failed
(
insertOrder
);
}
}
LocalDateTime
planStartTime
=
(
LocalDateTime
)
handleLeaveTimeResult
.
getResult
();
LocalDateTime
planStartTime
=
(
LocalDateTime
)
handleLeaveTimeResult
.
getResult
();
insertOrder
.
setArriveElapsed
(
0
);
insertOrder
.
setArriveDistance
(
0
);
insertOrder
.
setTakeTime
(
skillInfo
.
getTakeTime
());
insertOrder
.
setTakeTime
(
skillInfo
.
getTakeTime
());
insertOrder
.
setPlanStartTime
(
planStartTime
);
insertOrder
.
setPlanStartTime
(
planStartTime
);
insertOrder
.
setPlanEndTime
(
planStartTime
.
plusMinutes
(
skillInfo
.
getTakeTime
()));
insertOrder
.
setPlanEndTime
(
planStartTime
.
plusMinutes
(
skillInfo
.
getTakeTime
()));
...
@@ -537,7 +542,10 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -537,7 +542,10 @@ public class OrderInfoServiceImpl implements OrderInfoService {
int
moveTime
=
0
;
int
moveTime
=
0
;
for
(
int
i
=
0
;
i
<
orderSegments
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
orderSegments
.
size
();
i
++)
{
OrderSegment
orderSegment
=
orderSegments
.
get
(
i
);
OrderSegment
orderSegment
=
orderSegments
.
get
(
i
);
if
(
isMove
&&
!
orderSegment
.
getOrderId
().
equals
(
insertOrder
.
getOrderId
())
&&
moveTime
>
0
)
{
if
(
isMove
)
{
if
(
orderSegment
.
getOrderId
().
equals
(
insertOrder
.
getOrderId
()))
{
continue
;
}
OrderInfoEntity
nestOrder
=
orderInfoDao
.
getByOrderId
(
orderSegment
.
getOrderId
());
OrderInfoEntity
nestOrder
=
orderInfoDao
.
getByOrderId
(
orderSegment
.
getOrderId
());
nestOrder
.
setPlanStartTime
(
nestOrder
.
getPlanStartTime
().
plusMinutes
(
moveTime
));
nestOrder
.
setPlanStartTime
(
nestOrder
.
getPlanStartTime
().
plusMinutes
(
moveTime
));
nestOrder
.
setPlanEndTime
(
nestOrder
.
getPlanEndTime
().
plusMinutes
(
moveTime
));
nestOrder
.
setPlanEndTime
(
nestOrder
.
getPlanEndTime
().
plusMinutes
(
moveTime
));
...
@@ -560,13 +568,18 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -560,13 +568,18 @@ public class OrderInfoServiceImpl implements OrderInfoService {
return
Result
.
failed
(
insertOrder
);
return
Result
.
failed
(
insertOrder
);
}
}
LocalDateTime
planStartTime
=
(
LocalDateTime
)
handleLeaveTimeResult
.
getResult
();
LocalDateTime
planStartTime
=
(
LocalDateTime
)
handleLeaveTimeResult
.
getResult
();
//第一个没有在途时长
if
(
i
==
0
)
{
insertOrder
.
setArriveElapsed
(
0
);
insertOrder
.
setArriveDistance
(
0
);
}
insertOrder
.
setTakeTime
(
skillInfo
.
getTakeTime
());
insertOrder
.
setTakeTime
(
skillInfo
.
getTakeTime
());
insertOrder
.
setPlanStartTime
(
planStartTime
);
insertOrder
.
setPlanStartTime
(
planStartTime
);
insertOrder
.
setPlanEndTime
(
planStartTime
.
plusMinutes
(
skillInfo
.
getTakeTime
()));
insertOrder
.
setPlanEndTime
(
planStartTime
.
plusMinutes
(
skillInfo
.
getTakeTime
()));
OrderInfoEntity
nestOrder
=
orderInfoDao
.
getByOrderId
(
nestOrderSegment
.
getOrderId
());
OrderInfoEntity
nestOrder
=
orderInfoDao
.
getByOrderId
(
nestOrderSegment
.
getOrderId
());
nestOrder
.
setArriveElapsed
(
roadTime
);
nestOrder
.
setArriveElapsed
(
roadTime
);
nestOrder
.
setArriveDistance
(
BigDecimal
.
valueOf
(
distanceDTO
.
getDis
()
*
1000
).
intValue
());
nestOrder
.
setArriveDistance
(
BigDecimal
.
valueOf
(
distanceDTO
.
getDis
()).
intValue
());
if
(
orderSegment
.
getStart
().
plusMinutes
(
takeTime
+
roadTime
).
compareTo
(
nestOrder
.
getPlanStartTime
())
>
0
)
{
if
(
orderSegment
.
getStart
().
plusMinutes
(
takeTime
+
roadTime
).
compareTo
(
nestOrder
.
getPlanStartTime
())
>
0
)
{
long
minutes
=
Duration
.
between
(
nestOrder
.
getPlanStartTime
(),
planStartTime
.
plusMinutes
(
skillInfo
.
getTakeTime
()
+
roadTime
)).
toMinutes
();
long
minutes
=
Duration
.
between
(
nestOrder
.
getPlanStartTime
(),
planStartTime
.
plusMinutes
(
skillInfo
.
getTakeTime
()
+
roadTime
)).
toMinutes
();
nestOrder
.
setPlanStartTime
(
nestOrder
.
getPlanStartTime
().
plusMinutes
(
minutes
));
nestOrder
.
setPlanStartTime
(
nestOrder
.
getPlanStartTime
().
plusMinutes
(
minutes
));
...
@@ -587,18 +600,14 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -587,18 +600,14 @@ public class OrderInfoServiceImpl implements OrderInfoService {
LocalDateTime
planStartTime
=
(
LocalDateTime
)
handleLeaveTimeResult
.
getResult
();
LocalDateTime
planStartTime
=
(
LocalDateTime
)
handleLeaveTimeResult
.
getResult
();
if
(
orderSegment
.
getEnd
().
plusMinutes
(
roadTime
).
compareTo
(
planStartTime
)
<=
0
)
{
if
(
orderSegment
.
getEnd
().
plusMinutes
(
roadTime
).
compareTo
(
planStartTime
)
<=
0
)
{
//下一单为待插入订单且为最后一单直接返回
//下一单为待插入订单且为最后一单直接返回
insertOrder
.
setArriveElapsed
(
roadTime
);
insertOrder
.
setArriveDistance
(
BigDecimal
.
valueOf
(
distanceDTO
.
getDis
()).
intValue
());
if
(
i
==
orderSegments
.
size
()
-
2
)
{
if
(
i
==
orderSegments
.
size
()
-
2
)
{
insertOrder
.
setTakeTime
(
skillInfo
.
getTakeTime
());
insertOrder
.
setTakeTime
(
skillInfo
.
getTakeTime
());
insertOrder
.
setPlanStartTime
(
planStartTime
);
insertOrder
.
setPlanStartTime
(
planStartTime
);
insertOrder
.
setPlanEndTime
(
planStartTime
.
plusMinutes
(
skillInfo
.
getTakeTime
()));
insertOrder
.
setPlanEndTime
(
planStartTime
.
plusMinutes
(
skillInfo
.
getTakeTime
()));
insertOrder
.
setArriveElapsed
(
roadTime
);
insertOrder
.
setArriveDistance
(
BigDecimal
.
valueOf
(
distanceDTO
.
getDis
()
*
1000
).
intValue
());
return
Result
.
success
(
insertOrder
);
return
Result
.
success
(
insertOrder
);
}
}
OrderInfoEntity
nestOrder
=
orderInfoDao
.
getByOrderId
(
nestOrderSegment
.
getOrderId
());
nestOrder
.
setArriveElapsed
(
roadTime
);
nestOrder
.
setArriveDistance
(
BigDecimal
.
valueOf
(
distanceDTO
.
getDis
()
*
1000
).
intValue
());
orderInfoDao
.
save
(
nestOrder
);
continue
;
continue
;
}
}
insertOrder
.
setTakeTime
(
skillInfo
.
getTakeTime
());
insertOrder
.
setTakeTime
(
skillInfo
.
getTakeTime
());
...
@@ -611,12 +620,16 @@ public class OrderInfoServiceImpl implements OrderInfoService {
...
@@ -611,12 +620,16 @@ public class OrderInfoServiceImpl implements OrderInfoService {
log
.
info
(
"【getRoadDistancePrev】结果------------->{}"
,
JsonUtil
.
toJson
(
roadResultPrev
));
log
.
info
(
"【getRoadDistancePrev】结果------------->{}"
,
JsonUtil
.
toJson
(
roadResultPrev
));
int
roadTimePrev
=
BigDecimal
.
valueOf
(
roadResultPrev
.
getResult
().
getTime
()).
divide
(
BigDecimal
.
valueOf
(
60
),
0
,
RoundingMode
.
HALF_UP
).
intValue
();
int
roadTimePrev
=
BigDecimal
.
valueOf
(
roadResultPrev
.
getResult
().
getTime
()).
divide
(
BigDecimal
.
valueOf
(
60
),
0
,
RoundingMode
.
HALF_UP
).
intValue
();
insertOrder
.
setArriveElapsed
(
roadTimePrev
);
insertOrder
.
setArriveElapsed
(
roadTimePrev
);
insertOrder
.
setArriveDistance
(
BigDecimal
.
valueOf
(
roadResultPrev
.
getResult
().
getDis
()
*
1000
).
intValue
());
insertOrder
.
setArriveDistance
(
BigDecimal
.
valueOf
(
roadResultPrev
.
getResult
().
getDis
()).
intValue
());
}
else
{
// 第一单没有在途时长
insertOrder
.
setArriveElapsed
(
0
);
insertOrder
.
setArriveDistance
(
0
);
}
}
OrderInfoEntity
nestOrder
=
orderInfoDao
.
getByOrderId
(
orderSegment
.
getOrderId
());
OrderInfoEntity
nestOrder
=
orderInfoDao
.
getByOrderId
(
orderSegment
.
getOrderId
());
nestOrder
.
setArriveElapsed
(
roadTime
);
nestOrder
.
setArriveElapsed
(
roadTime
);
nestOrder
.
setArriveDistance
(
BigDecimal
.
valueOf
(
distanceDTO
.
getDis
()
*
1000
).
intValue
());
nestOrder
.
setArriveDistance
(
BigDecimal
.
valueOf
(
distanceDTO
.
getDis
()).
intValue
());
long
minutes
=
Duration
.
between
(
nestOrder
.
getPlanStartTime
(),
planStartTime
.
plusMinutes
(
skillInfo
.
getTakeTime
()
+
roadTime
)).
toMinutes
();
long
minutes
=
Duration
.
between
(
nestOrder
.
getPlanStartTime
(),
planStartTime
.
plusMinutes
(
skillInfo
.
getTakeTime
()
+
roadTime
)).
toMinutes
();
nestOrder
.
setPlanStartTime
(
nestOrder
.
getPlanStartTime
().
plusMinutes
(
minutes
));
nestOrder
.
setPlanStartTime
(
nestOrder
.
getPlanStartTime
().
plusMinutes
(
minutes
));
nestOrder
.
setPlanEndTime
(
nestOrder
.
getPlanEndTime
().
plusMinutes
(
minutes
));
nestOrder
.
setPlanEndTime
(
nestOrder
.
getPlanEndTime
().
plusMinutes
(
minutes
));
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/OrderServiceDetailImpl.java
View file @
7186b6c
...
@@ -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 @
7186b6c
...
@@ -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/utils/OrderUtil.java
View file @
7186b6c
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,91 @@ public class OrderUtil {
...
@@ -60,16 +62,91 @@ 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
().
isBefore
(
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
;
}
}
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
().
isBefore
(
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
;
}
}
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
().
isBefore
(
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
;
}
}
if
(
order
.
getPlanStartTime
().
plusMinutes
(
10
).
isBefore
(
LocalDateTime
.
now
()))
{
return
true
;
return
true
;
}
}
return
false
;
return
false
;
...
@@ -83,9 +160,17 @@ public class OrderUtil {
...
@@ -83,9 +160,17 @@ public class OrderUtil {
* @return
* @return
*/
*/
public
static
Boolean
isOvertime
(
OrderInfoEntity
order
)
{
public
static
Boolean
isOvertime
(
OrderInfoEntity
order
)
{
if
(
order
.
getDt
().
isBefore
(
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
(
ObjectUtil
.
isNull
(
order
.
getPlanEndTime
()))
{
if
(
order
.
getExpectTimeEnd
().
plusMinutes
(
10
).
isBefore
(
LocalDateTime
.
now
()))
{
return
true
;
}
}
if
(
order
.
getPlanEndTime
().
plusMinutes
(
10
).
isBefore
(
LocalDateTime
.
now
()))
{
if
(
order
.
getPlanEndTime
().
plusMinutes
(
10
).
isBefore
(
LocalDateTime
.
now
()))
{
return
true
;
return
true
;
}
}
...
...
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