|
@@ -2,8 +2,10 @@ package com.usoftchina.uas.office.qywx.manage.controller;
|
|
|
|
|
|
|
|
import com.usoftchina.qywx.sdk.AddrBookSdk;
|
|
import com.usoftchina.qywx.sdk.AddrBookSdk;
|
|
|
import com.usoftchina.uas.office.dto.Result;
|
|
import com.usoftchina.uas.office.dto.Result;
|
|
|
|
|
+import com.usoftchina.uas.office.dto.UasEvent;
|
|
|
import com.usoftchina.uas.office.entity.DataCenter;
|
|
import com.usoftchina.uas.office.entity.DataCenter;
|
|
|
import com.usoftchina.uas.office.jdbc.DataSourceHolder;
|
|
import com.usoftchina.uas.office.jdbc.DataSourceHolder;
|
|
|
|
|
+import com.usoftchina.uas.office.listener.UasEventListenerFactory;
|
|
|
import com.usoftchina.uas.office.qywx.service.UasEmployeeService;
|
|
import com.usoftchina.uas.office.qywx.service.UasEmployeeService;
|
|
|
import com.usoftchina.uas.office.qywx.service.UasOrgService;
|
|
import com.usoftchina.uas.office.qywx.service.UasOrgService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -29,6 +31,9 @@ public class QywxAddrBookController {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private AddrBookSdk addrBookSdk;
|
|
private AddrBookSdk addrBookSdk;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private UasEventListenerFactory eventListenerFactory;
|
|
|
|
|
+
|
|
|
@PostMapping(path = "/addrbook/sync")
|
|
@PostMapping(path = "/addrbook/sync")
|
|
|
public Result syncAll() {
|
|
public Result syncAll() {
|
|
|
DataCenter dataCenter = DataCenter.INSTANCE;
|
|
DataCenter dataCenter = DataCenter.INSTANCE;
|
|
@@ -58,4 +63,32 @@ public class QywxAddrBookController {
|
|
|
public Result getDepartmentList() {
|
|
public Result getDepartmentList() {
|
|
|
return Result.success(addrBookSdk.getDepartmentList());
|
|
return Result.success(addrBookSdk.getDepartmentList());
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 同步单个用户
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param id
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(path = "/addrbook/user/sync")
|
|
|
|
|
+ public Result syncUser(Integer id) {
|
|
|
|
|
+ UasEvent event = new UasEvent("AUDIT", "Employeemanager", id,
|
|
|
|
|
+ DataCenter.INSTANCE.getUsername());
|
|
|
|
|
+ eventListenerFactory.invokeListeners(event);
|
|
|
|
|
+ return Result.success();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 同步单个组织
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param id
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @RequestMapping(path = "/addrbook/org/sync")
|
|
|
|
|
+ public Result syncOrg(Integer id) {
|
|
|
|
|
+ UasEvent event = new UasEvent("UPDATE", "HrOrg", id,
|
|
|
|
|
+ DataCenter.INSTANCE.getUsername());
|
|
|
|
|
+ eventListenerFactory.invokeListeners(event);
|
|
|
|
|
+ return Result.success();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|