Commit b2d22054 by 徐高华

自建-通讯录

parent 46fcfda0
......@@ -535,7 +535,7 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ
unlockTask(wxEnterpriseId);
return "没有配置secret";
}
List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = qywxDepartmentApiService.listSelfDepartment(qwDTO.getDkCorpid(), secretSetting.getSecretVal(), 1);
List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = qywxDepartmentApiService.listSelfDepartment(qwDTO.getDkCorpid(), secretSetting.getSecretVal(), 1,qwDTO.getUrlHost());
if (CollectionUtils.isEmpty(list)) {
logger.info("没有数据同步");
syncTaskService.updateTaskStatus(taskId, SyncTaskStatusEnum.exception_close.getVal());
......
......@@ -13,6 +13,7 @@ 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.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService;
......@@ -207,7 +208,8 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
if (RedisUtil.getCache(key) == null) {
RedisUtil.setCache(key, 1, 60 * 60L);
String taskId = StringUtil.randomUUID();
List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = this.qywxDepartmentApiService.listSelfDepartment(corpid, contactSecret, null);
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = this.qywxDepartmentApiService.listSelfDepartment(corpid, contactSecret, null , qwDTO.getUrlHost());
logger.info("企业所有部门数据:{}", JSON.toJSONString(list));
if (CollectionUtils.isNotEmpty(list)) {
this.addAllDepartment(list, 0, wxEnterpriseId, corpid, contactSecret, taskId);
......@@ -225,7 +227,8 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
String corpid = json.getString("corpid");
String contactSecret = json.getString("contactSecret");
String taskId = json.getString("taskId");
List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = this.qywxDepartmentApiService.listSelfDepartment(corpid, contactSecret, parentId);
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = this.qywxDepartmentApiService.listSelfDepartment(corpid, contactSecret, parentId,qwDTO.getUrlHost());
List<com.gic.wechat.api.dto.qywx.DepartmentDTO> handerList = new ArrayList<>();
if (parentId.equals(0)) {
for (com.gic.wechat.api.dto.qywx.DepartmentDTO departmentDTO : list) {
......
......@@ -196,12 +196,12 @@ public class MessageApiServiceImpl implements MessageApiService {
* @param enterpriseId
* @param secret
*/
private void dealClerkUser(QywxCallBackDTO dto, String enterpriseId, String secret, String staffName) {
private void dealClerkUser(QywxCallBackDTO dto, String enterpriseId, String secret, String staffName , WxEnterpriseQwDTO qwDTO) {
ClerkQwDTO clerkQwDTO = new ClerkQwDTO();
clerkQwDTO.setEnterpriseId(enterpriseId);
String mainDeptId = dto.getMainDepartment();
List<com.gic.wechat.api.dto.qywx.DepartmentDTO> departments = qywxDepartmentApiService
.listSelfDepartment(dto.getAuthCorpId(), secret, Integer.valueOf(mainDeptId));
.listSelfDepartment(dto.getAuthCorpId(), secret, Integer.valueOf(mainDeptId),qwDTO.getUrlHost());
if (CollectionUtils.isEmpty(departments)) {
log.info("通过主部门查询部门列表为空 mainDeptId:{}", mainDeptId);
return;
......@@ -243,7 +243,7 @@ public class MessageApiServiceImpl implements MessageApiService {
}
String wxEnterpriseId = wxEnterprise.getWxEnterpriseId();
String changeType = qywxCallBackDTO.getChangeType();
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
if (changeType.equals(WxEditType.ADD_USER.getCode())) {
log.info("成员同步新增,userid:{}", userid);
// 新增
......@@ -253,7 +253,7 @@ public class MessageApiServiceImpl implements MessageApiService {
if (suitWxEnterpriseIid) {
String staffName = Convert.toStr(serviceResponse.getResult());
// 鸿星尔克定制
dealErKe(qywxCallBackDTO, wxEnterpriseId, staffName);
dealErKe(qywxCallBackDTO, wxEnterpriseId, staffName,qwDTO);
}
} else if (changeType.equals(WxEditType.UPDATE_USER.getCode())) {
log.info("成员同步修改,userid:{}", userid);
......@@ -261,7 +261,6 @@ public class MessageApiServiceImpl implements MessageApiService {
TabHaobanStaff oldStaff = this.staffService.selectByUserIdAndEnterpriseId(userid, wxEnterpriseId);
if (oldStaff == null) {
//员工可能修改userId,需要拿到openUserId再去查询一次
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
if (qwDTO != null && (qwDTO.getWxSecurityType() == 1 || qwDTO.getWxSecurityType() == 3)){
String openUserid = getOpenUserid(userid, qwDTO);
if (StringUtils.isNotBlank(openUserid)){
......@@ -336,7 +335,6 @@ public class MessageApiServiceImpl implements MessageApiService {
log.info("没有配置secret,wxEnterpriseId:{}", wxEnterpriseId);
return;
}
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
UserDTO user = qywxUserApiService.getSelfWorkWxUser(corpId, secretSetting.getSecretVal(), userid ,qwDTO.getUrlHost());
if (null != user) {
Integer status = user.getStatus();
......@@ -404,6 +402,7 @@ public class MessageApiServiceImpl implements MessageApiService {
return;
}
String wxEnterpriseId = wxApplication.getWxEnterpriseId();
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(wxEnterpriseId,
SecretTypeEnum.CUSTOMIZED_APP.getVal());
if (null == secretSetting || secretSetting.getCheckFlag() == 0) {
......@@ -427,7 +426,7 @@ public class MessageApiServiceImpl implements MessageApiService {
return;
}
com.gic.wechat.api.dto.qywx.DepartmentDTO deptDetail = qywxDepartmentApiService
.getSelfDepartmentById(authCorpId, secret, wxDeptId);
.getSelfDepartmentById(authCorpId, secret, wxDeptId , qwDTO.getUrlHost());
departmentDTO.setDepartmentName(deptDetail.getName());
departmentDTO.setParentDepartmentId(parentDepartment.getDepartmentId());
departmentDTO.setChainId(
......@@ -439,7 +438,7 @@ public class MessageApiServiceImpl implements MessageApiService {
departmentDTO.setWxDepartmentId(wxDeptId + "");
if (qywxCallBackDTO.getParentId() != null) {
List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = this.qywxDepartmentApiService
.listSelfDepartment(authCorpId, secret, qywxCallBackDTO.getParentId());
.listSelfDepartment(authCorpId, secret, qywxCallBackDTO.getParentId(),qwDTO.getUrlHost());
if (CollectionUtils.isNotEmpty(list)) {
for (com.gic.wechat.api.dto.qywx.DepartmentDTO wxDepartmentDTO : list) {
if (Convert.toStr(wxDepartmentDTO.getId()).equals(departmentDTO.getDepartmentId())) {
......@@ -490,7 +489,7 @@ public class MessageApiServiceImpl implements MessageApiService {
* @param qywxCallBackDTO
* @param wxEnterpriseId
*/
private void dealErKe(QywxCallBackDTO qywxCallBackDTO, String wxEnterpriseId, String staffName) {
private void dealErKe(QywxCallBackDTO qywxCallBackDTO, String wxEnterpriseId, String staffName , WxEnterpriseQwDTO qwDTO) {
log.info("成员同步定制化开始");
// 处理定制-目前鸿星尔克用
boolean checkErkeDeal = checkErkeDeal(qywxCallBackDTO);
......@@ -509,7 +508,7 @@ public class MessageApiServiceImpl implements MessageApiService {
log.info("没有配置secret:{}", wxEnterpriseId);
return;
}
dealClerkUser(qywxCallBackDTO, relatedList.get(0).getEnterpriseId(), secretSetting.getSecretVal(), staffName);
dealClerkUser(qywxCallBackDTO, relatedList.get(0).getEnterpriseId(), secretSetting.getSecretVal(), staffName,qwDTO);
log.info("成员同步定制化结束");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment