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 0770a1aa
authored
Jul 24, 2023
by
丁伟峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
甘特图的要素,面向展示进行了重新定义,与工单信息无关;另外,order_request+order_appointment ===> order_info
1 parent
a1fc747a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
71 deletions
project-order/src/main/java/com/dituhui/pea/order/dao/OrderInfoDao.java
project-order/src/main/java/com/dituhui/pea/order/dto/EngineersGanttDTO.java
project-order/src/main/java/com/dituhui/pea/order/entity/OrderInfoEntity.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerGanttServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/dao/OrderInfoDao.java
View file @
0770a1a
...
...
@@ -2,6 +2,18 @@ package com.dituhui.pea.order.dao;
import
com.dituhui.pea.order.entity.OrderInfoEntity
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.Query
;
import
java.time.LocalDate
;
import
java.util.List
;
public
interface
OrderInfoDao
extends
JpaRepository
<
OrderInfoEntity
,
Long
>
{
OrderInfoEntity
getByOrderId
(
String
orderId
);
List
<
OrderInfoEntity
>
findByDtAndEngineerCodeIn
(
LocalDate
date
,
List
<
String
>
engineerCodes
);
@Query
(
"SELECT o.orderId, s.skillCategory as skillCaption FROM OrderInfoEntity o JOIN SkillInfoEntity s on o.brand=s.brand and o.type=s.type and o.skill=s.skill WHERE o.orderId = :orderId"
)
OrderSkillProjection
getOrderSkillCaptionByOrderId
(
String
orderId
);
List
<
OrderInfoEntity
>
findAllByOrderIdIn
(
List
<
String
>
orderIds
);
}
project-order/src/main/java/com/dituhui/pea/order/dto/EngineersGanttDTO.java
View file @
0770a1a
...
...
@@ -6,11 +6,11 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
com.fasterxml.jackson.databind.annotation.JsonDeserialize
;
import
com.fasterxml.jackson.databind.annotation.JsonSerialize
;
import
com.fasterxml.jackson.datatype.jsr310.deser.LocalDate
Time
Deserializer
;
import
com.fasterxml.jackson.datatype.jsr310.ser.LocalDate
Time
Serializer
;
import
com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer
;
import
com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer
;
import
lombok.experimental.Accessors
;
import
java.time.LocalDate
Time
;
import
java.time.LocalDate
;
import
java.util.List
;
...
...
@@ -24,7 +24,11 @@ public class EngineersGanttDTO {
private
String
levelValue
;
private
Integer
page
=
OrderConfig
.
DEFAULT_PAGE_INDEX
;
private
Integer
size
=
OrderConfig
.
DEFAULT_PAGE_SIZE
;
private
String
date
;
@JsonDeserialize
(
using
=
LocalDateDeserializer
.
class
)
@JsonSerialize
(
using
=
LocalDateSerializer
.
class
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
private
LocalDate
date
;
private
List
<
String
>
engineerCodes
;
private
List
<
String
>
branchIds
;
private
List
<
String
>
groupIds
;
...
...
@@ -70,43 +74,19 @@ public class EngineersGanttDTO {
* 上班时间
*/
private
String
startTime
;
private
List
<?>
order
s
;
private
List
<?>
slot
s
;
}
@lombok
.
Data
@Accessors
(
chain
=
true
)
public
static
class
Order
{
/**
* 工单ID
*/
private
String
orderId
;
private
String
caption
;
/**
* 排班状态
*/
private
String
preStatus
;
/**
* 派单状态
*/
private
String
appointmentStatus
;
/**
* 开始时间
*/
@JsonDeserialize
(
using
=
LocalDateTimeDeserializer
.
class
)
@JsonSerialize
(
using
=
LocalDateTimeSerializer
.
class
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
LocalDateTime
startTime
;
/**
* 结束时间
*/
@JsonDeserialize
(
using
=
LocalDateTimeDeserializer
.
class
)
@JsonSerialize
(
using
=
LocalDateTimeSerializer
.
class
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
LocalDateTime
endTime
;
/**
* 鼠标悬停提示
*/
private
List
<?>
tips
;
@lombok
.
Data
public
static
class
Slot
{
private
String
bgColor
=
"blue"
;
private
String
borderColor
=
"blue"
;
private
String
borderStyle
=
"solid"
;
private
String
btime
;
private
String
etime
;
private
String
text
;
private
List
<
LabelValueDTO
>
tooltip
;
private
String
url
;
}
}
project-order/src/main/java/com/dituhui/pea/order/entity/OrderInfoEntity.java
View file @
0770a1a
package
com
.
dituhui
.
pea
.
order
.
entity
;
import
lombok.Data
;
import
javax.persistence.*
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
@Entity
@Data
@Table
(
name
=
"order_info"
)
public
class
OrderInfoEntity
{
...
...
@@ -16,7 +19,7 @@ public class OrderInfoEntity {
@Column
(
name
=
"order_id"
,
nullable
=
false
,
length
=
50
)
private
String
orderId
;
@Column
(
name
=
"dt"
,
nullable
=
false
)
@Column
(
name
=
"dt"
,
columnDefinition
=
"DATE"
,
nullable
=
false
)
private
LocalDate
dt
;
@Column
(
name
=
"sub_id"
,
nullable
=
false
,
length
=
50
)
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/EngineerGanttServiceImpl.java
View file @
0770a1a
package
com
.
dituhui
.
pea
.
order
.
service
.
impl
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.order.common.DateUtils
;
import
com.dituhui.pea.order.common.EngineerUtils
;
import
com.dituhui.pea.order.dao.*
;
import
com.dituhui.pea.order.dto.EngineersGanttDTO
;
...
...
@@ -12,6 +13,7 @@ import org.apache.commons.lang3.StringUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.time.LocalDateTime
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -21,20 +23,19 @@ import java.util.stream.Collectors;
public
class
EngineerGanttServiceImpl
implements
EngineerGanttService
{
@Autowired
private
OrderAppointmentDao
orderAppointmentDao
;
@Autowired
private
CapacityEngineerStatDao
capacityEngineerStatDao
;
@Autowired
private
EngineerInfoDao
engineerInfoDao
;
@Autowired
private
OrderRequestDao
orderRequestDao
;
@Autowired
private
EngineerUtils
engineerUtils
;
@Autowired
private
OrderInfoDao
orderInfoDao
;
private
String
getHourMinute
(
LocalDateTime
time
){
return
DateUtils
.
formatDateTime
(
time
,
"HH:mm"
);
}
@Override
public
Result
<?>
getEngineersGanttList
(
EngineersGanttDTO
.
Request
reqDTO
)
{
// 按日期返回技术员们当天的服务甘特图,不需要翻页
...
...
@@ -46,31 +47,31 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
log
.
info
(
"根据多条件,查询返回符合条件的技术员列表:{}"
,
engineerCodes
);
}
List
<
Order
AppointmentEntity
>
orderAppointments
=
orderAppointmentDao
.
findByDate
AndEngineerCodeIn
(
reqDTO
.
getDate
(),
engineerCodes
);
List
<
String
>
orderIds
=
order
Appointments
.
stream
().
map
(
OrderAppointment
Entity:
:
getOrderId
).
collect
(
Collectors
.
toList
());
Map
<
String
,
Order
Request
Entity
>
mapOrderRequest
=
getOrdersByOrderIds
(
orderIds
);
HashMap
<
String
,
List
<
EngineersGanttDTO
.
Order
>>
mapEngineers
=
new
HashMap
<>();
for
(
Order
AppointmentEntity
e
:
orderAppointment
s
)
{
List
<
Order
InfoEntity
>
orders
=
orderInfoDao
.
findByDt
AndEngineerCodeIn
(
reqDTO
.
getDate
(),
engineerCodes
);
List
<
String
>
orderIds
=
order
s
.
stream
().
map
(
OrderInfo
Entity:
:
getOrderId
).
collect
(
Collectors
.
toList
());
Map
<
String
,
Order
Info
Entity
>
mapOrderRequest
=
getOrdersByOrderIds
(
orderIds
);
HashMap
<
String
,
List
<
EngineersGanttDTO
.
Slot
>>
mapEngineers
=
new
HashMap
<>();
for
(
Order
InfoEntity
e
:
order
s
)
{
// log.info("===== order_id: [{}]", e.getOrderId());
EngineersGanttDTO
.
Order
order
=
new
EngineersGanttDTO
.
Order
();
EngineersGanttDTO
.
Slot
slot
=
new
EngineersGanttDTO
.
Slot
();
// todo 需要根据订单时间和状态,采用expectXXXX或者actualXXXX
order
.
setStartTime
(
e
.
getExpectStartTime
()).
setEndTime
(
e
.
getExpectEndTime
(
));
order
.
setOrderId
(
e
.
getOrderId
()).
setPreStatus
(
e
.
getPreStatus
(
));
order
.
setTips
(
getOrderTips
(
e
.
getOrderId
()));
slot
.
setBtime
(
getHourMinute
(
e
.
getExpectTimeBegin
()
));
slot
.
setEtime
(
getHourMinute
(
e
.
getExpectTimeEnd
()
));
slot
.
setTooltip
(
getOrderTips
(
e
.
getOrderId
()));
OrderSkillProjection
orderSkill
=
order
Request
Dao
.
getOrderSkillCaptionByOrderId
(
e
.
getOrderId
());
OrderSkillProjection
orderSkill
=
order
Info
Dao
.
getOrderSkillCaptionByOrderId
(
e
.
getOrderId
());
if
(
orderSkill
!=
null
)
{
order
.
setCaption
(
orderSkill
.
getSkillCaption
());
slot
.
setText
(
orderSkill
.
getSkillCaption
());
}
order
.
setAppointmentStatus
(
mapOrderRequest
.
get
(
e
.
getOrderId
()).
getAppointmentStatus
());
List
<
EngineersGanttDTO
.
Order
>
order
s
=
null
;
slot
.
setBgColor
(
mapOrderRequest
.
get
(
e
.
getOrderId
()).
getAppointmentStatus
().
toString
());
List
<
EngineersGanttDTO
.
Slot
>
slot
s
=
null
;
if
(
mapEngineers
.
containsKey
(
e
.
getEngineerCode
()))
{
order
s
=
mapEngineers
.
get
(
e
.
getEngineerCode
());
slot
s
=
mapEngineers
.
get
(
e
.
getEngineerCode
());
}
else
{
order
s
=
new
ArrayList
<>();
slot
s
=
new
ArrayList
<>();
}
orders
.
add
(
order
);
mapEngineers
.
put
(
e
.
getEngineerCode
(),
order
s
);
slots
.
add
(
slot
);
mapEngineers
.
put
(
e
.
getEngineerCode
(),
slot
s
);
}
List
<
EngineersGanttDTO
.
GanttChart
>
engineers
=
new
ArrayList
<>();
...
...
@@ -84,7 +85,7 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
.
setEngineerName
(
engineerInfo
.
getName
())
.
setGrade
(
engineerInfo
.
getGrade
());
CapacityEngineerStatEntity
capacityEngineerStat
=
capacityEngineerStatDao
.
getByWorkdayAndEngineerCode
(
reqDTO
.
getDate
(
),
engineerCode
);
CapacityEngineerStatEntity
capacityEngineerStat
=
capacityEngineerStatDao
.
getByWorkdayAndEngineerCode
(
DateUtils
.
formatDate
(
reqDTO
.
getDate
()
),
engineerCode
);
if
(
capacityEngineerStat
==
null
)
{
log
.
warn
(
"技术员当日的容量数据不存在,{}{}"
,
engineerCode
,
reqDTO
.
getDate
());
}
else
{
...
...
@@ -92,7 +93,7 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
engineer
.
setCapTotal
(
capacityEngineerStat
.
getCapTotal
().
toString
()).
setCapUsed
(
capacityEngineerStat
.
getCapUsed
().
toString
());
}
if
(
mapEngineers
.
containsKey
(
engineerCode
))
{
engineer
.
set
Order
s
(
mapEngineers
.
get
(
engineerCode
));
engineer
.
set
Slot
s
(
mapEngineers
.
get
(
engineerCode
));
}
// engineer.setErrorTip(); todo
engineers
.
add
(
engineer
);
...
...
@@ -101,7 +102,7 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
engineers
.
sort
(
Comparator
.
comparing
(
EngineersGanttDTO
.
GanttChart
::
getEngineerName
));
EngineersGanttDTO
.
Result
res
=
new
EngineersGanttDTO
.
Result
();
res
.
setDate
(
reqDTO
.
getDate
(
)).
setEngineers
(
engineers
);
res
.
setDate
(
DateUtils
.
formatDate
(
reqDTO
.
getDate
()
)).
setEngineers
(
engineers
);
return
Result
.
success
(
res
);
}
...
...
@@ -135,15 +136,15 @@ public class EngineerGanttServiceImpl implements EngineerGanttService {
}
}
public
Map
<
String
,
Order
Request
Entity
>
getOrdersByOrderIds
(
List
<
String
>
orderIds
)
{
List
<
Order
RequestEntity
>
orders
=
orderRequest
Dao
.
findAllByOrderIdIn
(
orderIds
);
public
Map
<
String
,
Order
Info
Entity
>
getOrdersByOrderIds
(
List
<
String
>
orderIds
)
{
List
<
Order
InfoEntity
>
orders
=
orderInfo
Dao
.
findAllByOrderIdIn
(
orderIds
);
return
orders
.
stream
().
collect
(
Collectors
.
toMap
(
Order
Request
Entity:
:
getOrderId
,
order
->
order
));
return
orders
.
stream
().
collect
(
Collectors
.
toMap
(
Order
Info
Entity:
:
getOrderId
,
order
->
order
));
}
private
List
<
?
>
getOrderTips
(
String
orderId
)
{
private
List
<
LabelValueDTO
>
getOrderTips
(
String
orderId
)
{
// log.info("==> getOrderTips: orderId[{}]", orderId);
Order
RequestEntity
order
=
orderRequest
Dao
.
getByOrderId
(
orderId
);
Order
InfoEntity
order
=
orderInfo
Dao
.
getByOrderId
(
orderId
);
if
(
order
==
null
)
{
log
.
error
(
"对应的订单不存在!{}"
,
orderId
);
return
null
;
...
...
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