Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
Overview
Overview
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
haoban3.0
haoban-manage3.0
Commits
8c15754f
Commit
8c15754f
authored
Apr 15, 2020
by
fudahua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
同步通讯录 同步判断
parent
0bcf1597
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
7 deletions
+20
-7
DepartmentServiceImpl.java
...an/manage/service/service/impl/DepartmentServiceImpl.java
+20
-7
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/DepartmentServiceImpl.java
View file @
8c15754f
...
...
@@ -3,7 +3,9 @@ package com.gic.haoban.manage.service.service.impl;
import
java.util.Date
;
import
java.util.List
;
import
com.gic.haoban.base.api.common.Constant
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -38,11 +40,22 @@ public class DepartmentServiceImpl implements DepartmentService {
public
String
add
(
DepartmentDTO
department
)
{
Date
now
=
new
Date
();
TabHaobanDepartment
tab
=
EntityUtil
.
changeEntityByJSON
(
TabHaobanDepartment
.
class
,
department
);
Integer
sort
=
tab
.
getSort
();
if
(
sort
==
null
)
{
int
maxSort
=
mapper
.
selectMaxSort
(
department
.
getParentDepartmentId
());
tab
.
setSort
(
maxSort
+
1
);
}
tab
.
setDepartmentId
(
StringUtil
.
randomUUID
());
Integer
sort
=
tab
.
getSort
();
if
(
sort
==
null
)
{
int
maxSort
=
mapper
.
selectMaxSort
(
department
.
getParentDepartmentId
());
tab
.
setSort
(
maxSort
+
1
);
}
if
(
StringUtils
.
isBlank
(
department
.
getChainId
()))
{
TabHaobanDepartment
pDepartment
=
this
.
selectById
(
department
.
getParentDepartmentId
());
if
(
null
==
pDepartment
)
{
throw
new
RuntimeException
(
"父部门不存在"
);
}
tab
.
setChainId
(
pDepartment
.
getChainId
()
+
Constant
.
ID_SEPARATOR
+
tab
.
getDepartmentId
());
tab
.
setChainName
(
pDepartment
.
getChainName
()
+
Constant
.
NAME_SEPARATOR
+
tab
.
getDepartmentName
());
}
Integer
isStore
=
department
.
getIsStore
();
if
(
isStore
==
null
){
department
.
setIsStore
(
0
);
...
...
@@ -54,8 +67,8 @@ public class DepartmentServiceImpl implements DepartmentService {
if
(
department
.
getTempFlag
()
==
null
)
{
department
.
setTempFlag
(
0
);
}
tab
.
setDepartmentId
(
StringUtil
.
randomUUID
());
mapper
.
insert
(
tab
);
mapper
.
insert
(
tab
);
return
tab
.
getDepartmentId
();
}
...
...
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