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
24449190
Commit
24449190
authored
Apr 14, 2020
by
fudahua
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer' into developer
parents
a27d133e
c0f22f71
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
101 additions
and
9 deletions
+101
-9
DepartmentApiService.java
...m/gic/haoban/manage/api/service/DepartmentApiService.java
+3
-1
StaffApiService.java
...va/com/gic/haoban/manage/api/service/StaffApiService.java
+2
-1
SyncErrorLogService.java
...ic/haoban/manage/service/service/SyncErrorLogService.java
+9
-0
SyncErrorLogServiceImpl.java
.../manage/service/service/impl/SyncErrorLogServiceImpl.java
+25
-0
DepartmentApiServiceImpl.java
...ge/service/service/out/impl/DepartmentApiServiceImpl.java
+15
-2
StaffApiServiceImpl.java
.../manage/service/service/out/impl/StaffApiServiceImpl.java
+17
-2
ApplicationController.java
...c/haoban/manage/web/controller/ApplicationController.java
+30
-3
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/DepartmentApiService.java
View file @
24449190
...
...
@@ -158,7 +158,9 @@ public interface DepartmentApiService {
* @return
*/
ServiceResponse
<
List
<
DepartmentDTO
>>
listStoreListByStaffId
(
String
wxUserId
);
void
initwxDepartmentMQ
(
String
res
);
boolean
isInitLocked
(
String
wxEnterpriseId
);
}
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/StaffApiService.java
View file @
24449190
...
...
@@ -47,7 +47,7 @@ public interface StaffApiService {
StaffDepartmentRelatedDTO
getDepartmentIdAndCode
(
String
departmentId
,
String
code
);
void
initWxUser
(
String
corpid
,
String
contactSecret
,
String
wxEnterpriseId
,
Integer
wxDepartmentId
);
void
initWxUser
(
String
corpid
,
String
contactSecret
,
String
wxEnterpriseId
,
Integer
wxDepartmentId
,
String
taskId
);
public
List
<
String
>
listUnBindClerk
(
String
storeId
);
...
...
@@ -60,4 +60,5 @@ public interface StaffApiService {
public
List
<
StaffDTO
>
listByPhoneNumber
(
String
phoneNumber
);
public
List
<
StaffDTO
>
listByUserIdsAndWxEnterpriseId
(
List
<
String
>
userIds
,
String
wxEnterpriseId
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/SyncErrorLogService.java
0 → 100644
View file @
24449190
package
com
.
gic
.
haoban
.
manage
.
service
.
service
;
import
com.gic.haoban.manage.service.entity.TabHaobanSyncErrorLog
;
public
interface
SyncErrorLogService
{
void
add
(
TabHaobanSyncErrorLog
tab
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/SyncErrorLogServiceImpl.java
0 → 100644
View file @
24449190
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
impl
;
import
java.util.Date
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.gic.haoban.manage.service.dao.mapper.TabHaobanSyncErrorLogMapper
;
import
com.gic.haoban.manage.service.entity.TabHaobanSyncErrorLog
;
import
com.gic.haoban.manage.service.service.SyncErrorLogService
;
@Service
public
class
SyncErrorLogServiceImpl
implements
SyncErrorLogService
{
@Autowired
private
TabHaobanSyncErrorLogMapper
mapper
;
@Override
public
void
add
(
TabHaobanSyncErrorLog
tab
)
{
tab
.
setCreateTime
(
new
Date
());
tab
.
setUpdateTime
(
new
Date
());
mapper
.
insert
(
tab
);
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/DepartmentApiServiceImpl.java
View file @
24449190
...
...
@@ -44,7 +44,9 @@ import com.gic.haoban.manage.service.entity.TabHaobanSyncErrorLog;
import
com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated
;
import
com.gic.haoban.manage.service.service.DepartmentService
;
import
com.gic.haoban.manage.service.service.StaffDepartmentRelatedService
;
import
com.gic.haoban.manage.service.service.SyncErrorLogService
;
import
com.gic.haoban.manage.service.service.WxEnterpriseService
;
import
com.gic.redis.data.util.RedisUtil
;
import
com.gic.wechat.api.service.qywx.QywxDepartmentApiService
;
import
com.github.pagehelper.PageHelper
;
...
...
@@ -73,6 +75,8 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
@Autowired
private
StaffDepartmentRelatedApiService
staffDepartmentRelatedApiService
;
@Autowired
private
SyncErrorLogService
syncErrorLogService
;
@Override
...
...
@@ -499,12 +503,20 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
//
// DepartmentDTO parent = EntityUtil.changeEntityByJSON(DepartmentDTO.class,departmentService.selectById(parentId));
// this.addSon(subList, wxEnterpriseId, parent,corpid,suiteid);
RedisUtil
.
lock
(
"init_enterprise_"
+
wxEnterpriseId
,
60
*
60L
);
String
taskId
=
StringUtil
.
randomUUID
();
List
<
com
.
gic
.
wechat
.
api
.
dto
.
qywx
.
DepartmentDTO
>
list
=
this
.
qywxDepartmentApiService
.
listSelfDepartment
(
corpid
,
contactSecret
,
null
);
logger
.
info
(
"企业所有部门数据:{}"
,
JSON
.
toJSONString
(
list
));
if
(
CollectionUtils
.
isNotEmpty
(
list
)){
this
.
addAllDepartment
(
list
,
0
,
wxEnterpriseId
,
corpid
,
contactSecret
,
taskId
);
}
RedisUtil
.
unlock
(
"init_enterprise_"
+
wxEnterpriseId
);
}
@Override
public
boolean
isInitLocked
(
String
wxEnterpriseId
){
return
RedisUtil
.
isLocked
(
"init_enterprise_"
+
wxEnterpriseId
);
}
...
...
@@ -551,9 +563,10 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
tab
.
setReason
(
e
.
getMessage
());
tab
.
setTaskId
(
taskId
);
tab
.
setWxEnterpriseId
(
wxEnterpriseId
);
syncErrorLogService
.
add
(
tab
);
}
this
.
addAllDepartment
(
list
,
departmentDTO
.
getId
(),
wxEnterpriseId
,
corpid
,
contactSecret
,
taskId
);
this
.
staffApiService
.
initWxUser
(
corpid
,
contactSecret
,
wxEnterpriseId
,
departmentDTO
.
getId
());
this
.
staffApiService
.
initWxUser
(
corpid
,
contactSecret
,
wxEnterpriseId
,
departmentDTO
.
getId
()
,
taskId
);
}
}
...
...
@@ -632,7 +645,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
rer
.
setResult
(
departmentList
);
return
rer
;
}
@Override
public
void
initwxDepartmentMQ
(
String
res
)
{
WxEnterpriseDTO
enterpriseDTO
=
this
.
wxEnterpriseService
.
selectById
(
res
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/StaffApiServiceImpl.java
View file @
24449190
...
...
@@ -47,9 +47,11 @@ import com.gic.haoban.manage.service.dao.mapper.StaffMapper;
import
com.gic.haoban.manage.service.entity.TabHaobanDepartment
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaff
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated
;
import
com.gic.haoban.manage.service.entity.TabHaobanSyncErrorLog
;
import
com.gic.haoban.manage.service.service.DepartmentService
;
import
com.gic.haoban.manage.service.service.StaffDepartmentRelatedService
;
import
com.gic.haoban.manage.service.service.StaffService
;
import
com.gic.haoban.manage.service.service.SyncErrorLogService
;
import
com.gic.haoban.manage.service.service.UserLoginLogService
;
import
com.gic.haoban.manage.service.service.WxEnterpriseService
;
import
com.gic.wechat.api.dto.qywx.UserDTO
;
...
...
@@ -87,6 +89,8 @@ public class StaffApiServiceImpl implements StaffApiService {
private
UserLoginLogService
userLoginLogService
;
@Autowired
private
WxEnterpriseRelatedApiService
wxEnterpriseRelatedApiService
;
@Autowired
private
SyncErrorLogService
syncErrorLogService
;
@Override
public
StaffDTO
selectById
(
String
staffId
)
{
...
...
@@ -772,11 +776,22 @@ public class StaffApiServiceImpl implements StaffApiService {
}
@Override
public
void
initWxUser
(
String
corpid
,
String
contactSecret
,
String
wxEnterpriseId
,
Integer
wxDepartmentId
)
{
public
void
initWxUser
(
String
corpid
,
String
contactSecret
,
String
wxEnterpriseId
,
Integer
wxDepartmentId
,
String
taskId
)
{
List
<
UserDTO
>
list
=
this
.
qywxUserApiService
.
listSelfDepartmentUser
(
corpid
,
contactSecret
,
wxDepartmentId
.
toString
(),
0
);
if
(
CollectionUtils
.
isNotEmpty
(
list
)){
for
(
UserDTO
dto
:
list
){
this
.
wxGetAdd
(
dto
.
getUserid
(),
wxEnterpriseId
);
try
{
this
.
wxGetAdd
(
dto
.
getUserid
(),
wxEnterpriseId
);
}
catch
(
Exception
e
)
{
TabHaobanSyncErrorLog
tab
=
new
TabHaobanSyncErrorLog
();
tab
.
setDataId
(
dto
.
getUserid
());
tab
.
setDataType
(
0
);
tab
.
setLogType
(
0
);
tab
.
setReason
(
e
.
getMessage
());
tab
.
setTaskId
(
taskId
);
tab
.
setWxEnterpriseId
(
wxEnterpriseId
);
syncErrorLogService
.
add
(
tab
);
}
}
}
}
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/ApplicationController.java
View file @
24449190
...
...
@@ -109,9 +109,14 @@ public class ApplicationController extends WebBaseController{
WxEnterpriseDTO
enterpriseDTO
=
this
.
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
if
(
enterpriseDTO
!=
null
){
if
(
StringUtils
.
isNotBlank
(
enterpriseDTO
.
getContactSecret
())
&&
enterpriseDTO
.
getContactFlag
()
!=
null
&&
enterpriseDTO
.
getContactFlag
()
==
0
){
this
.
departmentApiService
.
initwxDepartment
(
enterpriseDTO
.
getCorpid
(),
enterpriseDTO
.
getContactSecret
(),
enterpriseDTO
.
getWxEnterpriseId
());
enterpriseDTO
.
setContactFlag
(
1
);
wxEnterpriseApiService
.
update
(
enterpriseDTO
);
log
.
info
(
"【初始化部门调用】{},{},{}"
,
RouterConstant
.
INIT_WX_DEPARTMENT_SERVICENAME
,
RouterConstant
.
INIT_WX_DEPARTMENT_METHODNAME
,
wxEnterpriseId
);
try
{
GICMQClientUtil
.
getClientInstance
().
sendCommonMessage
(
RouterConstant
.
ROUTERTYPE
,
wxEnterpriseId
,
RouterConstant
.
INIT_WX_DEPARTMENT_SERVICENAME
,
RouterConstant
.
INIT_WX_DEPARTMENT_METHODNAME
);
}
catch
(
Exception
e
)
{
log
.
info
(
e
.
getMessage
(),
e
);
}
}
}
...
...
@@ -180,6 +185,28 @@ public class ApplicationController extends WebBaseController{
e
.
printStackTrace
();
}
}
@RequestMapping
(
"init-wx-department"
)
public
HaobanResponse
initWxDepartment
(){
LoginVO
login
=
(
LoginVO
)
AuthRequestUtil
.
getLoginUser
();
String
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
WxEnterpriseDTO
enterpriseDTO
=
this
.
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
if
(
enterpriseDTO
!=
null
){
if
(
StringUtils
.
isNotBlank
(
enterpriseDTO
.
getContactSecret
())
&&
enterpriseDTO
.
getContactFlag
()
!=
null
&&
enterpriseDTO
.
getContactFlag
()
==
0
){
log
.
info
(
"【初始化部门调用】{},{},{}"
,
RouterConstant
.
INIT_WX_DEPARTMENT_SERVICENAME
,
RouterConstant
.
INIT_WX_DEPARTMENT_METHODNAME
,
wxEnterpriseId
);
try
{
GICMQClientUtil
.
getClientInstance
().
sendCommonMessage
(
RouterConstant
.
ROUTERTYPE
,
wxEnterpriseId
,
RouterConstant
.
INIT_WX_DEPARTMENT_SERVICENAME
,
RouterConstant
.
INIT_WX_DEPARTMENT_METHODNAME
);
}
catch
(
Exception
e
)
{
log
.
info
(
e
.
getMessage
(),
e
);
}
}
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
true
);
}
@RequestMapping
(
"cancal-suite"
)
@IgnoreLogin
...
...
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