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
4feb653e
Commit
4feb653e
authored
4 years ago
by
cq990612
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化代码结构
parent
765b5304
master
chenqi
chenqi2.0
chenqi3.0
chenqi4.0
chenqi5.0
No related merge requests found
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
40 deletions
+53
-40
WorkTimeOrderService.java
.../main/java/cn/wisenergy/service/WorkTimeOrderService.java
+7
-1
WorkCollectServiceImpl.java
...ava/cn/wisenergy/service/impl/WorkCollectServiceImpl.java
+6
-13
WorkTimeOrderServiceImpl.java
...a/cn/wisenergy/service/impl/WorkTimeOrderServiceImpl.java
+34
-22
WorkTimeOrderController.java
...rgy/web/admin/controller/app/WorkTimeOrderController.java
+6
-4
No files found.
wisenergy-service/src/main/java/cn/wisenergy/service/WorkTimeOrderService.java
View file @
4feb653e
...
...
@@ -127,5 +127,11 @@ public interface WorkTimeOrderService {
List
<
WorkTimeOrderDto
>
addTest
(
CreateWorkOrderDto
createWorkOrderDto
);
/**
* 功能:获取当天填报总状态
* @param userId
* @param workDay
* @return
*/
int
statusYes
(
Integer
userId
,
Date
workDay
);
}
This diff is collapsed.
Click to expand it.
wisenergy-service/src/main/java/cn/wisenergy/service/impl/WorkCollectServiceImpl.java
View file @
4feb653e
...
...
@@ -148,7 +148,6 @@ public class WorkCollectServiceImpl implements WorkCollectService {
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
INPUT_PARAM_IS_NULL
);
}
Integer
id
=
getByUserIdAndWorkDay
(
workCollect
.
getUserId
(),
workCollect
.
getWorkDay
()).
getId
();
System
.
out
.
println
(
"我是collect的id:"
+
id
);
int
updateRow
=
workCollectMapper
.
updateStatusOrTotalTime
(
id
,
workCollect
.
getStatus
(),
workCollect
.
getTotalTime
());
if
(
updateRow
==
0
)
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
UPDATE_DATA_FAIL
);
...
...
@@ -164,24 +163,18 @@ public class WorkCollectServiceImpl implements WorkCollectService {
userId
=
workTimeOrder
.
getUserId
();
workDay
=
workTimeOrder
.
getWorkDay
();
WorkCollect
workCollect
=
workCollectService
.
getByUserIdAndWorkDay
(
userId
,
workDay
);
if
(
null
==
workCollect
)
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
WORK_ORDER_INFO_IS_NULL
);
}
int
status
=
2
;
List
<
WorkTimeOrder
>
byDay
=
workTimeOrderMapper
.
getByDay
(
workTimeOrder
.
getUserId
(),
workTimeOrder
.
getWorkDay
());
int
total_time
=
0
;
// 查看userId workDay 的数据status是否全部为2
List
<
WorkTimeOrder
>
timeOrders
=
workTimeOrderMapper
.
getByDay
(
userId
,
workDay
);
for
(
WorkTimeOrder
timeOrder
:
timeOrders
)
{
if
(
1
==
timeOrder
.
getStatus
()
||
3
==
timeOrder
.
getStatus
()
||
4
==
timeOrder
.
getStatus
())
{
status
=
1
;
}
for
(
WorkTimeOrder
timeOrder
:
byDay
)
{
total_time
+=
timeOrder
.
getWorkTime
();
}
int
status
=
workTimeOrderService
.
statusYes
(
workTimeOrder
.
getUserId
(),
workTimeOrder
.
getWorkDay
());
WorkCollect
workCollect
=
workCollectService
.
getByUserIdAndWorkDay
(
workTimeOrder
.
getUserId
(),
workTimeOrder
.
getWorkDay
());
workCollect
.
setStatus
(
status
);
workCollect
.
setTotalTime
(
total_time
);
workCollectService
.
update
(
workCollect
);
}
return
true
;
}
}
This diff is collapsed.
Click to expand it.
wisenergy-service/src/main/java/cn/wisenergy/service/impl/WorkTimeOrderServiceImpl.java
View file @
4feb653e
...
...
@@ -217,10 +217,16 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
}
dto
.
setStatus
(
1
);
if
(
null
==
dto
.
getStatus
())
{
dto
.
setStatus
(
1
);
}
if
(
3
==
type
||
4
==
type
)
{
dto
.
setStatus
(
2
);
}
if
(
null
!=
dto
.
getStatus
()
&&
3
==
dto
.
getStatus
())
{
dto
.
setStatus
(
4
);
}
dto
.
setIsOvertime
(
0
);
if
(
workHolidayService
.
isHoliday
(
dto
.
getWorkDay
()))
{
dto
.
setIsOvertime
(
1
);
...
...
@@ -261,7 +267,6 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
workCollect
.
setStatus
(
status
);
workCollectService
.
update
(
workCollect
);
}
return
workTimeOrders
;
}
...
...
@@ -283,34 +288,37 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
// 1.判断是否超过8小时
int
count
=
0
;
List
<
WorkTimeOrder
>
byDayToDto
=
getByDayToDto
(
workTimeOrders
.
get
(
0
).
getUserId
(),
workTimeOrders
.
get
(
0
).
getWorkDay
());
for
(
WorkTimeOrder
workTimeOrder
:
byDayToDto
)
{
if
(
3
==
workTimeOrder
.
getStatus
())
{
continue
;
int
i
;
for
(
WorkTimeOrder
timeOrder
:
byDayToDto
)
{
i
=
0
;
for
(
WorkTimeOrderDto
workTimeOrder
:
workTimeOrders
)
{
if
(!
workTimeOrder
.
getWorkId
().
equals
(
timeOrder
.
getWorkId
()))
{
i
++;
}
}
count
+=
workTimeOrder
.
getWorkTime
();
if
(
i
==
workTimeOrders
.
size
())
count
+=
timeOrder
.
getWorkTime
();
}
System
.
out
.
println
(
count
);
timeNotEight
(
count
,
workTimeOrders
);
int
totalTime
=
0
;
// 2.判断是否重复填报
isRepeat
(
workTimeOrders
);
for
(
WorkTimeOrderDto
workTimeOrder
:
workTimeOrders
)
{
for
(
WorkTimeOrder
orderDto
:
byDayToDto
)
{
//
过滤表中已经被驳回的
if
(
3
==
orderDto
.
getStatus
(
))
{
continue
;
//
workId如果相同就不管
if
(
workTimeOrder
.
getWorkId
().
equals
(
orderDto
.
getWorkId
()
))
{
break
;
}
totalTime
+=
orderDto
.
getWorkTime
();
// 如果类型不相同
if
(!
workTimeOrder
.
getType
().
equals
(
orderDto
.
getType
()))
{
continue
;
}
// 类型相同projectId不同
if
(
null
!=
workTimeOrder
.
getProjectId
()
&&
null
!=
orderDto
.
getProjectId
()
||
!
workTimeOrder
.
getProjectId
().
equals
(
orderDto
.
getProjectId
()))
{
continue
;
// 填报和数据库的类型相同
if
(
workTimeOrder
.
getType
().
equals
(
orderDto
.
getType
()))
{
if
(
1
==
workTimeOrder
.
getType
()
||
2
==
workTimeOrder
.
getType
())
if
(
workTimeOrder
.
getProjectId
().
equals
(
orderDto
.
getProjectId
()))
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
WORK_ORDER_ALREADY_COMMIT
);
}
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
WORK_ORDER_ALREADY_COMMIT
);
}
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
WORK_ORDER_ALREADY_COMMIT
);
}
totalTime
+=
workTimeOrder
.
getWorkTime
();
}
...
...
@@ -318,7 +326,11 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
// 更新collect表
int
status
=
statusYes
(
workTimeOrders
.
get
(
0
).
getUserId
(),
workTimeOrderDtos
.
get
(
0
).
getWorkDay
());
int
totalTime
=
0
;
List
<
WorkTimeOrder
>
byDay
=
workTimeOrderMapper
.
getByDay
(
workTimeOrders
.
get
(
0
).
getUserId
(),
workTimeOrderDtos
.
get
(
0
).
getWorkDay
());
for
(
WorkTimeOrder
workTimeOrder
:
byDay
)
{
totalTime
+=
workTimeOrder
.
getWorkTime
();
}
WorkCollect
workCollect
=
new
WorkCollect
();
BeanUtils
.
copyProperties
(
workTimeOrders
.
get
(
0
),
workCollect
);
workCollect
.
setTotalTime
(
totalTime
);
...
...
@@ -922,7 +934,7 @@ public class WorkTimeOrderServiceImpl implements WorkTimeOrderService {
}
// 判断当天是否全部审批通过
p
rivate
int
statusYes
(
Integer
userId
,
Date
workDay
)
{
p
ublic
int
statusYes
(
Integer
userId
,
Date
workDay
)
{
int
status
=
1
;
int
size
=
0
;
...
...
This diff is collapsed.
Click to expand it.
wisenergy-web-admin/src/main/java/cn/wisenergy/web/admin/controller/app/WorkTimeOrderController.java
View file @
4feb653e
package
cn
.
wisenergy
.
web
.
admin
.
controller
.
app
;
import
cn.wisenergy.common.utils.DateUtil
;
import
cn.wisenergy.common.utils.exception.BaseCustomException
;
import
cn.wisenergy.common.utils.exception.CustomException
;
import
cn.wisenergy.common.utils.exception.RESP_CODE_ENUM
;
import
cn.wisenergy.common.utils.exception.Result
;
import
cn.wisenergy.model.app.WorkTimeOrder
;
import
cn.wisenergy.model.dto.*
;
import
cn.wisenergy.service.*
;
import
cn.wisenergy.model.dto.AppletsPendApprovalDto
;
import
cn.wisenergy.model.dto.CreateWorkOrderDto
;
import
cn.wisenergy.model.dto.ProjectsDto
;
import
cn.wisenergy.model.dto.WorkTimeOrderDto
;
import
cn.wisenergy.service.WorkTimeOrderService
;
import
cn.wisenergy.web.admin.controller.common.BaseController
;
import
com.github.pagehelper.PageInfo
;
import
io.swagger.annotations.Api
;
...
...
@@ -16,7 +18,6 @@ import io.swagger.annotations.ApiImplicitParams;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.beanutils.ConvertUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -175,4 +176,5 @@ public class WorkTimeOrderController extends BaseController {
return
getResult
(
workTimeOrderDtos
);
}
}
This diff is collapsed.
Click to expand it.
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