|
@@ -11,6 +11,7 @@ import org.fouram.core.base.service.BaseService;
|
|
|
import org.fouram.core.base.service.RequestService;
|
|
|
import org.fouram.core.plugin.weixin.cp.util.WXCpUserUtil;
|
|
|
import org.fouram.core.util.Base64Util;
|
|
|
+import org.fouram.core.util.JSONUtil;
|
|
|
import org.fouram.core.util.JsonNodeUtil;
|
|
|
import org.fouram.core.util.Tools;
|
|
|
import org.fouram.entity.SapOrg;
|
|
@@ -32,6 +33,8 @@ public class SapUserService extends BaseService {
|
|
|
@Autowired
|
|
|
private SapEmpJobService sapEmpJobService;
|
|
|
@Autowired
|
|
|
+ private SapOprLogService sapOprLogService;
|
|
|
+ @Autowired
|
|
|
private SapPersonalService sapPersonalService;
|
|
|
|
|
|
private static boolean isTestWXSync = true;
|
|
@@ -193,8 +196,8 @@ public class SapUserService extends BaseService {
|
|
|
SapOrg sapOrg = sapOrgService.selectById(departId);
|
|
|
if (StringUtils.isBlank(departId) || WebConstants.TOP_DEPART.toString().equals(departId)) {
|
|
|
departId = WebConstants.TOP_DEPART.toString();
|
|
|
- sapOrg = SapOrg.builder().id(WebConstants.TOP_DEPART.toString()).sapName(WebConstants.TOP_DEPART_NAME).level("1")
|
|
|
- .build();
|
|
|
+ sapOrg = SapOrg.builder().id(WebConstants.TOP_DEPART.toString()).sapName(WebConstants.TOP_DEPART_NAME)
|
|
|
+ .level("1").build();
|
|
|
}
|
|
|
PageData pd = new PageData();
|
|
|
pd.put("departId", departId);
|
|
@@ -243,9 +246,19 @@ public class SapUserService extends BaseService {
|
|
|
public void updateAvatar(SapUser sapUser) throws Exception {
|
|
|
update("SapUserMapper.updateAvatar", sapUser);
|
|
|
}
|
|
|
+
|
|
|
+ public void deleteByUserId(String userId) throws Exception {
|
|
|
+ update("SapUserMapper.deleteByUserId", userId);
|
|
|
+ }
|
|
|
|
|
|
public void deleteQuitUserByUserId(String userId, String oprUserId) throws Exception {
|
|
|
-// SapUser sapUser = selectByUserId(userId);
|
|
|
-// WXCpUserUtil.delete(sapUser.getPersonId());
|
|
|
+ SapUser sapUser = selectByUserId(userId);
|
|
|
+ String personId = sapUser.getPersonId();
|
|
|
+ List<SapUser> sapUsers = selectListByPersonId(personId);
|
|
|
+ for(SapUser user : sapUsers) {
|
|
|
+ deleteByUserId(user.getUserId());
|
|
|
+ }
|
|
|
+ WXCpUserUtil.delete(personId);
|
|
|
+ sapOprLogService.saveOne(JSONUtil.toString(sapUsers), WebConstants.OPRTYPE_DELETE, oprUserId);
|
|
|
}
|
|
|
}
|