Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
W
work_service
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
licc
work_service
Commits
dcf5c10b
Commit
dcf5c10b
authored
Jan 20, 2021
by
nie'hong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
导出完成
parent
fb31745c
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
279 additions
and
3 deletions
+279
-3
CalendarDto.java
...del/src/main/java/cn/wisenergy/model/dto/CalendarDto.java
+29
-0
DayWorkTimeAndType.java
.../main/java/cn/wisenergy/model/dto/DayWorkTimeAndType.java
+25
-0
MonthlyWorkingHoursStatistics.java
...cn/wisenergy/model/dto/MonthlyWorkingHoursStatistics.java
+31
-0
StatisticsTableDto.java
.../main/java/cn/wisenergy/model/dto/StatisticsTableDto.java
+24
-0
StatisticsService.java
...src/main/java/cn/wisenergy/service/StatisticsService.java
+17
-0
StatisticsServiceImpl.java
...java/cn/wisenergy/service/impl/StatisticsServiceImpl.java
+81
-0
StatisticsController.java
...energy/web/admin/controller/app/StatisticsController.java
+64
-0
application-dev.yml
wisenergy-web-admin/src/main/resources/application-dev.yml
+5
-3
application.yml
wisenergy-web-admin/src/main/resources/application.yml
+3
-0
No files found.
wisenergy-model/src/main/java/cn/wisenergy/model/dto/CalendarDto.java
0 → 100644
View file @
dcf5c10b
package
cn
.
wisenergy
.
model
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* @Authotr:陈奇
* @QQ1799796883
*/
@Data
@ApiModel
(
value
=
"CalendarDto"
,
description
=
"日历展示类"
)
public
class
CalendarDto
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
1678604782365034642L
;
@ApiModelProperty
(
name
=
"userId"
,
value
=
"填报工时人员"
)
private
Integer
userId
;
@ApiModelProperty
(
name
=
"status"
,
value
=
"状态: 1:已填报 ,2:已审核,3:被驳回"
)
private
Integer
status
;
@ApiModelProperty
(
name
=
"workDay"
,
value
=
"工时的日期"
)
private
Date
workDay
;
}
wisenergy-model/src/main/java/cn/wisenergy/model/dto/DayWorkTimeAndType.java
0 → 100644
View file @
dcf5c10b
package
cn
.
wisenergy
.
model
.
dto
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @description: 一天的工时信息
* @author: nh
* @create: 2021-01-20 13:36
**/
@Data
public
class
DayWorkTimeAndType
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1198786417184957375L
;
private
Integer
day
;
/**
* 工时类型
*/
private
Integer
type
;
private
Integer
workTime
;
}
wisenergy-model/src/main/java/cn/wisenergy/model/dto/MonthlyWorkingHoursStatistics.java
0 → 100644
View file @
dcf5c10b
package
cn
.
wisenergy
.
model
.
dto
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @description:
* @author: nh
* @create: 2021-01-19 15:47
**/
@Data
public
class
MonthlyWorkingHoursStatistics
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
8216457470821285624L
;
/**
* 填报次数
*/
private
Integer
count
;
/**
* 填报工时
*/
private
Integer
workTime
;
/**
* 审核情况(非审核人员为空)
*/
private
ApprovalStatistics
approvalStatistics
;
}
wisenergy-model/src/main/java/cn/wisenergy/model/dto/StatisticsTableDto.java
0 → 100644
View file @
dcf5c10b
package
cn
.
wisenergy
.
model
.
dto
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* @description: 月汇总信息
* @author: nh
* @create: 2021-01-19 17:22
**/
@Data
public
class
StatisticsTableDto
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
7581698349760684467L
;
private
Integer
userId
;
private
String
userName
;
List
<
DayWorkTimeAndType
>
dayWorkTimeAndTypeList
;
}
wisenergy-service/src/main/java/cn/wisenergy/service/StatisticsService.java
0 → 100644
View file @
dcf5c10b
package
cn
.
wisenergy
.
service
;
import
cn.wisenergy.model.dto.StatisticsTableDto
;
import
java.util.List
;
public
interface
StatisticsService
{
/**
* 获取部门所有员工每天工时
* @param year
* @param month
* @param deptId
* @return
*/
List
<
StatisticsTableDto
>
getMonthlyCollect
(
Integer
year
,
Integer
month
,
Integer
userId
,
Integer
deptId
);
}
wisenergy-service/src/main/java/cn/wisenergy/service/impl/StatisticsServiceImpl.java
0 → 100644
View file @
dcf5c10b
package
cn
.
wisenergy
.
service
.
impl
;
import
cn.wisenergy.common.utils.DateUtil
;
import
cn.wisenergy.common.utils.exception.BASE_RESP_CODE_ENUM
;
import
cn.wisenergy.common.utils.exception.BaseCustomException
;
import
cn.wisenergy.mapper.WorkTimeOrderMapper
;
import
cn.wisenergy.mapper.WorkUserDeptMapper
;
import
cn.wisenergy.model.app.WorkUser
;
import
cn.wisenergy.model.dto.DayWorkTimeAndType
;
import
cn.wisenergy.model.dto.StatisticsTableDto
;
import
cn.wisenergy.model.enums.ManagerEnum
;
import
cn.wisenergy.service.StatisticsService
;
import
cn.wisenergy.service.WorkUserService
;
import
com.alibaba.excel.util.StringUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
/**
* @description:
* @author: nh
* @create: 2021-01-19 17:19
**/
@Service
@Slf4j
public
class
StatisticsServiceImpl
implements
StatisticsService
{
@Autowired
WorkUserService
workUserService
;
@Autowired
WorkTimeOrderMapper
workOrderMapper
;
@Autowired
WorkUserDeptMapper
workUserDeptMapper
;
@Override
public
List
<
StatisticsTableDto
>
getMonthlyCollect
(
Integer
year
,
Integer
month
,
Integer
userId
,
Integer
deptId
)
{
log
.
info
(
"StatisticsServiceImpl[]getMonthlyCollect[]input.param"
+
year
+
month
+
userId
,
deptId
);
if
(
userId
==
null
)
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
INPUT_PARAM_IS_NULL
);
}
//管理员用户
WorkUser
user
=
workUserService
.
getUserById
(
userId
);
if
(
user
.
getLevel
()
!=
ManagerEnum
.
IS_SYSTEM_MANAGER
.
getCode
())
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
THE_USER_NOT_MANAGER_PLASE_MANAGER_LOGIN
);
}
//默认时间为当月
if
(
StringUtils
.
isEmpty
(
year
)
||
StringUtils
.
isEmpty
(
month
))
{
Date
now
=
new
Date
();
year
=
DateUtil
.
getYear
(
now
);
month
=
DateUtil
.
getMonth
(
now
)+
1
;
}
//默认部门主键为1
if
(
deptId
==
null
)
{
deptId
=
1
;
}
//获取部门下所有员工主键
List
<
Integer
>
userIdList
=
workUserDeptMapper
.
listByDeptId
(
deptId
);
//获取员工一个月中已审核、自动审核的工单单日汇总汇总
ArrayList
<
StatisticsTableDto
>
statisticsTableDtos
=
new
ArrayList
<>();
for
(
Integer
id
:
userIdList
)
{
//获取部门下用户信息
WorkUser
workUser
=
workUserService
.
getUserById
(
id
);
//获取当月每天工时信息
List
<
DayWorkTimeAndType
>
dayWorkTimeAndTypes
=
workOrderMapper
.
listByDateAndUserId
(
year
,
month
,
id
);
//封装成对象
StatisticsTableDto
statisticsTableDto
=
new
StatisticsTableDto
();
statisticsTableDto
.
setUserId
(
id
);
statisticsTableDto
.
setUserName
(
workUser
.
getName
());
statisticsTableDto
.
setDayWorkTimeAndTypeList
(
dayWorkTimeAndTypes
);
statisticsTableDtos
.
add
(
statisticsTableDto
);
}
return
statisticsTableDtos
;
}
}
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/StatisticsController.java
0 → 100644
View file @
dcf5c10b
package
cn
.
wisenergy
.
web
.
admin
.
controller
.
app
;
import
cn.wisenergy.common.utils.exception.BASE_RESP_CODE_ENUM
;
import
cn.wisenergy.common.utils.exception.BaseCustomException
;
import
cn.wisenergy.model.app.WorkDept
;
import
cn.wisenergy.model.dto.StatisticsTableDto
;
import
cn.wisenergy.service.StatisticsService
;
import
cn.wisenergy.service.WorkDeptService
;
import
cn.wisenergy.web.admin.controller.common.BaseController
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* @description:
* @author: nh
* @create: 2021-01-19 17:13
**/
@RestController
@RequestMapping
(
value
=
"/statistics"
)
@Slf4j
@Api
(
tags
=
"月统计报表"
)
public
class
StatisticsController
extends
BaseController
{
@Autowired
StatisticsService
statisticsService
;
@Autowired
WorkDeptService
workDeptService
;
@ApiOperation
(
value
=
"获取部门员工一个月每天的工时"
,
notes
=
"获取部门员工一个月每天的工时"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"year"
,
value
=
"年"
),
@ApiImplicitParam
(
name
=
"month"
,
value
=
"月"
),
@ApiImplicitParam
(
name
=
"userId"
,
value
=
"用户主键"
,
required
=
true
),
@ApiImplicitParam
(
name
=
"deptId"
,
value
=
"部门编号"
)
})
@GetMapping
(
"/getMonthlyCollect"
)
public
List
<
StatisticsTableDto
>
getMonthlyCollect
(
Integer
year
,
Integer
month
,
Integer
userId
,
Integer
deptId
)
{
log
.
info
(
"StatisticsController[]getMonthlyCollect[]input.param"
+
year
+
month
+
userId
+
deptId
);
List
<
StatisticsTableDto
>
statisticsTableDtos
=
statisticsService
.
getMonthlyCollect
(
year
,
month
,
userId
,
deptId
);
return
statisticsTableDtos
;
}
@ApiOperation
(
value
=
""
)
@GetMapping
(
"getDeptInfo"
)
public
List
<
WorkDept
>
getDeptInfo
(
Integer
userId
,
Integer
deptId
)
{
log
.
info
(
"StatisticsController[]getDeptInfo[]input.param"
+
userId
+
deptId
);
if
(
userId
==
null
)
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
INPUT_PARAM_IS_NULL
);
}
List
<
WorkDept
>
workDepts
=
workDeptService
.
getDeptInfo
(
userId
,
deptId
);
return
workDepts
;
}
}
wisenergy-web-admin/src/main/resources/application-dev.yml
View file @
dcf5c10b
...
...
@@ -3,9 +3,9 @@ spring:
type
:
com.alibaba.druid.pool.DruidDataSource
druid
:
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://localhost:3306/work_hours?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=GMT%2B8
url
:
jdbc:mysql://localhost:3306/work
ing
_hours?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=GMT%2B8
username
:
root
password
:
123456
password
:
admin
initial-size
:
10
max-active
:
100
min-idle
:
10
...
...
@@ -68,3 +68,5 @@ jwt:
expire
:
14400
logging
:
config
:
classpath:logback-spring.xml
wisenergy-web-admin/src/main/resources/application.yml
View file @
dcf5c10b
...
...
@@ -65,3 +65,6 @@ camera:
mybatis
:
mapper-locations
:
classpath:/mapper/*Mapper.xml
logging
:
level
:
cn.wisenergy.mapper
:
debug
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment