|
|
@@ -1,10 +1,12 @@
|
|
|
package com.usoftchina.uas.office.qywx.listener;
|
|
|
|
|
|
import com.usoftchina.qywx.sdk.AddrBookSdk;
|
|
|
+import com.usoftchina.qywx.sdk.dto.UpdateUserReq;
|
|
|
import com.usoftchina.uas.office.dto.UasEvent;
|
|
|
import com.usoftchina.uas.office.entity.DataCenter;
|
|
|
import com.usoftchina.uas.office.listener.UasEventListener;
|
|
|
import com.usoftchina.uas.office.qywx.entity.Employee;
|
|
|
+import com.usoftchina.uas.office.qywx.service.UasConfigService;
|
|
|
import com.usoftchina.uas.office.qywx.service.UasEmpTurnoverService;
|
|
|
import com.usoftchina.uas.office.qywx.service.UasEmployeeService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -25,6 +27,9 @@ public class UasEmpTurnoverListener {
|
|
|
@Autowired
|
|
|
private UasEmployeeService employeeService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private UasConfigService configService;
|
|
|
+
|
|
|
/**
|
|
|
* uas人员离职,删除企业微信通讯录人员
|
|
|
*/
|
|
|
@@ -37,7 +42,11 @@ public class UasEmpTurnoverListener {
|
|
|
if (null != emCode) {
|
|
|
Employee employee = employeeService.getByCode(emCode);
|
|
|
if (null != employee && null != employee.getEm_qywx() && !addrBookSdk.isReadonly()) {
|
|
|
- addrBookSdk.deleteUser(employee.getEm_qywx());
|
|
|
+ if (configService.isTrueConfig("DisableQywx","Turnover")) {
|
|
|
+ addrBookSdk.updateUser(new UpdateUserReq().userId(employee.getEm_qywx()).enable(false));
|
|
|
+ } else {
|
|
|
+ addrBookSdk.deleteUser(employee.getEm_qywx());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|