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
213c4745
Commit
213c4745
authored
Jun 22, 2021
by
nie'hong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
将work_collect表中work_day与user_id设置为唯一索引后捕获重复插入的异常
parent
2f05f456
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
BASE_RESP_CODE_ENUM.java
...wisenergy/common/utils/exception/BASE_RESP_CODE_ENUM.java
+2
-1
WorkCollectServiceImpl.java
...ava/cn/wisenergy/service/impl/WorkCollectServiceImpl.java
+6
-3
No files found.
wisenergy-common/src/main/java/cn/wisenergy/common/utils/exception/BASE_RESP_CODE_ENUM.java
View file @
213c4745
...
...
@@ -103,7 +103,8 @@ public enum BASE_RESP_CODE_ENUM {
PROJECT_BO_INFO_ERROR
(
"685"
,
"项目所对应商机信息与OA中项目所对应商机信息不一致"
),
BO_INFO_NOT_FIND
(
"686"
,
"OA中的商机信息不存在"
),
LONG_LEAVE_START_NOT__GREATER_END
(
"687"
,
"长请假/调休开始时间不能大于结束时间"
),
PROJECT_OA_ID_IS_ERROR
(
"688"
,
"项目在OA中的编号错误"
)
PROJECT_OA_ID_IS_ERROR
(
"688"
,
"项目在OA中的编号错误"
),
WORK_TIME_ORDER_EXIST
(
"689"
,
"工单已提交,请勿重新提交!"
)
;
...
...
wisenergy-service/src/main/java/cn/wisenergy/service/impl/WorkCollectServiceImpl.java
View file @
213c4745
...
...
@@ -19,6 +19,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.dao.DuplicateKeyException
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
...
...
@@ -162,10 +163,12 @@ public class WorkCollectServiceImpl implements WorkCollectService {
if
(
workCollectByUserIdAndWorkDay
!=
null
)
{
workCollectMapper
.
deleteById
(
workCollectByUserIdAndWorkDay
.
getId
());
}
int
insertRow
=
workCollectMapper
.
insertWorkCollect
(
workCollect
);
if
(
insertRow
==
0
)
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
INSERT_DATA_IS_FAIL
);
try
{
workCollectMapper
.
insertWorkCollect
(
workCollect
);
}
catch
(
DuplicateKeyException
e
)
{
throw
new
BaseCustomException
(
BASE_RESP_CODE_ENUM
.
WORK_TIME_ORDER_EXIST
);
}
return
true
;
}
...
...
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