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 e4422c37
authored
Jul 06, 2023
by
王力
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev_workbench_summary' into 'develop'
Dev workbench summary See merge request !153
2 parents
c560583f
16e9b95f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
245 additions
and
49 deletions
project-order/src/main/java/com/dituhui/pea/order/controller/WorkbenchController.java
project-order/src/main/java/com/dituhui/pea/order/dto/WorkbenchSummaryResp.java
project-order/src/main/java/com/dituhui/pea/order/entity/OrderAppointment.java
project-order/src/main/java/com/dituhui/pea/order/entity/OrderRequest.java
project-order/src/main/java/com/dituhui/pea/order/service/WorkbenchService.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/WorkbenchServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/controller/WorkbenchController.java
View file @
e4422c3
...
@@ -9,8 +9,11 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -9,8 +9,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.time.LocalDate
;
@Slf4j
@Slf4j
@RestController
@RestController
@RequestMapping
(
"/pea-order"
)
@RequestMapping
(
"/pea-order"
)
...
@@ -29,4 +32,15 @@ public class WorkbenchController {
...
@@ -29,4 +32,15 @@ public class WorkbenchController {
}
}
return
res
;
return
res
;
}
}
@GetMapping
(
"/workbench/summary"
)
public
Result
<?>
workbenchSummary
(
@RequestParam
String
levelType
,
@RequestParam
String
levelValue
,
@RequestParam
LocalDate
date
)
{
Result
<?>
res
=
null
;
try
{
res
=
workbenchService
.
getWorkbenchSummary
(
levelType
,
levelValue
,
date
);
}
catch
(
BusinessException
e
)
{
return
Result
.
failed
(
e
.
getMessage
());
}
return
res
;
}
}
}
project-order/src/main/java/com/dituhui/pea/order/dto/WorkbenchSummaryResp.java
0 → 100644
View file @
e4422c3
package
com
.
dituhui
.
pea
.
order
.
dto
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
WorkbenchSummaryResp
{
private
List
<
ItemDTO
>
summary
;
@Data
public
static
class
ItemDTO
{
private
String
type
;
private
List
<
ValueDTO
>
rows
;
}
@Data
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
static
class
ValueDTO
{
private
String
title
;
private
String
value
;
private
String
total
;
private
String
valueColor
;
private
String
url
;
public
ValueDTO
(
String
title
,
String
value
,
String
total
,
String
valueColor
,
String
url
){
this
.
title
=
title
;
this
.
value
=
value
;
this
.
total
=
total
;
this
.
valueColor
=
valueColor
;
this
.
url
=
url
;
}
}
}
\ No newline at end of file
project-order/src/main/java/com/dituhui/pea/order/entity/OrderAppointment.java
View file @
e4422c3
...
@@ -3,6 +3,7 @@ package com.dituhui.pea.order.entity;
...
@@ -3,6 +3,7 @@ package com.dituhui.pea.order.entity;
import
lombok.Data
;
import
lombok.Data
;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
import
java.time.LocalDate
;
@Data
@Data
public
class
OrderAppointment
{
public
class
OrderAppointment
{
...
@@ -15,6 +16,7 @@ public class OrderAppointment {
...
@@ -15,6 +16,7 @@ public class OrderAppointment {
private
String
engineerPhone
;
private
String
engineerPhone
;
private
Integer
engineerAge
;
private
Integer
engineerAge
;
private
Integer
isWorkshop
;
private
Integer
isWorkshop
;
private
LocalDate
dt
;
private
Timestamp
expectStartTime
;
private
Timestamp
expectStartTime
;
private
Timestamp
expectEndTime
;
private
Timestamp
expectEndTime
;
private
Timestamp
actualTime
;
private
Timestamp
actualTime
;
...
...
project-order/src/main/java/com/dituhui/pea/order/entity/OrderRequest.java
View file @
e4422c3
package
com
.
dituhui
.
pea
.
order
.
entity
;
package
com
.
dituhui
.
pea
.
order
.
entity
;
import
lombok.Data
;
import
lombok.Data
;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
import
java.time.LocalDate
;
@Data
@Data
public
class
OrderRequest
{
public
class
OrderRequest
{
...
@@ -21,6 +23,7 @@ public class OrderRequest {
...
@@ -21,6 +23,7 @@ public class OrderRequest {
private
String
skill
;
private
String
skill
;
private
String
applyNote
;
private
String
applyNote
;
private
String
faultDescribe
;
private
String
faultDescribe
;
private
LocalDate
dt
;
private
Timestamp
expectTimeBegin
;
private
Timestamp
expectTimeBegin
;
private
Timestamp
expectTimeEnd
;
private
Timestamp
expectTimeEnd
;
private
String
expectTimeDesc
;
private
String
expectTimeDesc
;
...
...
project-order/src/main/java/com/dituhui/pea/order/service/WorkbenchService.java
View file @
e4422c3
...
@@ -4,6 +4,10 @@ import com.dituhui.pea.common.Result;
...
@@ -4,6 +4,10 @@ import com.dituhui.pea.common.Result;
import
com.dituhui.pea.order.dto.EngineersGanttReqDTO
;
import
com.dituhui.pea.order.dto.EngineersGanttReqDTO
;
import
com.dituhui.pea.order.dto.OrderChangeListReqDTO
;
import
com.dituhui.pea.order.dto.OrderChangeListReqDTO
;
import
java.time.LocalDate
;
public
interface
WorkbenchService
{
public
interface
WorkbenchService
{
Result
<?>
getOrderChangeList
(
OrderChangeListReqDTO
orderChangeListReqDTO
);
Result
<?>
getOrderChangeList
(
OrderChangeListReqDTO
orderChangeListReqDTO
);
Result
<?>
getWorkbenchSummary
(
String
levelType
,
String
levelValue
,
LocalDate
dt
);
}
}
project-order/src/main/java/com/dituhui/pea/order/service/impl/WorkbenchServiceImpl.java
View file @
e4422c3
package
com
.
dituhui
.
pea
.
order
.
service
.
impl
;
package
com
.
dituhui
.
pea
.
order
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.order.dao.*
;
import
com.dituhui.pea.order.dao.*
;
import
com.dituhui.pea.order.dto.OrderChangeListReqDTO
;
import
com.dituhui.pea.order.dto.OrderChangeListReqDTO
;
import
com.dituhui.pea.order.dto.OrderChangeListRespDTO
;
import
com.dituhui.pea.order.dto.OrderChangeListRespDTO
;
import
com.dituhui.pea.order.dto.WorkbenchSummaryResp
;
import
com.dituhui.pea.order.entity.OrderChangeEntity
;
import
com.dituhui.pea.order.entity.OrderChangeEntity
;
import
com.dituhui.pea.order.entity.OrderRequest
;
import
com.dituhui.pea.order.entity.OrderRequestEntity
;
import
com.dituhui.pea.order.entity.OrderRequestEntity
;
import
com.dituhui.pea.order.service.WorkbenchService
;
import
com.dituhui.pea.order.service.WorkbenchService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -14,59 +17,191 @@ import org.springframework.data.domain.PageRequest;
...
@@ -14,59 +17,191 @@ import org.springframework.data.domain.PageRequest;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.time.LocalDate
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
@Slf4j
@Slf4j
@Service
@Service
public
class
WorkbenchServiceImpl
implements
WorkbenchService
{
public
class
WorkbenchServiceImpl
implements
WorkbenchService
{
@Autowired
@Autowired
private
OrderRequestDao
orderRequestDao
;
private
OrderChangeDao
orderChangeDao
;
@Autowired
@Autowired
private
OrderAppointmentDao
orderAppointmentDao
;
private
OrderRequestDao
orderRequestDao
;
@Autowired
@Autowired
private
EngineerInfoDao
engineerInfoDao
;
private
OrderAppointmentDao
orderAppointmentDao
;
@Autowired
@Autowired
private
CapacityEngineerStatDao
capacityEngineerStatDao
;
private
EngineerInfoDao
engineerInfoDao
;
@Autowired
@Autowired
private
OrderEventDao
orderEventDao
;
private
CapacityEngineerStatDao
capacityEngineerStatDao
;
@Override
@Autowired
public
Result
<?>
getOrderChangeList
(
OrderChangeListReqDTO
reqDTO
)
{
private
OrderRequestMPDao
orderRequestMPDao
;
Pageable
pageable
=
PageRequest
.
of
(
reqDTO
.
getPage
()
-
1
,
reqDTO
.
getSize
());
Page
<?>
changes
;
@Override
String
levelType
=
reqDTO
.
getLevelType
();
public
Result
<?>
getOrderChangeList
(
OrderChangeListReqDTO
reqDTO
)
{
String
levelValue
=
reqDTO
.
getLevelValue
();
Pageable
pageable
=
PageRequest
.
of
(
reqDTO
.
getPage
()
-
1
,
reqDTO
.
getSize
());
if
(
"cluster"
.
equals
(
levelType
))
{
Page
<?>
changes
;
changes
=
orderEventDao
.
findAllByClusterId
(
levelValue
,
reqDTO
.
getDate
(),
pageable
);
String
levelType
=
reqDTO
.
getLevelType
();
}
else
if
(
"branch"
.
equals
(
levelType
))
{
String
levelValue
=
reqDTO
.
getLevelValue
();
changes
=
orderEventDao
.
findAllByBranchId
(
levelValue
,
reqDTO
.
getDate
(),
pageable
);
if
(
"cluster"
.
equals
(
levelType
))
{
}
else
{
changes
=
orderChangeDao
.
findAllByClusterId
(
levelValue
,
reqDTO
.
getDate
(),
pageable
);
changes
=
orderEventDao
.
findAllByGroupId
(
levelValue
,
reqDTO
.
getDate
(),
pageable
);
}
else
if
(
"branch"
.
equals
(
levelType
))
{
}
changes
=
orderChangeDao
.
findAllByBranchId
(
levelValue
,
reqDTO
.
getDate
(),
pageable
);
List
<
OrderChangeListRespDTO
.
Content
>
contents
=
new
ArrayList
<>();
}
else
{
for
(
Object
e1
:
changes
.
getContent
())
{
changes
=
orderChangeDao
.
findAllByGroupId
(
levelValue
,
reqDTO
.
getDate
(),
pageable
);
OrderChangeEntity
e
=
(
OrderChangeEntity
)
e1
;
}
OrderChangeListRespDTO
.
Content
content
=
new
OrderChangeListRespDTO
.
Content
();
List
<
OrderChangeListRespDTO
.
Content
>
contents
=
new
ArrayList
<>();
OrderRequestEntity
orderRequestEntity
=
orderRequestDao
.
getByOrderId
(
e
.
getOrderId
());
for
(
Object
e1
:
changes
.
getContent
())
{
content
.
setOrderId
(
e
.
getOrderId
())
OrderChangeEntity
e
=
(
OrderChangeEntity
)
e1
;
.
setCustomerName
(
orderRequestEntity
.
getName
())
OrderChangeListRespDTO
.
Content
content
=
new
OrderChangeListRespDTO
.
Content
();
.
setOperator
(
e
.
getOperator
())
OrderRequestEntity
orderRequestEntity
=
orderRequestDao
.
getByOrderId
(
e
.
getOrderId
());
.
setDescription
(
e
.
getContent
())
content
.
setOrderId
(
e
.
getOrderId
())
.
setMemo
(
e
.
getMemo
())
.
setCustomerName
(
orderRequestEntity
.
getName
())
.
setUpdateTime
(
e
.
getUpdateTime
());
.
setOperator
(
e
.
getOperator
())
contents
.
add
(
content
);
.
setDescription
(
e
.
getContent
())
}
.
setMemo
(
e
.
getMemo
())
OrderChangeListRespDTO
respDTO
=
new
OrderChangeListRespDTO
();
.
setUpdateTime
(
e
.
getUpdateTime
().
toString
());
respDTO
.
setTotal
(
changes
.
getTotalElements
())
contents
.
add
(
content
);
.
setPages
(
changes
.
getTotalPages
())
}
.
setPageSize
(
changes
.
getSize
())
OrderChangeListRespDTO
respDTO
=
new
OrderChangeListRespDTO
();
.
setContent
(
contents
);
respDTO
.
setTotal
(
changes
.
getTotalElements
())
return
Result
.
success
(
respDTO
);
.
setPages
(
changes
.
getTotalPages
())
}
.
setPageSize
(
changes
.
getSize
())
}
.
setContent
(
contents
);
return
Result
.
success
(
respDTO
);
}
@Override
public
Result
<?>
getWorkbenchSummary
(
String
levelType
,
String
levelValue
,
LocalDate
dt
)
{
List
<
WorkbenchSummaryResp
.
ItemDTO
>
items
=
new
ArrayList
<>();
HashMap
<
String
,
Integer
>
methodSummary
=
this
.
transAppointmentMethod
(
this
.
queryCountByAppointmentMethod
(
levelType
,
levelValue
,
dt
));
WorkbenchSummaryResp
.
ItemDTO
methodItem
=
new
WorkbenchSummaryResp
.
ItemDTO
();
methodItem
.
setType
(
"order"
);
methodItem
.
setRows
(
this
.
packValueAppointmentMethod
(
methodSummary
));
items
.
add
(
methodItem
);
HashMap
<
String
,
Integer
>
statusSummary
=
this
.
transOrderStatus
(
this
.
queryCountByOrderStatus
(
levelType
,
levelValue
,
dt
));
WorkbenchSummaryResp
.
ItemDTO
statusItem
=
new
WorkbenchSummaryResp
.
ItemDTO
();
methodItem
.
setType
(
"order"
);
methodItem
.
setRows
(
this
.
packValueOrderStatus
(
statusSummary
));
items
.
add
(
statusItem
);
WorkbenchSummaryResp
res
=
new
WorkbenchSummaryResp
();
res
.
setSummary
(
items
);
return
Result
.
success
(
res
);
}
private
List
<
Map
<
String
,
Object
>>
queryCountByAppointmentMethod
(
String
levelType
,
String
levelValue
,
LocalDate
dt
)
{
QueryWrapper
<
OrderRequest
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
select
(
"appointment_method, appointment_status, COUNT(*) as count"
)
.
lambda
()
.
eq
(
OrderRequest:
:
getDt
,
dt
)
.
eq
(
levelType
.
equals
(
"cluster"
),
OrderRequest:
:
getOrgClusterId
,
levelValue
)
.
eq
(
levelType
.
equals
(
"branch"
),
OrderRequest:
:
getOrgBranchId
,
levelValue
)
.
eq
(
levelType
.
equals
(
"group"
),
OrderRequest:
:
getOrgGroupId
,
levelValue
)
.
groupBy
(
OrderRequest:
:
getAppointmentMethod
,
OrderRequest:
:
getAppointmentStatus
);
return
orderRequestMPDao
.
selectMaps
(
wrapper
);
}
private
List
<
Map
<
String
,
Object
>>
queryCountByOrderStatus
(
String
levelType
,
String
levelValue
,
LocalDate
dt
)
{
QueryWrapper
<
OrderRequest
>
wrapper
=
new
QueryWrapper
<>();
wrapper
.
select
(
"appointment_status, COUNT(*) as count"
)
.
lambda
()
.
eq
(
OrderRequest:
:
getDt
,
dt
)
.
eq
(
levelType
.
equals
(
"cluster"
),
OrderRequest:
:
getOrgClusterId
,
levelValue
)
.
eq
(
levelType
.
equals
(
"branch"
),
OrderRequest:
:
getOrgBranchId
,
levelValue
)
.
eq
(
levelType
.
equals
(
"group"
),
OrderRequest:
:
getOrgGroupId
,
levelValue
)
.
groupBy
(
OrderRequest:
:
getAppointmentStatus
);
return
orderRequestMPDao
.
selectMaps
(
wrapper
);
}
private
HashMap
<
String
,
Integer
>
transAppointmentMethod
(
List
<
Map
<
String
,
Object
>>
results
)
{
HashMap
<
String
,
Integer
>
map
=
new
HashMap
<>();
Integer
manualTotal
=
0
;
// 人工
Integer
autoTotal
=
0
;
Integer
total
=
0
;
for
(
Map
<
String
,
Object
>
result
:
results
)
{
String
method
=
(
String
)
result
.
get
(
"appointment_method"
);
String
status
=
(
String
)
result
.
get
(
"appointment_status"
);
Integer
count
=
(
int
)
result
.
get
(
"count"
);
total
+=
count
;
if
(
method
.
equals
(
"MANUAL"
))
{
manualTotal
+=
count
;
}
else
if
(
method
.
startsWith
(
"AUTO_"
))
{
autoTotal
+=
count
;
}
if
(
method
.
equals
(
"MANUAL"
)
&&
status
.
equals
(
"NOT_ASSIGNED"
))
{
map
.
put
(
"manualDealing"
,
count
);
}
else
if
(
method
.
equals
(
"AUTO_"
)
&&
status
.
equals
(
"NOT_ASSIGNED"
))
{
map
.
put
(
"autoDealing"
,
count
);
}
}
map
.
put
(
"manualTotal"
,
manualTotal
);
map
.
put
(
"autoTotal"
,
autoTotal
);
map
.
put
(
"total"
,
total
);
return
map
;
}
private
HashMap
<
String
,
Integer
>
transOrderStatus
(
List
<
Map
<
String
,
Object
>>
results
)
{
HashMap
<
String
,
Integer
>
map
=
new
HashMap
<>();
for
(
Map
<
String
,
Object
>
result
:
results
)
{
String
status
=
(
String
)
result
.
get
(
"appointment_status"
);
Integer
count
=
(
int
)
result
.
get
(
"count"
);
map
.
put
(
status
,
count
);
}
return
map
;
}
private
List
<
WorkbenchSummaryResp
.
ValueDTO
>
packValueAppointmentMethod
(
HashMap
<
String
,
Integer
>
summary
)
{
List
<
WorkbenchSummaryResp
.
ValueDTO
>
items
=
new
ArrayList
<>();
String
url
=
"/dispatchBench/index"
;
Integer
manualDealing
=
summary
.
getOrDefault
(
"manualDealing"
,
0
);
Integer
manualTotal
=
summary
.
getOrDefault
(
"manualTotal"
,
0
);
Integer
autoDealing
=
summary
.
getOrDefault
(
"autoDealing"
,
0
);
Integer
autoTotal
=
summary
.
getOrDefault
(
"autoTotal"
,
0
);
Integer
total
=
summary
.
getOrDefault
(
"total"
,
0
);
items
.
add
(
new
WorkbenchSummaryResp
.
ValueDTO
(
"待人工处理"
,
manualDealing
.
toString
(),
manualTotal
.
toString
(),
"#FF8000"
,
url
));
items
.
add
(
new
WorkbenchSummaryResp
.
ValueDTO
(
"待自动处理"
,
autoDealing
.
toString
(),
autoTotal
.
toString
(),
"#469967"
,
url
));
items
.
add
(
new
WorkbenchSummaryResp
.
ValueDTO
(
"全部订单"
,
null
,
total
.
toString
(),
null
,
url
));
return
items
;
}
private
List
<
WorkbenchSummaryResp
.
ValueDTO
>
packValueOrderStatus
(
HashMap
<
String
,
Integer
>
summary
)
{
List
<
WorkbenchSummaryResp
.
ValueDTO
>
items
=
new
ArrayList
<>();
String
url
=
"/dispatchBench/index"
;
Integer
assigned
=
summary
.
getOrDefault
(
"ASSIGNED"
,
0
);
Integer
contacted
=
summary
.
getOrDefault
(
"CONTACTED"
,
0
);
Integer
departed
=
summary
.
getOrDefault
(
"DEPARTED"
,
0
);
Integer
dealing
=
assigned
+
contacted
+
departed
;
Integer
started
=
summary
.
getOrDefault
(
"STARTED"
,
0
);
Integer
cancel
=
summary
.
getOrDefault
(
"CANCELED"
,
0
);
Integer
finished
=
summary
.
getOrDefault
(
"FINISHED"
,
0
);
items
.
add
(
new
WorkbenchSummaryResp
.
ValueDTO
(
"待上门"
,
dealing
.
toString
(),
null
,
"#469967"
,
url
));
items
.
add
(
new
WorkbenchSummaryResp
.
ValueDTO
(
"服务中"
,
started
.
toString
(),
null
,
"#016FFF"
,
url
));
items
.
add
(
new
WorkbenchSummaryResp
.
ValueDTO
(
"已完成"
,
finished
.
toString
(),
null
,
null
,
url
));
items
.
add
(
new
WorkbenchSummaryResp
.
ValueDTO
(
"已取消"
,
cancel
.
toString
(),
null
,
null
,
url
));
items
.
add
(
new
WorkbenchSummaryResp
.
ValueDTO
(
"已改约"
,
"0"
,
null
,
null
,
url
));
items
.
add
(
new
WorkbenchSummaryResp
.
ValueDTO
(
"已延误"
,
"0"
,
null
,
"#FF3D44"
,
url
));
return
items
;
}
}
\ No newline at end of file
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