Commit fb6773f3 by 墨竹

fix:成员删除回调,判断成员在企微是否存在,并且已激活

parent 604912e8
...@@ -14,7 +14,10 @@ import com.gic.haoban.manage.api.enums.AppPageType; ...@@ -14,7 +14,10 @@ import com.gic.haoban.manage.api.enums.AppPageType;
import com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum; import com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum;
import com.gic.haoban.manage.api.enums.SecretTypeEnum; import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.api.enums.WxEditType; import com.gic.haoban.manage.api.enums.WxEditType;
import com.gic.haoban.manage.api.service.*; import com.gic.haoban.manage.api.service.MessageApiService;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService;
import com.gic.haoban.manage.api.util.notify.NoticeMessageUtil; import com.gic.haoban.manage.api.util.notify.NoticeMessageUtil;
import com.gic.haoban.manage.service.config.Config; import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.entity.*; import com.gic.haoban.manage.service.entity.*;
...@@ -25,8 +28,10 @@ import com.gic.thirdparty.api.dto.PicUploadResDTO; ...@@ -25,8 +28,10 @@ import com.gic.thirdparty.api.dto.PicUploadResDTO;
import com.gic.thirdparty.api.service.QQCloudPicService; import com.gic.thirdparty.api.service.QQCloudPicService;
import com.gic.wechat.api.dto.qywx.ItemDTO; import com.gic.wechat.api.dto.qywx.ItemDTO;
import com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO; import com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO;
import com.gic.wechat.api.dto.qywx.UserDTO;
import com.gic.wechat.api.service.qywx.QywxDepartmentApiService; import com.gic.wechat.api.service.qywx.QywxDepartmentApiService;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService; import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -58,8 +63,6 @@ public class MessageApiServiceImpl implements MessageApiService { ...@@ -58,8 +63,6 @@ public class MessageApiServiceImpl implements MessageApiService {
@Autowired @Autowired
private DepartmentService departmentService; private DepartmentService departmentService;
@Autowired @Autowired
private WxEnterpriseService enterpriseService;
@Autowired
private StaffService staffService; private StaffService staffService;
@Autowired @Autowired
private StaffDepartmentRelatedService staffDepartmentRelatedService; private StaffDepartmentRelatedService staffDepartmentRelatedService;
...@@ -93,9 +96,9 @@ public class MessageApiServiceImpl implements MessageApiService { ...@@ -93,9 +96,9 @@ public class MessageApiServiceImpl implements MessageApiService {
@Autowired @Autowired
private SecretSettingService secretSettingService; private SecretSettingService secretSettingService;
@Autowired @Autowired
private WxApplicationApiService wxApplicationApiService;
@Autowired
private WxApplicationService wxApplicationService; private WxApplicationService wxApplicationService;
@Autowired
private QywxUserApiService qywxUserApiService;
@Override @Override
public void gicMessageReceive(GicMessageDTO gicMessageDTO) { public void gicMessageReceive(GicMessageDTO gicMessageDTO) {
...@@ -218,9 +221,10 @@ public class MessageApiServiceImpl implements MessageApiService { ...@@ -218,9 +221,10 @@ public class MessageApiServiceImpl implements MessageApiService {
log.info("成员为空"); log.info("成员为空");
return; return;
} }
TabHaobanWxApplication wxApplication = wxApplicationService.selectByCorpId(qywxCallBackDTO.getAuthCorpId()); String corpId = qywxCallBackDTO.getAuthCorpId();
TabHaobanWxApplication wxApplication = wxApplicationService.selectByCorpId(corpId);
if (Objects.isNull(wxApplication)) { if (Objects.isNull(wxApplication)) {
log.info("授权企业不存在,{}", qywxCallBackDTO.getAuthCorpId()); log.info("授权企业不存在,{}", corpId);
return; return;
} }
String wxEnterpriseId = wxApplication.getWxEnterpriseId(); String wxEnterpriseId = wxApplication.getWxEnterpriseId();
...@@ -286,6 +290,22 @@ public class MessageApiServiceImpl implements MessageApiService { ...@@ -286,6 +290,22 @@ public class MessageApiServiceImpl implements MessageApiService {
staffApiService.staffEdit(staffDTO, departmentIds.toString()); staffApiService.staffEdit(staffDTO, departmentIds.toString());
} else if (changeType.equals(WxEditType.DELETE_USER.getCode())) { } else if (changeType.equals(WxEditType.DELETE_USER.getCode())) {
log.info("成员同步删除,userid:{}", userid); log.info("成员同步删除,userid:{}", userid);
SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(wxEnterpriseId, SecretTypeEnum.HAOBAN_HELP.getVal());
if (null == secretSetting || secretSetting.getCheckFlag() == 0) {
log.info("没有配置secret,wxEnterpriseId:{}", wxEnterpriseId);
return;
}
UserDTO user = qywxUserApiService.getSelfWorkWxUser(corpId, secretSetting.getSecretVal(), userid);
if (null != user) {
Integer status = user.getStatus();
// 1=已激活,2=已禁用,4=未激活,5=退出企业。
log.info("企业微信用户状态:{}",status);
if (status == 1) {
log.info("企业微信用户存在,并且已激活无需删除:{}:{}", wxEnterpriseId, userid);
return;
}
}
//删除 //删除
TabHaobanStaff oldStaff = this.staffService.selectByUserIdAndEnterpriseId(userid, wxEnterpriseId); TabHaobanStaff oldStaff = this.staffService.selectByUserIdAndEnterpriseId(userid, wxEnterpriseId);
if (oldStaff == null) { if (oldStaff == null) {
......
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