|
|
@@ -4,6 +4,7 @@ import com.usoftchina.dingtalk.sdk.AddrBookSdk;
|
|
|
import com.usoftchina.uas.office.dingtalk.entity.Employee;
|
|
|
import com.usoftchina.uas.office.dingtalk.service.UasEmployeeService;
|
|
|
import com.usoftchina.uas.office.dto.UasEvent;
|
|
|
+import com.usoftchina.uas.office.entity.DataCenter;
|
|
|
import com.usoftchina.uas.office.listener.UasEventListener;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
@@ -26,6 +27,9 @@ public class UasEmployeeListener {
|
|
|
*/
|
|
|
@UasEventListener(caller = "Employeemanager", operation = "AUDIT")
|
|
|
public void onEmployeeAudit(UasEvent event) {
|
|
|
+ if (!event.getMaster().equals(DataCenter.INSTANCE.getUsername())) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
Employee employee = employeeService.getById(Integer.parseInt(event.getKey().toString()));
|
|
|
if (null != employee) {
|
|
|
if ("离职".equals(employee.getEm_class())) {
|
|
|
@@ -43,6 +47,9 @@ public class UasEmployeeListener {
|
|
|
*/
|
|
|
@UasEventListener(caller = "Employeemanager", operation = "DELETE")
|
|
|
public void onEmployeeDelete(UasEvent event) {
|
|
|
+ if (!event.getMaster().equals(DataCenter.INSTANCE.getUsername())) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
Employee employee = employeeService.getRemovedById(Integer.parseInt(event.getKey().toString()));
|
|
|
if (null != employee && null != employee.getEm_ding()) {
|
|
|
addrBookSdk.deleteUser("Uas", employee.getEm_ding());
|