Browse Source

人事资料同步限制资料中心账套

yingp 6 years ago
parent
commit
e4ed6f6e10

+ 4 - 3
uas-office-qywx/src/main/java/com/usoftchina/uas/office/qywx/listener/UasEmployeeListener.java

@@ -3,6 +3,7 @@ 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.UasEmployeeService;
@@ -27,7 +28,7 @@ public class UasEmployeeListener {
      */
     @UasEventListener(caller = "Employeemanager", operation = "AUDIT")
     public void onEmployeeAudit(UasEvent event) {
-        if (!addrBookSdk.enabled()) {
+        if (!addrBookSdk.enabled() || !event.getMaster().equals(DataCenter.INSTANCE.getUsername())) {
             return;
         }
         Employee employee = employeeService.getById(Integer.parseInt(event.getKey().toString()));
@@ -47,7 +48,7 @@ public class UasEmployeeListener {
      */
     @UasEventListener(caller = "Employeemanager", operation = "RESAUDIT")
     public void onEmployeeUnAudit(UasEvent event) {
-        if (!addrBookSdk.enabled()) {
+        if (!addrBookSdk.enabled() || !event.getMaster().equals(DataCenter.INSTANCE.getUsername())) {
             return;
         }
         Employee employee = employeeService.getById(Integer.parseInt(event.getKey().toString()));
@@ -61,7 +62,7 @@ public class UasEmployeeListener {
      */
     @UasEventListener(caller = "Employeemanager", operation = "DELETE")
     public void onEmployeeDelete(UasEvent event) {
-        if (!addrBookSdk.enabled()) {
+        if (!addrBookSdk.enabled() || !event.getMaster().equals(DataCenter.INSTANCE.getUsername())) {
             return;
         }
         Employee employee = employeeService.getRemovedById(Integer.parseInt(event.getKey().toString()));

+ 3 - 2
uas-office-qywx/src/main/java/com/usoftchina/uas/office/qywx/listener/UasOrgListener.java

@@ -4,6 +4,7 @@ import com.usoftchina.qywx.sdk.AddrBookSdk;
 import com.usoftchina.qywx.sdk.dto.GetDepartmentListResp;
 import com.usoftchina.qywx.sdk.dto.GetUserListResp;
 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.entity.HrOrg;
@@ -33,7 +34,7 @@ public class UasOrgListener {
 
     @UasEventListener(caller = "HrOrg", operation = {"DELETE",  "BANNED"})
     public void onOrgDelete(UasEvent event) {
-        if (!addrBookSdk.enabled()) {
+        if (!addrBookSdk.enabled() || !event.getMaster().equals(DataCenter.INSTANCE.getUsername())) {
             return;
         }
         HrOrg org = null;
@@ -52,7 +53,7 @@ public class UasOrgListener {
 
     @UasEventListener(caller = "HrOrg", operation = {"SAVE", "UPDATE", "RESBANNED"})
     public void onOrgSave(UasEvent event) {
-        if (!addrBookSdk.enabled()) {
+        if (!addrBookSdk.enabled() || !event.getMaster().equals(DataCenter.INSTANCE.getUsername())) {
             return;
         }
         HrOrg org = orgService.getById(Integer.parseInt(event.getKey().toString()));