Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-api-boot
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-api-boot
Commits
e4c9a1e7
提交
e4c9a1e7
authored
5月 25, 2022
作者:
Administrator
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat:首页人员统计图
上级
d21388be
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
131 行增加
和
1 行删除
+131
-1
LocationTurnoverRepository.java
...iring/app/domain/location/LocationTurnoverRepository.java
+5
-1
LocationTurnoverService.java
...pp/service/location/turnover/LocationTurnoverService.java
+9
-0
LocationTurnoverServiceImpl.java
...e/location/turnover/impl/LocationTurnoverServiceImpl.java
+74
-0
PersonnelStatisticsEchartsVo.java
...ng/app/vo/perstatistics/PersonnelStatisticsEchartsVo.java
+33
-0
PersonnelStatisticsVo.java
...om/yiring/app/vo/perstatistics/PersonnelStatisticsVo.java
+3
-0
LocationTurnoverController.java
...app/web/location/turnover/LocationTurnoverController.java
+7
-0
没有找到文件。
app/src/main/java/com/yiring/app/domain/location/LocationTurnoverRepository.java
浏览文件 @
e4c9a1e7
...
...
@@ -14,4 +14,8 @@ import org.springframework.stereotype.Repository;
@Repository
public
interface
LocationTurnoverRepository
extends
JpaRepository
<
LocationTurnover
,
Serializable
>,
JpaSpecificationExecutor
<
LocationTurnover
>
{}
extends
JpaRepository
<
LocationTurnover
,
Serializable
>,
JpaSpecificationExecutor
<
LocationTurnover
>
{
// @Query("select count(v) as unm from LocationTurnover v where v.sourceId=?1 and group by v.user")
// Integer selectNum(Long sourceId);
}
app/src/main/java/com/yiring/app/service/location/turnover/LocationTurnoverService.java
浏览文件 @
e4c9a1e7
...
...
@@ -3,6 +3,7 @@ package com.yiring.app.service.location.turnover;
import
com.yiring.app.param.perstatistics.PersonnelStatisticsQueryParam
;
import
com.yiring.app.vo.perstatistics.PersonnelStatisticsDetailVo
;
import
com.yiring.app.vo.perstatistics.PersonnelStatisticsEchartsVo
;
import
com.yiring.app.vo.perstatistics.PersonnelStatisticsVo
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.param.PageParam
;
...
...
@@ -26,6 +27,14 @@ public interface LocationTurnoverService {
PageParam
pageParam
);
/**
* 首页图标
* @author tzl
* @date 2022/5/25 10:02
* @return com.yiring.common.core.Result<com.yiring.common.vo.PageVo<com.yiring.app.vo.perstatistics.PersonnelStatisticsVo>>
*/
Result
<
PageVo
<
PersonnelStatisticsEchartsVo
>>
listInfo
();
/**
* 下拉框
* @author tzl
* @date 2022/5/16 13:59
...
...
app/src/main/java/com/yiring/app/service/location/turnover/impl/LocationTurnoverServiceImpl.java
浏览文件 @
e4c9a1e7
...
...
@@ -11,6 +11,7 @@ import com.yiring.app.excel.perstatistics.PersonnelStatisticsExportExcel;
import
com.yiring.app.param.perstatistics.PersonnelStatisticsQueryParam
;
import
com.yiring.app.service.location.turnover.LocationTurnoverService
;
import
com.yiring.app.vo.perstatistics.PersonnelStatisticsDetailVo
;
import
com.yiring.app.vo.perstatistics.PersonnelStatisticsEchartsVo
;
import
com.yiring.app.vo.perstatistics.PersonnelStatisticsVo
;
import
com.yiring.app.vo.perstatistics.TurnoverResultVo
;
import
com.yiring.auth.domain.dept.Department
;
...
...
@@ -76,6 +77,7 @@ public class LocationTurnoverServiceImpl implements LocationTurnoverService {
cq
.
multiselect
(
num
,
sourceId
,
enter
).
groupBy
(
sourceId
,
enter
);
List
<
Predicate
>
list
=
new
ArrayList
<>();
//查询条件
list
.
add
(
cb
.
equal
(
root
.
get
(
LocationTurnover
.
Fields
.
type
),
LocationTurnover
.
Type
.
DISTRICT
));
if
(
ObjectUtil
.
isNotNull
(
personnelStatisticsQueryParam
.
getSourceId
()))
{
list
.
add
(
cb
.
equal
(
root
.
get
(
LocationTurnover
.
Fields
.
sourceId
),
personnelStatisticsQueryParam
.
getSourceId
()));
...
...
@@ -115,6 +117,7 @@ public class LocationTurnoverServiceImpl implements LocationTurnoverService {
personnelStatisticsVo
.
setRegion
(
maps
.
get
(
id
));
personnelStatisticsVo
.
setAdmissionNumber
(
0L
);
personnelStatisticsVo
.
setAttendance
(
0L
);
if
(
ObjectUtil
.
isNotNull
(
personnelStatisticsQueryParam
.
getStartTime
())
&&
ObjectUtil
.
isNotNull
(
personnelStatisticsQueryParam
.
getEndTime
())
...
...
@@ -125,6 +128,8 @@ public class LocationTurnoverServiceImpl implements LocationTurnoverService {
personnelStatisticsVo
.
setStartTime
(
LocalDateTime
.
of
(
LocalDate
.
now
(),
LocalTime
.
MIN
));
personnelStatisticsVo
.
setEndTime
(
LocalDateTime
.
of
(
LocalDate
.
now
(),
LocalTime
.
MAX
));
}
//处理数据结构
for
(
TurnoverResultVo
turnoverResultVo
:
resultList
)
{
if
(
id
.
equals
(
turnoverResultVo
.
getSourceId
()))
{
if
(
turnoverResultVo
.
getEnter
())
{
...
...
@@ -141,6 +146,62 @@ public class LocationTurnoverServiceImpl implements LocationTurnoverService {
}
@Override
public
Result
<
PageVo
<
PersonnelStatisticsEchartsVo
>>
listInfo
()
{
List
<
District
>
all
=
districtRepository
.
findAll
();
Map
<
Long
,
String
>
maps
=
all
.
stream
().
collect
(
Collectors
.
toMap
(
District:
:
getId
,
District:
:
getName
));
CriteriaBuilder
cb
=
em
.
getCriteriaBuilder
();
CriteriaQuery
<
TurnoverResultVo
>
cq
=
cb
.
createQuery
(
TurnoverResultVo
.
class
);
Root
<
LocationTurnover
>
root
=
cq
.
from
(
LocationTurnover
.
class
);
Path
<
Object
>
sourceId
=
root
.
get
(
LocationTurnover
.
Fields
.
sourceId
);
Path
<
Object
>
enter
=
root
.
get
(
LocationTurnover
.
Fields
.
enter
);
Expression
<
Long
>
num
=
cb
.
count
(
root
.
get
(
BasicEntity
.
Fields
.
id
));
cq
.
multiselect
(
num
,
sourceId
,
enter
).
groupBy
(
sourceId
,
enter
);
List
<
Predicate
>
list
=
new
ArrayList
<>();
//查询类型为区域
list
.
add
(
cb
.
equal
(
root
.
get
(
LocationTurnover
.
Fields
.
type
),
LocationTurnover
.
Type
.
DISTRICT
));
//当天内
list
.
add
(
cb
.
between
(
root
.
get
(
LocationTurnover
.
Fields
.
time
),
LocalDateTime
.
of
(
LocalDate
.
now
(),
LocalTime
.
MIN
),
LocalDateTime
.
of
(
LocalDate
.
now
(),
LocalTime
.
MAX
)
)
);
cq
.
where
(
list
.
toArray
(
new
Predicate
[
0
]));
List
<
TurnoverResultVo
>
resultList
=
em
.
createQuery
(
cq
).
getResultList
();
List
<
Long
>
collect
=
resultList
.
stream
()
.
map
(
TurnoverResultVo:
:
getSourceId
)
.
distinct
()
.
collect
(
Collectors
.
toList
());
List
<
PersonnelStatisticsEchartsVo
>
pageList
=
new
ArrayList
<>();
for
(
Long
id
:
collect
)
{
PersonnelStatisticsEchartsVo
personnelStatisticsVo
=
new
PersonnelStatisticsEchartsVo
();
personnelStatisticsVo
.
setRegion
(
maps
.
get
(
id
));
for
(
TurnoverResultVo
turnoverResultVo
:
resultList
)
{
if
(
id
.
equals
(
turnoverResultVo
.
getSourceId
()))
{
//查询相关人数
List
<
LocationTurnover
>
all1
=
locationTurnoverRepository
.
findAll
(
condition
(
PersonnelStatisticsQueryParam
.
builder
().
sourceId
(
id
).
build
())
);
List
<
User
>
collect1
=
all1
.
stream
()
.
map
(
LocationTurnover:
:
getUser
)
.
distinct
()
.
collect
(
Collectors
.
toList
());
personnelStatisticsVo
.
setNumOfPeo
(
collect1
.
size
());
}
}
pageList
.
add
(
personnelStatisticsVo
);
}
PageVo
<
PersonnelStatisticsEchartsVo
>
build
=
PageVo
.
build
(
pageList
,
pageList
.
size
());
return
Result
.
ok
(
build
);
}
@Override
public
Result
<
PageVo
<
PersonnelStatisticsVo
>>
indexInfo
(
PersonnelStatisticsQueryParam
personnelStatisticsQueryParam
)
{
...
...
@@ -189,6 +250,17 @@ public class LocationTurnoverServiceImpl implements LocationTurnoverService {
personnelStatisticsVo
.
setAttendance
(
0L
);
for
(
TurnoverResultVo
turnoverResultVo
:
resultList
)
{
if
(
id
.
equals
(
turnoverResultVo
.
getSourceId
()))
{
//查询相关人数
personnelStatisticsQueryParam
.
setSourceId
(
id
);
List
<
LocationTurnover
>
all1
=
locationTurnoverRepository
.
findAll
(
condition
(
personnelStatisticsQueryParam
)
);
List
<
User
>
collect1
=
all1
.
stream
()
.
map
(
LocationTurnover:
:
getUser
)
.
distinct
()
.
collect
(
Collectors
.
toList
());
personnelStatisticsVo
.
setNumOfPeo
(
collect1
.
size
());
if
(
turnoverResultVo
.
getEnter
())
{
personnelStatisticsVo
.
setAdmissionNumber
(
turnoverResultVo
.
getNum
());
}
else
{
...
...
@@ -310,11 +382,13 @@ public class LocationTurnoverServiceImpl implements LocationTurnoverService {
condition
(
personnelStatisticsQueryParam
),
PageParam
.
toPageable
(
pageParam
)
);
List
<
PersonnelStatisticsDetailVo
>
data
=
all
.
get
()
.
map
(
locationTurnover
->
{
PersonnelStatisticsDetailVo
vo
=
new
PersonnelStatisticsDetailVo
();
BeanUtils
.
copyProperties
(
locationTurnover
,
vo
);
PersonnelStatisticsDetailVo
.
UserVo
build
=
PersonnelStatisticsDetailVo
.
UserVo
.
builder
()
.
realName
(
locationTurnover
.
getUser
().
getRealName
())
...
...
app/src/main/java/com/yiring/app/vo/perstatistics/PersonnelStatisticsEchartsVo.java
0 → 100644
浏览文件 @
e4c9a1e7
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
app
.
vo
.
perstatistics
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serial
;
import
java.io.Serializable
;
import
lombok.*
;
import
lombok.experimental.FieldDefaults
;
/**
* @author tzl
* @version 1.0
* @description:
* @date 2022/5/15 9:15
*/
@ApiModel
(
"PersonnelStatisticsEchartsVo"
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
public
class
PersonnelStatisticsEchartsVo
implements
Serializable
{
@Serial
private
static
final
long
serialVersionUID
=
-
5973651085056867803L
;
@ApiModelProperty
(
value
=
"区域"
,
example
=
"化工区"
)
String
region
;
@ApiModelProperty
(
value
=
"相关人数"
)
long
numOfPeo
;
}
app/src/main/java/com/yiring/app/vo/perstatistics/PersonnelStatisticsVo.java
浏览文件 @
e4c9a1e7
...
...
@@ -46,4 +46,7 @@ public class PersonnelStatisticsVo implements Serializable {
@ApiModelProperty
(
value
=
"结束时间"
)
LocalDateTime
endTime
;
@ApiModelProperty
(
value
=
"相关人数"
)
long
numOfPeo
;
}
app/src/main/java/com/yiring/app/web/location/turnover/LocationTurnoverController.java
浏览文件 @
e4c9a1e7
...
...
@@ -4,6 +4,7 @@ package com.yiring.app.web.location.turnover;
import
com.yiring.app.param.perstatistics.PersonnelStatisticsQueryParam
;
import
com.yiring.app.service.location.turnover.LocationTurnoverService
;
import
com.yiring.app.vo.perstatistics.PersonnelStatisticsDetailVo
;
import
com.yiring.app.vo.perstatistics.PersonnelStatisticsEchartsVo
;
import
com.yiring.app.vo.perstatistics.PersonnelStatisticsVo
;
import
com.yiring.common.core.Result
;
import
com.yiring.common.param.PageParam
;
...
...
@@ -47,6 +48,12 @@ public class LocationTurnoverController {
return
locationTurnoverService
.
pageInfo
(
personnelStatisticsQueryParam
,
pageParam
);
}
@ApiOperation
(
value
=
"查询人员统计图表"
)
@GetMapping
(
"listInfo"
)
public
Result
<
PageVo
<
PersonnelStatisticsEchartsVo
>>
listInfo
()
{
return
locationTurnoverService
.
listInfo
();
}
@ApiOperation
(
value
=
"下拉框"
)
@GetMapping
(
"indexInfo"
)
public
Result
<
PageVo
<
PersonnelStatisticsVo
>>
indexInfo
(
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论