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 48d6df36
authored
Jul 12, 2023
by
王力
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev_schedule_summary' into 'develop'
泛型处理 See merge request !215
2 parents
c309bbf6
2affa02d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
21 deletions
project-order/src/main/java/com/dituhui/pea/order/dto/ScheduleSummaryResp.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/ScheduleServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/dto/ScheduleSummaryResp.java
View file @
48d6df3
...
@@ -3,6 +3,7 @@ package com.dituhui.pea.order.dto;
...
@@ -3,6 +3,7 @@ package com.dituhui.pea.order.dto;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
lombok.Data
;
import
lombok.Data
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
@Data
@Data
...
@@ -18,17 +19,19 @@ public class ScheduleSummaryResp {
...
@@ -18,17 +19,19 @@ public class ScheduleSummaryResp {
@Data
@Data
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
static
class
ValueDTO
{
public
static
class
ValueDTO
<
T
>
{
private
String
title
;
private
String
title
;
private
Integer
value
;
private
Integer
value
;
private
String
valueColor
;
private
String
valueColor
;
private
String
url
;
private
String
urlName
;
private
HashMap
<
String
,
List
<
T
>>
params
;
public
ValueDTO
(
String
title
,
Integer
value
,
String
valueColor
,
String
url
){
public
ValueDTO
(
String
title
,
Integer
value
,
String
valueColor
,
String
url
Name
,
HashMap
<
String
,
List
<
T
>>
params
){
this
.
title
=
title
;
this
.
title
=
title
;
this
.
value
=
value
;
this
.
value
=
value
;
this
.
valueColor
=
valueColor
;
this
.
valueColor
=
valueColor
;
this
.
url
=
url
;
this
.
urlName
=
urlName
;
this
.
params
=
params
;
}
}
}
}
}
}
project-order/src/main/java/com/dituhui/pea/order/service/impl/ScheduleServiceImpl.java
View file @
48d6df3
...
@@ -15,10 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -15,10 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -420,30 +417,59 @@ public class ScheduleServiceImpl implements ScheduleService {
...
@@ -420,30 +417,59 @@ public class ScheduleServiceImpl implements ScheduleService {
for
(
Map
.
Entry
<
String
,
Integer
>
entry
:
map
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
Integer
>
entry
:
map
.
entrySet
())
{
sum
+=
entry
.
getValue
();
sum
+=
entry
.
getValue
();
}
}
String
url
=
"/dispatchBench/index
"
;
String
url
Name
=
"DispatchBenchManage
"
;
List
<
ScheduleSummaryResp
.
ValueDTO
>
items
=
new
ArrayList
<>();
List
<
ScheduleSummaryResp
.
ValueDTO
>
items
=
new
ArrayList
<>();
items
.
add
(
new
ScheduleSummaryResp
.
ValueDTO
(
"总单量"
,
sum
,
"#469967"
,
url
));
items
.
add
(
new
ScheduleSummaryResp
.
ValueDTO
(
"安装"
,
map
.
getOrDefault
(
"安装"
,
0
),
null
,
url
));
items
.
add
(
new
ScheduleSummaryResp
.
ValueDTO
(
"总单量"
,
sum
,
"#469967"
,
urlName
,
new
HashMap
<>()));
items
.
add
(
new
ScheduleSummaryResp
.
ValueDTO
(
"维修"
,
map
.
getOrDefault
(
"维修"
,
0
),
null
,
url
));
items
.
add
(
new
ScheduleSummaryResp
.
ValueDTO
(
"清洁保养"
,
map
.
getOrDefault
(
"清洁保养"
,
0
),
null
,
url
));
HashMap
<
String
,
List
<
String
>>
p1
=
this
.
packParams
(
"skillCategory"
,
"安装"
);
items
.
add
(
new
ScheduleSummaryResp
.
ValueDTO
(
"整改"
,
map
.
getOrDefault
(
"整改"
,
0
),
null
,
url
));
items
.
add
(
new
ScheduleSummaryResp
.
ValueDTO
(
"安装"
,
map
.
getOrDefault
(
"安装"
,
0
),
null
,
urlName
,
p1
));
HashMap
<
String
,
List
<
String
>>
p2
=
this
.
packParams
(
"skillCategory"
,
"维修"
);
items
.
add
(
new
ScheduleSummaryResp
.
ValueDTO
(
"维修"
,
map
.
getOrDefault
(
"维修"
,
0
),
null
,
urlName
,
p2
));
HashMap
<
String
,
List
<
String
>>
p3
=
this
.
packParams
(
"skillCategory"
,
"清洁保养"
);
items
.
add
(
new
ScheduleSummaryResp
.
ValueDTO
(
"清洁保养"
,
map
.
getOrDefault
(
"清洁保养"
,
0
),
null
,
urlName
,
p3
));
HashMap
<
String
,
List
<
String
>>
p4
=
this
.
packParams
(
"skillCategory"
,
"整改"
);
items
.
add
(
new
ScheduleSummaryResp
.
ValueDTO
(
"整改"
,
map
.
getOrDefault
(
"整改"
,
0
),
null
,
urlName
,
p4
));
return
items
;
return
items
;
}
}
private
List
<
ScheduleSummaryResp
.
ValueDTO
>
packGroupCategorySummary
(
HashMap
<
Integer
,
Integer
>
map
)
{
private
List
<
ScheduleSummaryResp
.
ValueDTO
>
packGroupCategorySummary
(
HashMap
<
Integer
,
Integer
>
map
)
{
String
url
=
"/dispatchBench/index
"
;
String
url
Name
=
"DispatchBenchManage
"
;
List
<
ScheduleSummaryResp
.
ValueDTO
>
items
=
new
ArrayList
<>();
List
<
ScheduleSummaryResp
.
ValueDTO
>
items
=
new
ArrayList
<>();
items
.
add
(
new
ScheduleSummaryResp
.
ValueDTO
(
"自有"
,
map
.
getOrDefault
(
1
,
0
),
null
,
url
));
items
.
add
(
new
ScheduleSummaryResp
.
ValueDTO
(
"网点"
,
map
.
getOrDefault
(
2
,
0
),
null
,
url
));
HashMap
<
String
,
List
<
Integer
>>
p1
=
this
.
packParams
(
"skillCategory"
,
1
);
items
.
add
(
new
ScheduleSummaryResp
.
ValueDTO
(
"自有"
,
map
.
getOrDefault
(
1
,
0
),
null
,
urlName
,
p1
));
HashMap
<
String
,
List
<
Integer
>>
p2
=
this
.
packParams
(
"skillCategory"
,
2
);
items
.
add
(
new
ScheduleSummaryResp
.
ValueDTO
(
"网点"
,
map
.
getOrDefault
(
2
,
0
),
null
,
urlName
,
p2
));
return
items
;
return
items
;
}
}
private
List
<
ScheduleSummaryResp
.
ValueDTO
>
packAppointmentSummary
(
HashMap
<
String
,
Integer
>
map
)
{
private
List
<
ScheduleSummaryResp
.
ValueDTO
>
packAppointmentSummary
(
HashMap
<
String
,
Integer
>
map
)
{
String
url
=
"/dispatchBench/index
"
;
String
url
Name
=
"DispatchBenchManage
"
;
List
<
ScheduleSummaryResp
.
ValueDTO
>
items
=
new
ArrayList
<>();
List
<
ScheduleSummaryResp
.
ValueDTO
>
items
=
new
ArrayList
<>();
items
.
add
(
new
ScheduleSummaryResp
.
ValueDTO
(
"自动指派"
,
map
.
getOrDefault
(
"autoTotal"
,
0
),
null
,
url
));
items
.
add
(
new
ScheduleSummaryResp
.
ValueDTO
(
"人工指派"
,
map
.
getOrDefault
(
"manualTotal"
,
0
),
null
,
url
));
HashMap
<
String
,
List
<
String
>>
p1
=
this
.
packParams
(
"appointmentType"
,
"AUTO_NOW"
,
"AUTO_BATCH"
);
items
.
add
(
new
ScheduleSummaryResp
.
ValueDTO
(
"未指派"
,
map
.
getOrDefault
(
"notAssignTotal"
,
0
),
null
,
url
));
items
.
add
(
new
ScheduleSummaryResp
.
ValueDTO
(
"自动指派"
,
map
.
getOrDefault
(
"autoTotal"
,
0
),
null
,
urlName
,
p1
));
HashMap
<
String
,
List
<
String
>>
p2
=
this
.
packParams
(
"appointmentType"
,
"MANUAL"
);
items
.
add
(
new
ScheduleSummaryResp
.
ValueDTO
(
"人工指派"
,
map
.
getOrDefault
(
"manualTotal"
,
0
),
null
,
urlName
,
p2
));
HashMap
<
String
,
List
<
String
>>
p3
=
this
.
packParams
(
"appointmentStatus"
,
"NOT_ASSIGNED"
);
items
.
add
(
new
ScheduleSummaryResp
.
ValueDTO
(
"未指派"
,
map
.
getOrDefault
(
"notAssignTotal"
,
0
),
null
,
urlName
,
p3
));
return
items
;
return
items
;
}
}
private
<
T
>
HashMap
<
String
,
List
<
T
>>
packParams
(
String
key
,
T
...
values
)
{
HashMap
<
String
,
List
<
T
>>
map
=
new
HashMap
<>();
List
<
T
>
value
=
new
ArrayList
<>();
for
(
T
v:
values
){
value
.
add
(
v
);
}
map
.
put
(
key
,
value
);
return
map
;
}
}
}
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