|
|
@@ -1,11 +1,14 @@
|
|
|
package com.usoftchina.uas.office.qywx.manage.controller;
|
|
|
|
|
|
import com.usoftchina.qywx.sdk.AddrBookSdk;
|
|
|
+import com.usoftchina.qywx.sdk.dto.UpdateUserReq;
|
|
|
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.jdbc.DataSourceHolder;
|
|
|
import com.usoftchina.uas.office.listener.UasEventListenerFactory;
|
|
|
+import com.usoftchina.uas.office.qywx.entity.Employee;
|
|
|
+import com.usoftchina.uas.office.qywx.service.UasConfigService;
|
|
|
import com.usoftchina.uas.office.qywx.service.UasEmployeeService;
|
|
|
import com.usoftchina.uas.office.qywx.service.UasOrgService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -34,6 +37,9 @@ public class QywxAddrBookController {
|
|
|
@Autowired
|
|
|
private UasEventListenerFactory eventListenerFactory;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private UasConfigService configService;
|
|
|
+
|
|
|
@PostMapping(path = "/addrbook/sync")
|
|
|
public Result syncAll() {
|
|
|
DataCenter dataCenter = DataCenter.INSTANCE;
|
|
|
@@ -91,4 +97,23 @@ public class QywxAddrBookController {
|
|
|
eventListenerFactory.invokeListeners(event);
|
|
|
return Result.success();
|
|
|
}
|
|
|
+ @RequestMapping(path = "/addrbook/user/delete")
|
|
|
+ public Result disableUser(Integer id) {
|
|
|
+ Employee employee= employeeService.getById(id);
|
|
|
+ if (null != employee && null != employee.getEm_qywx() && !addrBookSdk.isReadonly()) {
|
|
|
+ if (configService.isTrueConfig("DisableQywx","Turnover")) {
|
|
|
+ addrBookSdk.updateUser(new UpdateUserReq().userId(employee.getEm_qywx()).enable(false));
|
|
|
+ } else {
|
|
|
+ addrBookSdk.deleteUser(employee.getEm_qywx());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping(path = "/addrbook/user/update")
|
|
|
+ public Result updateUser(Integer id) {
|
|
|
+ Employee employee= employeeService.getById(id);
|
|
|
+ employeeService.sync(employee);
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
}
|