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 afc69207
authored
Oct 19, 2023
by
刘鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DOC: 预约单统计数据返回示例
1 parent
07aa01cf
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
2 deletions
project-order/src/main/java/com/dituhui/pea/order/controller/PeaApiController.java
project-order/src/main/java/com/dituhui/pea/order/dao/OrderInfoDao.java
project-order/src/main/java/com/dituhui/pea/order/service/PeaOuterAPIService.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/PeaOuterAPIServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/controller/PeaApiController.java
View file @
afc6920
package
com
.
dituhui
.
pea
.
order
.
controller
;
import
cn.hutool.core.date.LocalDateTimeUtil
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.order.common.jackson.DateUtil
;
import
com.dituhui.pea.order.common.jackson.JsonUtil
;
import
com.dituhui.pea.order.dto.OrganizationTreeDTO
;
import
com.dituhui.pea.order.dto.param.*
;
...
...
@@ -247,9 +249,9 @@ public class PeaApiController {
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
@NotNull
@RequestParam
(
"date"
)
Date
date
)
{
OrderDTO
.
AppointResult
appointResult
=
peaOuterAPIService
.
engineerCode
(
engineerCode
,
DateUtil
.
fromDate
(
date
).
toLocalDate
());
return
Result
.
success
(
new
OrderDTO
.
AppointResult
());
return
Result
.
success
(
appointResult
);
}
...
...
project-order/src/main/java/com/dituhui/pea/order/dao/OrderInfoDao.java
View file @
afc6920
...
...
@@ -22,4 +22,6 @@ public interface OrderInfoDao extends JpaRepository<OrderInfoEntity, Long>, JpaS
List
<
OrderInfoEntity
>
findByDtAndOrgTeamIdAndAppointmentStatusIn
(
LocalDate
dt
,
String
orgTeamId
,
List
<
String
>
appointmentStatus
);
OrderInfoEntity
findTopBySkillAndAppointmentStatus
(
String
skill
,
String
status
);
List
<
OrderInfoEntity
>
findByServiceStatusAndEngineerCode
(
String
serviceStatus
,
String
engineerCode
);
}
project-order/src/main/java/com/dituhui/pea/order/service/PeaOuterAPIService.java
View file @
afc6920
...
...
@@ -3,7 +3,9 @@ package com.dituhui.pea.order.service;
import
com.dituhui.pea.order.dto.param.EstimateDTO
;
import
com.dituhui.pea.order.dto.param.Location
;
import
com.dituhui.pea.order.dto.param.Order
;
import
com.dituhui.pea.order.dto.param.OrderDTO
;
import
java.time.LocalDate
;
import
java.util.List
;
/**
...
...
@@ -32,4 +34,7 @@ public interface PeaOuterAPIService {
* @return 不需要的备件且符合条件的多个未分配工单
*/
List
<
Order
>
orderIncreaseQuery
(
String
engineerCode
,
Location
location
,
Integer
idleDuration
);
OrderDTO
.
AppointResult
engineerCode
(
String
engineerCode
,
LocalDate
localDate
);
}
project-order/src/main/java/com/dituhui/pea/order/service/impl/PeaOuterAPIServiceImpl.java
View file @
afc6920
...
...
@@ -6,6 +6,7 @@ import com.dituhui.pea.order.dao.OrgGroupDao;
import
com.dituhui.pea.order.dto.param.EstimateDTO
;
import
com.dituhui.pea.order.dto.param.Location
;
import
com.dituhui.pea.order.dto.param.Order
;
import
com.dituhui.pea.order.dto.param.OrderDTO
;
import
com.dituhui.pea.order.entity.OrderInfoEntity
;
import
com.dituhui.pea.order.entity.OrgGroupEntity
;
import
com.dituhui.pea.order.service.PeaOuterAPIService
;
...
...
@@ -13,7 +14,12 @@ import lombok.RequiredArgsConstructor;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
java.time.LocalDate
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
/**
* 对外接口实现
...
...
@@ -66,6 +72,7 @@ public class PeaOuterAPIServiceImpl implements PeaOuterAPIService {
order
.
setFaultDescribe
(
sss
.
getFaultDescribe
());
order
.
setExpectTimeBegin
(
DateUtil
.
toDate
(
sss
.
getExpectTimeBegin
()));
order
.
setExpectTimeEnd
(
DateUtil
.
toDate
(
sss
.
getExpectTimeEnd
()));
order
.
setApplyNote
(
sss
.
getApplyNote
());
Location
orderLocation
=
new
Location
();
...
...
@@ -76,4 +83,36 @@ public class PeaOuterAPIServiceImpl implements PeaOuterAPIService {
return
List
.
of
(
order
);
}
@Override
public
OrderDTO
.
AppointResult
engineerCode
(
String
engineerCode
,
LocalDate
localDate
)
{
OrderDTO
.
AppointResult
result
=
new
OrderDTO
.
AppointResult
();
result
.
setEngineerCode
(
engineerCode
);
result
.
setDate
(
DateUtil
.
toDate
(
localDate
));
List
<
OrderInfoEntity
>
finishedOrder
=
orderInfoDao
.
findByServiceStatusAndEngineerCode
(
"INIT"
,
engineerCode
);
List
<
OrderDTO
.
AppointmentOrderResult
>
collect
=
Optional
.
ofNullable
(
finishedOrder
).
orElse
(
Collections
.
emptyList
())
.
stream
()
.
map
(
this
::
order2AppointmentOrderResult
)
.
collect
(
Collectors
.
toList
());
result
.
setOrders
(
collect
);
return
result
;
}
private
OrderDTO
.
AppointmentOrderResult
order2AppointmentOrderResult
(
OrderInfoEntity
orderInfo
)
{
OrderDTO
.
AppointmentOrderResult
result
=
new
OrderDTO
.
AppointmentOrderResult
();
result
.
setOrderId
(
orderInfo
.
getOrderId
());
result
.
setOrderStatus
(
orderInfo
.
getServiceStatus
());
result
.
setPlanBeginTime
(
DateUtil
.
toDate
(
orderInfo
.
getPlanStartTime
()));
// result.setPlanDistance();
result
.
setPlanDuration
(
orderInfo
.
getTakeTime
()
*
60
);
if
(
Objects
.
nonNull
(
orderInfo
.
getActualStartTime
()))
{
result
.
setActualBeginTime
(
DateUtil
.
toDate
(
orderInfo
.
getActualStartTime
()));
result
.
setActualDuration
(
orderInfo
.
getArriveElapsed
()
*
60
);
result
.
setActualDistance
(
orderInfo
.
getArriveDistance
());
}
return
result
;
}
}
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