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
2ce6c5d4
Commit
2ce6c5d4
authored
Apr 15, 2020
by
fudahua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
同步通讯录 删除操作到 暂存部门
parent
8c15754f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
70 deletions
+46
-70
DepartmentServiceImpl.java
...an/manage/service/service/impl/DepartmentServiceImpl.java
+1
-0
StaffApiServiceImpl.java
.../manage/service/service/out/impl/StaffApiServiceImpl.java
+45
-70
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/DepartmentServiceImpl.java
View file @
2ce6c5d4
...
...
@@ -54,6 +54,7 @@ public class DepartmentServiceImpl implements DepartmentService {
}
tab
.
setChainId
(
pDepartment
.
getChainId
()
+
Constant
.
ID_SEPARATOR
+
tab
.
getDepartmentId
());
tab
.
setChainName
(
pDepartment
.
getChainName
()
+
Constant
.
NAME_SEPARATOR
+
tab
.
getDepartmentName
());
tab
.
setLevel
(
pDepartment
.
getLevel
()
+
1
);
}
Integer
isStore
=
department
.
getIsStore
();
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/StaffApiServiceImpl.java
View file @
2ce6c5d4
...
...
@@ -11,7 +11,10 @@ import java.util.Set;
import
java.util.stream.Collectors
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.commons.util.ToolUtil
;
import
com.gic.haoban.base.api.common.Constant
;
import
com.gic.haoban.manage.api.dto.*
;
import
com.gic.haoban.manage.api.service.DepartmentApiService
;
import
com.gic.haoban.manage.service.util.EmojiFilterUtil
;
import
com.vdurmont.emoji.EmojiParser
;
import
org.apache.commons.collections.CollectionUtils
;
...
...
@@ -77,6 +80,10 @@ public class StaffApiServiceImpl implements StaffApiService {
private
WxEnterpriseService
wxEnterpriseService
;
@Autowired
private
DepartmentService
departmentService
;
@Autowired
private
DepartmentApiService
departmentApiService
;
@Autowired
private
ClerkService
clerkService
;
@Autowired
...
...
@@ -226,8 +233,10 @@ public class StaffApiServiceImpl implements StaffApiService {
TabHaobanStaff
staff
=
staffService
.
selectById
(
relatedList
.
get
(
0
).
getStaffId
());
WxEnterpriseDTO
enterpriseDTO
=
wxEnterpriseService
.
selectById
(
staff
.
getWxEnterpriseId
());
if
(
enterpriseDTO
!=
null
)
{
JSONResponse
jp
=
qywxUserApiService
.
deleteSelfWorkWxUser
(
enterpriseDTO
.
getCorpid
(),
enterpriseDTO
.
getContactSecret
(),
staff
.
getWxUserId
());
logger
.
info
(
"【删除成员】jp={}"
,
JSON
.
toJSONString
(
jp
));
ServiceResponse
delQywxStaff
=
delQywxStaff
(
staff
,
enterpriseDTO
);
// JSONResponse jp = qywxUserApiService.deleteSelfWorkWxUser(enterpriseDTO.getCorpid(), enterpriseDTO.getContactSecret(), staff.getWxUserId());
logger
.
info
(
"【删除成员】{} ,jp={}"
,
staffDepartmentStaffRelatedId
,
JSON
.
toJSONString
(
delQywxStaff
));
throw
new
RuntimeException
(
"企业微信删除失败"
);
}
staffDepartmentRelatedService
.
del
(
related
);
staffService
.
delByuserid
(
relatedList
.
get
(
0
).
getStaffId
());
...
...
@@ -495,7 +504,9 @@ public class StaffApiServiceImpl implements StaffApiService {
userDTO
.
setPosition
(
staffDTO
.
getPostion
());
userDTO
.
setExternal_position
(
staffDTO
.
getExtendPostion
());
JSONResponse
jp
=
qywxUserApiService
.
updateSelfWorkWxUser
(
userDTO
,
enterpriseDTO
.
getCorpid
(),
enterpriseDTO
.
getContactSecret
());
if
(
jp
.
getErrorCode
()
!=
0
)
{
throw
new
RuntimeException
(
"微信新增失败"
);
}
}
}
}
...
...
@@ -966,79 +977,43 @@ public class StaffApiServiceImpl implements StaffApiService {
}
/**
*
新增staff
*
删除企业微信
*
* @param staff
* @param departmentIds
* @return
*/
private
ServiceResponse
addStaff
(
StaffDTO
staff
,
String
departmentIds
)
{
ServiceResponse
hr
=
new
ServiceResponse
();
hr
.
setCode
(
1
);
Integer
activeFlag
=
staff
.
getActiveFlag
();
staff
.
setActiveFlag
(
0
);
Integer
syncPostionFlag
=
staff
.
getSyncPostionFlag
();
if
(
syncPostionFlag
!=
null
&&
syncPostionFlag
==
1
)
{
staff
.
setExtendPostion
(
staff
.
getPostion
());
private
ServiceResponse
delQywxStaff
(
TabHaobanStaff
staff
,
WxEnterpriseDTO
enterpriseDTO
)
{
ServiceResponse
ret
=
new
ServiceResponse
();
DepartmentDTO
tempFlagDepartment
=
departmentService
.
getTempFlagDepartment
(
enterpriseDTO
.
getWxEnterpriseId
());
if
(
null
==
tempFlagDepartment
)
{
DepartmentDTO
parentDepert
=
departmentService
.
getRootByEnterpriseId
(
enterpriseDTO
.
getWxEnterpriseId
());
tempFlagDepartment
=
new
DepartmentDTO
();
tempFlagDepartment
.
setTempFlag
(
1
);
tempFlagDepartment
.
setDepartmentName
(
"暂存部门"
);
tempFlagDepartment
.
setWxEnterpriseId
(
enterpriseDTO
.
getWxEnterpriseId
());
tempFlagDepartment
.
setHasSonNode
(
false
);
tempFlagDepartment
.
setIsStore
(
0
);
tempFlagDepartment
.
setParentDepartmentId
(
parentDepert
.
getDepartmentId
());
ServiceResponse
<
DepartmentDTO
>
response
=
departmentApiService
.
add
(
tempFlagDepartment
);
if
(
response
.
getCode
()
!=
1
)
{
ret
.
setCode
(
0
);
ret
.
setMessage
(
"暂存部门创建失败"
);
return
ret
;
}
tempFlagDepartment
=
response
.
getResult
();
}
TabHaobanStaff
tab
=
EntityUtil
.
changeEntityByJSON
(
TabHaobanStaff
.
class
,
staff
);
String
staffId
=
StringUtil
.
randomUUID
();
tab
.
setStaffId
(
staffId
);
//调接口获取
String
wxUserId
=
""
;
WxEnterpriseDTO
enterpriseDTO
=
wxEnterpriseService
.
selectById
(
staff
.
getWxEnterpriseId
());
if
(
enterpriseDTO
!=
null
)
{
UserDTO
userDTO
=
new
UserDTO
();
userDTO
.
setCorpid
(
enterpriseDTO
.
getCorpid
());
String
[]
departmentIdArr
=
departmentIds
.
split
(
","
);
Integer
[]
wxDepartmentIdArrIntegers
=
new
Integer
[
departmentIdArr
.
length
];
int
index
=
0
;
for
(
String
string
:
departmentIdArr
)
{
TabHaobanDepartment
tabs
=
departmentService
.
selectById
(
string
);
wxDepartmentIdArrIntegers
[
index
]
=
Integer
.
parseInt
(
tabs
.
getWxDepartmentId
());
index
++;
}
userDTO
.
setDepartment
(
wxDepartmentIdArrIntegers
);
userDTO
.
setGender
(
staff
.
getSex
()
==
null
?
null
:
staff
.
getSex
().
toString
());
userDTO
.
setMobile
(
staff
.
getPhoneNumber
());
userDTO
.
setName
(
staff
.
getStaffName
());
userDTO
.
setUserid
(
staffId
);
userDTO
.
setAlias
(
staff
.
getNickName
());
userDTO
.
setExternal_position
(
tab
.
getExtendPostion
());
userDTO
.
setPosition
(
tab
.
getPostion
());
if
(
activeFlag
==
1
)
{
userDTO
.
setTo_invite
(
true
);
}
logger
.
info
(
"【店员新增】userDTO = {}"
,
JSON
.
toJSONString
(
userDTO
));
JSONResponse
jp
=
qywxUserApiService
.
createSelfWorkWxUser
(
userDTO
,
enterpriseDTO
.
getCorpid
(),
enterpriseDTO
.
getContactSecret
());
logger
.
info
(
"【店员新增】jp = {}"
,
JSON
.
toJSONString
(
jp
));
if
(
jp
.
getErrorCode
()
!=
0
)
{
hr
.
setCode
(
0
);
hr
.
setMessage
(
"微信新增失败"
);
return
hr
;
}
staffService
.
add
(
tab
);
wxUserId
=
staffId
;
}
if
(
StringUtils
.
isNotBlank
(
wxUserId
))
{
String
[]
departmentIdArr
=
departmentIds
.
split
(
","
);
for
(
String
string
:
departmentIdArr
)
{
StaffDepartmentRelatedDTO
related
=
new
StaffDepartmentRelatedDTO
();
related
.
setDepartmentId
(
string
);
related
.
setNationCode
(
staff
.
getNationCode
());
related
.
setPhoneNumber
(
staff
.
getPhoneNumber
());
related
.
setStaffId
(
staffId
);
related
.
setWxUserId
(
wxUserId
);
related
.
setStaffName
(
staff
.
getStaffName
());
related
.
setWxEnterpriseId
(
staff
.
getWxEnterpriseId
());
staffDepartmentRelatedService
.
add
(
related
);
}
}
else
{
hr
.
setCode
(
0
);
hr
.
setMessage
(
"微信端新增失败"
);
try
{
staffEdit
(
EntityUtil
.
changeEntityByJSON
(
StaffDTO
.
class
,
staff
),
tempFlagDepartment
.
getDepartmentId
());
}
catch
(
RuntimeException
ex
)
{
ret
.
setCode
(
0
);
ret
.
setMessage
(
ex
.
getMessage
());
}
catch
(
Exception
e
)
{
ret
.
setCode
(
0
);
ret
.
setMessage
(
"新增异常"
);
}
finally
{
return
ret
;
}
hr
.
setResult
(
staffId
);
return
hr
;
}
// private String getMobile(String phoneNumber,String nationcode){
...
...
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