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
99e0c29e
Commit
99e0c29e
authored
Mar 17, 2022
by
xugaojun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增部门同时同步欢迎语
parent
7ebf418a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
1 deletions
+50
-1
DepartmentServiceImpl.java
...an/manage/service/service/impl/DepartmentServiceImpl.java
+50
-1
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/DepartmentServiceImpl.java
View file @
99e0c29e
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.util.UniqueIdUtils
;
import
com.gic.haoban.base.api.common.Constant
;
import
com.gic.haoban.common.utils.StringUtil
;
import
com.gic.haoban.manage.api.dto.DepartmentDTO
;
import
com.gic.haoban.manage.api.dto.DepartmentShortDTO
;
import
com.gic.haoban.manage.api.enums.WelcomeSuitTypeEnum
;
import
com.gic.haoban.manage.service.dao.mapper.DepartmentMapper
;
import
com.gic.haoban.manage.service.dao.mapper.TabHaobanWelcomeSuitRangMapper
;
import
com.gic.haoban.manage.service.entity.TabHaobanDepartment
;
import
com.gic.haoban.manage.service.entity.TabHaobanWelcomeSuitRang
;
import
com.gic.haoban.manage.service.service.DepartmentService
;
import
com.gic.haoban.manage.service.task.QywxDeptSyncOperation
;
import
com.github.pagehelper.Page
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -19,9 +27,11 @@ import java.util.List;
@Service
public
class
DepartmentServiceImpl
implements
DepartmentService
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
DepartmentServiceImpl
.
class
);
@Autowired
private
DepartmentMapper
mapper
;
@Autowired
private
TabHaobanWelcomeSuitRangMapper
welcomeSuitRangMapper
;
@Override
public
List
<
TabHaobanDepartment
>
listByParentId
(
String
parentId
)
{
...
...
@@ -69,10 +79,49 @@ public class DepartmentServiceImpl implements DepartmentService {
}
mapper
.
insert
(
tab
);
syncWelcomeSuitDepartment
(
tab
.
getParentDepartmentId
(),
tab
.
getDepartmentId
(),
tab
.
getDepartmentName
(),
tab
.
getWxEnterpriseId
());
return
tab
.
getDepartmentId
();
}
private
void
syncWelcomeSuitDepartment
(
String
parentDepartmentId
,
String
currentDepartmentId
,
String
currentDepartmentName
,
String
wxEnterpriseId
)
{
logger
.
info
(
"同步欢迎语适用部门, parentDepartmentId:{}, currentDepartmentId:{}, wxEnterpriseId:{}"
,
parentDepartmentId
,
currentDepartmentId
,
wxEnterpriseId
);
// 列举父部门被关联的欢迎语
TabHaobanWelcomeSuitRang
query
=
new
TabHaobanWelcomeSuitRang
();
query
.
setWxEnterpriseId
(
wxEnterpriseId
);
query
.
setSuitDepartmentId
(
parentDepartmentId
);
query
.
setDeleteFlag
(
0
);
List
<
TabHaobanWelcomeSuitRang
>
welcomeSuitRangList
=
welcomeSuitRangMapper
.
queryAll
(
query
);
if
(
CollectionUtils
.
isEmpty
(
welcomeSuitRangList
))
{
logger
.
info
(
"父部门查询为空"
);
return
;
}
logger
.
info
(
"父部门匹配到的欢迎语适用部门, welcomeSuitRangList:{}"
,
JSON
.
toJSONString
(
welcomeSuitRangList
));
// 为每一个父部门匹配到的欢迎语, 添加当前部门适用范围
welcomeSuitRangList
.
forEach
(
one
->
{
TabHaobanWelcomeSuitRang
entity
=
new
TabHaobanWelcomeSuitRang
();
entity
.
setWelcomeSuitRangId
(
UniqueIdUtils
.
uniqueLong
());
entity
.
setWxEnterpriseId
(
wxEnterpriseId
);
entity
.
setWelcomeId
(
one
.
getWelcomeId
());
entity
.
setSuitType
(
WelcomeSuitTypeEnum
.
DEPARTMENT
.
getCode
());
entity
.
setSuitDepartmentId
(
currentDepartmentId
);
entity
.
setSuitDepartmentName
(
currentDepartmentName
);
entity
.
setSuitStaffId
(
"-1"
);
entity
.
setSuitStaffName
(
"-1"
);
entity
.
setStaffBelongDepartmentId
(
"-1"
);
entity
.
setStaffBelongDepartmentName
(
"-1"
);
entity
.
setSelectType
(
1
);
entity
.
setCreateTime
(
new
Date
());
entity
.
setUpdateTime
(
new
Date
());
entity
.
setDeleteFlag
(
0
);
welcomeSuitRangMapper
.
insert
(
entity
);
});
}
@Override
public
void
edit
(
DepartmentDTO
department
)
{
Date
now
=
new
Date
();
...
...
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