Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
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
74a4a493
Commit
74a4a493
authored
Jan 28, 2021
by
nie'hong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
82c188ac
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
32 additions
and
25 deletions
+32
-25
BASE_RESP_CODE_ENUM.java
...wisenergy/common/utils/exception/BASE_RESP_CODE_ENUM.java
+3
-1
WorkTimeOrderMapper.java
...rc/main/java/cn/wisenergy/mapper/WorkTimeOrderMapper.java
+1
-1
WorkProjectMapper.xml
...gy-mapper/src/main/resources/mapper/WorkProjectMapper.xml
+6
-6
WorkTimeOrderMapper.xml
...-mapper/src/main/resources/mapper/WorkTimeOrderMapper.xml
+2
-2
ProjectTypeEnum.java
...c/main/java/cn/wisenergy/model/enums/ProjectTypeEnum.java
+0
-2
StatisticsService.java
...src/main/java/cn/wisenergy/service/StatisticsService.java
+1
-2
StatisticsServiceImpl.java
...java/cn/wisenergy/service/impl/StatisticsServiceImpl.java
+9
-8
WorkUserServiceImpl.java
...n/java/cn/wisenergy/service/impl/WorkUserServiceImpl.java
+9
-0
StatisticsController.java
...energy/web/admin/controller/app/StatisticsController.java
+1
-3
No files found.
wisenergy-common/src/main/java/cn/wisenergy/common/utils/exception/BASE_RESP_CODE_ENUM.java
View file @
74a4a493
...
@@ -58,7 +58,9 @@ public enum BASE_RESP_CODE_ENUM {
...
@@ -58,7 +58,9 @@ public enum BASE_RESP_CODE_ENUM {
TIME_NOT_IS_NULL
(
"636"
,
"工时不能为0"
),
TIME_NOT_IS_NULL
(
"636"
,
"工时不能为0"
),
WORKDAY_NOT_NULL
(
"637"
,
"工时日期不能为空"
),
WORKDAY_NOT_NULL
(
"637"
,
"工时日期不能为空"
),
PROJECT_NOT_NULL
(
"638"
,
"项目类型不能为空"
),
PROJECT_NOT_NULL
(
"638"
,
"项目类型不能为空"
),
NOT_MANAGER_TYPE
(
"642"
,
"没有可以管理的类型项目"
),
NEW_PASSWORD_IS_HTE_SAME_OLD_PASSWORD
(
"639"
,
"新密码不能与旧密码相同"
),
PASSWORD_FORMAT_ERROR
(
"640"
,
"密码由6到16位数字和字母组成"
),
NOT_MANAGER_TYPE
(
"642"
,
"没有可以管理的类型项目"
);
...
...
wisenergy-mapper/src/main/java/cn/wisenergy/mapper/WorkTimeOrderMapper.java
View file @
74a4a493
...
@@ -57,7 +57,7 @@ public interface WorkTimeOrderMapper extends BaseMapper<WorkTimeOrder> {
...
@@ -57,7 +57,7 @@ public interface WorkTimeOrderMapper extends BaseMapper<WorkTimeOrder> {
*/
*/
Integer
getCountByCondition
(
Map
<
String
,
Object
>
map
);
Integer
getCountByCondition
(
Map
<
String
,
Object
>
map
);
List
<
WorkTimeAndCostCollect
>
getWorkTimeAndCostCollect
(
@Param
(
"projectIds"
)
List
<
Integer
>
projectIds
,
@Param
(
"firstDayOfMonth"
)
Date
firstDayOfMonth
);
List
<
WorkTimeAndCostCollect
>
getWorkTimeAndCostCollect
(
@Param
(
"projectIds"
)
List
<
Integer
>
projectIds
,
@Param
(
"firstDayOfMonth"
)
String
firstDayOfMonth
);
/**
/**
* 获取上班日期集合
* 获取上班日期集合
...
...
wisenergy-mapper/src/main/resources/mapper/WorkProjectMapper.xml
View file @
74a4a493
...
@@ -32,16 +32,16 @@
...
@@ -32,16 +32,16 @@
<if
test=
"id != null"
>
and id = #{id}
</if>
<if
test=
"id != null"
>
and id = #{id}
</if>
<if
test=
"oaProjectId != null"
>
and oa_project_id = #{oaProjectId}
</if>
<if
test=
"oaProjectId != null"
>
and oa_project_id = #{oaProjectId}
</if>
<if
test=
"projectName != null"
>
and project_name = #{projectName}
</if>
<if
test=
"projectName != null"
>
and project_name = #{projectName}
</if>
<if
test=
"type != null"
>
and
type
=#{type}
</if>
<if
test=
"type != null"
>
and
`type`
=#{type}
</if>
<if
test=
"managerId != null"
>
and manager_id = #{managerId}
</if>
<if
test=
"managerId != null"
>
and manager_id = #{managerId}
</if>
<if
test=
"dept
_id != null"
>
and dept_id = #{dept_i
d}
</if>
<if
test=
"dept
Id != null"
>
and dept_id = #{deptI
d}
</if>
<if
test=
"workTime != null"
>
and work_time =#{workTime}
</if>
<if
test=
"workTime != null"
>
and work_time =#{workTime}
</if>
<if
test=
"costBudget != null"
>
and cost_budget = #{costBudget}
</if>
<if
test=
"costBudget != null"
>
and cost_budget = #{costBudget}
</if>
<if
test=
"isConclusion != null"
>
and is_onclusion =#{isConclusion}
,
</if>
<if
test=
"isConclusion != null"
>
and is_onclusion =#{isConclusion}
</if>
<if
test=
"startTime != null"
>
and start_time =#{startTime}
,
</if>
<if
test=
"startTime != null"
>
and start_time =#{startTime}
</if>
<if
test=
"endTime != null"
>
and end_time =#{endTime}
,
</if>
<if
test=
"endTime != null"
>
and end_time =#{endTime}
</if>
<if
test=
"createTime != null"
>
and create_time
>
= #{createTime}
</if>
<if
test=
"createTime != null"
>
and create_time
>
= #{createTime}
</if>
<if
test=
"modifyTime != null"
>
and
#{modifyTime}
>
= modify_t
ime
</if>
<if
test=
"modifyTime != null"
>
and
modify_time
>
= modifyT
ime
</if>
</sql>
</sql>
<select
id=
"getProjectsByCriteria"
resultMap=
"BaseResultMap"
parameterType=
"map"
>
<select
id=
"getProjectsByCriteria"
resultMap=
"BaseResultMap"
parameterType=
"map"
>
...
...
wisenergy-mapper/src/main/resources/mapper/WorkTimeOrderMapper.xml
View file @
74a4a493
...
@@ -186,9 +186,9 @@
...
@@ -186,9 +186,9 @@
#{projectId}
#{projectId}
</foreach>
</foreach>
<if
test=
"firstDayOfMonth != null"
>
<if
test=
"firstDayOfMonth != null"
>
AND work_day >=
date(#{firstDayOfMonth})
AND work_day >=
#{firstDayOfMonth}
</if>
</if>
group by
`type`
,dept_id, project_id
group by
case when `type`= 1 then '商机' when `type`= 0 then '项目' end
,dept_id, project_id
</select>
</select>
<select
id=
"getDaysByDateAndStatus"
resultType=
"date"
>
<select
id=
"getDaysByDateAndStatus"
resultType=
"date"
>
...
...
wisenergy-model/src/main/java/cn/wisenergy/model/enums/ProjectTypeEnum.java
View file @
74a4a493
...
@@ -8,8 +8,6 @@ public enum ProjectTypeEnum {
...
@@ -8,8 +8,6 @@ public enum ProjectTypeEnum {
EXTERNAL_BUSINESS
(
5
,
"外部商务与技术交流"
,
3
),
EXTERNAL_BUSINESS
(
5
,
"外部商务与技术交流"
,
3
),
INTERNAL_TRAINING
(
6
,
"内部培训、技术准备、管理"
,
3
),
INTERNAL_TRAINING
(
6
,
"内部培训、技术准备、管理"
,
3
),
OTHER_NON_PROJECTS
(
7
,
"其他非项目/商机工作"
,
3
),
OTHER_NON_PROJECTS
(
7
,
"其他非项目/商机工作"
,
3
),
;
;
private
Integer
type
;
private
Integer
type
;
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/StatisticsService.java
View file @
74a4a493
...
@@ -4,7 +4,6 @@ import cn.wisenergy.model.dto.GetMonthlyCollectParam;
...
@@ -4,7 +4,6 @@ import cn.wisenergy.model.dto.GetMonthlyCollectParam;
import
cn.wisenergy.model.dto.WorkTimeAndCostCollect
;
import
cn.wisenergy.model.dto.WorkTimeAndCostCollect
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
public
interface
StatisticsService
{
public
interface
StatisticsService
{
...
@@ -27,5 +26,5 @@ public interface StatisticsService {
...
@@ -27,5 +26,5 @@ public interface StatisticsService {
* 获取负责项目在本月的工时汇总:花费工时,工时成本
* 获取负责项目在本月的工时汇总:花费工时,工时成本
* @param userId
* @param userId
*/
*/
List
<
WorkTimeAndCostCollect
>
getCurrentMonthWorkTimeCollect
(
Integer
userId
,
Date
startTime
);
List
<
WorkTimeAndCostCollect
>
getCurrentMonthWorkTimeCollect
(
Integer
userId
,
String
startTime
);
}
}
wisenergy-service/src/main/java/cn/wisenergy/service/impl/StatisticsServiceImpl.java
View file @
74a4a493
...
@@ -184,14 +184,14 @@ public class StatisticsServiceImpl implements StatisticsService {
...
@@ -184,14 +184,14 @@ public class StatisticsServiceImpl implements StatisticsService {
Integer
countByCondition
=
workTimeOrderMapper
.
getCountByCondition
(
map
);
Integer
countByCondition
=
workTimeOrderMapper
.
getCountByCondition
(
map
);
String
currentDayOfMonth
=
DateUtil
.
convertDateToYMDStr
(
firstDayOfMonth
);
String
currentDayOfMonth
=
DateUtil
.
convertDateToYMDStr
(
firstDayOfMonth
);
//统计项目类型工单填报次数、总工时
//统计项目类型工单填报次数、总工时
MonthlyWorkingHoursStatistics
statistics1
=
workTimeOrderMapper
.
statisticsByProjectType
(
userId
,
ProjectTypeEnum
.
PROJECT
.
get
Cod
e
(),
currentDayOfMonth
);
MonthlyWorkingHoursStatistics
statistics1
=
workTimeOrderMapper
.
statisticsByProjectType
(
userId
,
ProjectTypeEnum
.
PROJECT
.
get
Typ
e
(),
currentDayOfMonth
);
statistics1
.
setProjectType
(
ProjectTypeEnum
.
PROJECT
.
get
Msg
());
statistics1
.
setProjectType
(
ProjectTypeEnum
.
PROJECT
.
get
TypeName
());
statistics1
.
setNotFilledCount
(
notFilledCount
);
statistics1
.
setNotFilledCount
(
notFilledCount
);
statistics1
.
setRejectCount
(
countByCondition
);
statistics1
.
setRejectCount
(
countByCondition
);
statisticsArrayList
.
add
(
statistics1
);
statisticsArrayList
.
add
(
statistics1
);
//统计商机类型工单填报次数、总工时
//统计商机类型工单填报次数、总工时
MonthlyWorkingHoursStatistics
statistics2
=
workTimeOrderMapper
.
statisticsByProjectType
(
userId
,
ProjectTypeEnum
.
BUSINESS_OPPORTUNITY
.
get
Cod
e
(),
currentDayOfMonth
);
MonthlyWorkingHoursStatistics
statistics2
=
workTimeOrderMapper
.
statisticsByProjectType
(
userId
,
ProjectTypeEnum
.
BUSINESS_OPPORTUNITY
.
get
Typ
e
(),
currentDayOfMonth
);
statistics2
.
setProjectType
(
ProjectTypeEnum
.
BUSINESS_OPPORTUNITY
.
get
Msg
());
statistics2
.
setProjectType
(
ProjectTypeEnum
.
BUSINESS_OPPORTUNITY
.
get
TypeName
());
statistics2
.
setNotFilledCount
(
notFilledCount
);
statistics2
.
setNotFilledCount
(
notFilledCount
);
statistics2
.
setRejectCount
(
countByCondition
);
statistics2
.
setRejectCount
(
countByCondition
);
statisticsArrayList
.
add
(
statistics2
);
statisticsArrayList
.
add
(
statistics2
);
...
@@ -201,7 +201,7 @@ public class StatisticsServiceImpl implements StatisticsService {
...
@@ -201,7 +201,7 @@ public class StatisticsServiceImpl implements StatisticsService {
}
}
@Override
@Override
public
List
<
WorkTimeAndCostCollect
>
getCurrentMonthWorkTimeCollect
(
Integer
userId
,
Date
startTime
)
{
public
List
<
WorkTimeAndCostCollect
>
getCurrentMonthWorkTimeCollect
(
Integer
userId
,
String
startTime
)
{
log
.
info
(
"StatisticsServiceImpl[]getCurrentMonthWorkTimeCollect[]input.param"
+
userId
+
startTime
);
log
.
info
(
"StatisticsServiceImpl[]getCurrentMonthWorkTimeCollect[]input.param"
+
userId
+
startTime
);
if
(
userId
==
null
)
{
if
(
userId
==
null
)
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
INPUT_PARAM_IS_NULL
);
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
INPUT_PARAM_IS_NULL
);
...
@@ -212,11 +212,12 @@ public class StatisticsServiceImpl implements StatisticsService {
...
@@ -212,11 +212,12 @@ public class StatisticsServiceImpl implements StatisticsService {
}
}
//查询用户管理的项目
//查询用户管理的项目
List
<
WorkProject
>
userManageProjects
=
workProjectService
.
getUserManageProjects
(
userId
);
List
<
WorkProject
>
userManageProjects
=
workProjectService
.
getUserManageProjects
(
userId
);
//获取项目集合中所有项目的项目主键
if
(
CollectionUtil
.
isEmpty
(
userManageProjects
))
{
List
<
Integer
>
projectIds
=
userManageProjects
.
stream
().
map
(
WorkProject:
:
getId
).
collect
(
Collectors
.
toList
());
if
(
CollectionUtil
.
isEmpty
(
projectIds
))
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
MANAGER_NOT_PROJECT
);
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
MANAGER_NOT_PROJECT
);
}
}
//获取项目集合中所有项目的项目主键
List
<
Integer
>
projectIds
=
userManageProjects
.
stream
().
map
(
WorkProject:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
WorkTimeAndCostCollect
>
collect
=
workTimeOrderMapper
.
getWorkTimeAndCostCollect
(
projectIds
,
startTime
);
List
<
WorkTimeAndCostCollect
>
collect
=
workTimeOrderMapper
.
getWorkTimeAndCostCollect
(
projectIds
,
startTime
);
for
(
WorkTimeAndCostCollect
timeAndCostCollect
:
collect
)
{
for
(
WorkTimeAndCostCollect
timeAndCostCollect
:
collect
)
{
//部门名称
//部门名称
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/impl/WorkUserServiceImpl.java
View file @
74a4a493
...
@@ -72,6 +72,15 @@ public class WorkUserServiceImpl implements WorkUserService {
...
@@ -72,6 +72,15 @@ public class WorkUserServiceImpl implements WorkUserService {
if
(
userId
==
null
||
StringUtils
.
isEmpty
(
oldPassword
)
||
StringUtils
.
isEmpty
(
newPassword
))
{
if
(
userId
==
null
||
StringUtils
.
isEmpty
(
oldPassword
)
||
StringUtils
.
isEmpty
(
newPassword
))
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
INPUT_PARAM_IS_NULL
);
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
INPUT_PARAM_IS_NULL
);
}
}
//校验新密码类型
String
regex
=
"^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$"
;
if
(!
newPassword
.
matches
(
regex
))
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
PASSWORD_FORMAT_ERROR
);
}
//新密码与旧密码相同
if
(
oldPassword
.
equals
(
newPassword
))
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
NEW_PASSWORD_IS_HTE_SAME_OLD_PASSWORD
);
}
//根据主键和密码查找
//根据主键和密码查找
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"id"
,
userId
);
map
.
put
(
"id"
,
userId
);
...
...
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/StatisticsController.java
View file @
74a4a493
...
@@ -15,12 +15,10 @@ import io.swagger.annotations.ApiImplicitParam;
...
@@ -15,12 +15,10 @@ import io.swagger.annotations.ApiImplicitParam;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.format.annotation.DateTimeFormat
;
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.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -58,7 +56,7 @@ public class StatisticsController extends BaseController {
...
@@ -58,7 +56,7 @@ public class StatisticsController extends BaseController {
@ApiOperation
(
value
=
"获取负责项目工时汇总"
,
notes
=
"获取负责项目工时汇总"
)
@ApiOperation
(
value
=
"获取负责项目工时汇总"
,
notes
=
"获取负责项目工时汇总"
)
@GetMapping
(
"/getCurrentMonthWorkTimeCollect"
)
@GetMapping
(
"/getCurrentMonthWorkTimeCollect"
)
public
List
<
WorkTimeAndCostCollect
>
getWorkTimeCollect
(
Integer
userId
,
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
Date
startTime
)
{
public
List
<
WorkTimeAndCostCollect
>
getWorkTimeCollect
(
Integer
userId
,
String
startTime
)
{
log
.
info
(
"WorkUserController[]getCurrentMonthWorkTimeCollect[]input.param"
+
userId
,
startTime
);
log
.
info
(
"WorkUserController[]getCurrentMonthWorkTimeCollect[]input.param"
+
userId
,
startTime
);
if
(
userId
==
null
)
{
if
(
userId
==
null
)
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
INPUT_PARAM_IS_NULL
);
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
INPUT_PARAM_IS_NULL
);
...
...
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