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