提交 af8221d3 authored 作者: 000516's avatar 000516

人员离职时,T100同步禁用此用户

上级 cf9e643c
......@@ -5,9 +5,12 @@ import com.alibaba.fastjson2.JSONObject;
import com.sfa.common.core.utils.sdk.FeiShuUtil;
import com.sfa.job.domain.qince.dao.IQinceEmployeeDao;
import com.sfa.job.domain.system.dao.ISysDeptDao;
import com.sfa.job.domain.system.dao.ISysEventLogDao;
import com.sfa.job.domain.system.dao.ISysUserDao;
import com.sfa.job.domain.system.entity.SysDept;
import com.sfa.job.pojo.response.SysEventLogDto;
import com.sfa.job.util.QinCeUtils;
import com.sfa.job.util.T100Util;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -35,7 +38,11 @@ public class DeptAndUserServiceImpl implements IDeptAndUserService {
@Autowired
private IQinceEmployeeDao qinceEmployeeDao;
@Autowired
private ISysEventLogDao sysEventLogDao;
@Autowired
private QinCeUtils qinCeUtils;
@Autowired
private T100Util t100Util;
/**
* 从飞书同步全量部门信息
*/
......@@ -92,6 +99,20 @@ public class DeptAndUserServiceImpl implements IDeptAndUserService {
}catch (Exception e){
log.error("勤策接口禁用用户异常,详情:{}",e.getMessage());
}
// 3、T100人员离职
try{
JSONObject json = new JSONObject();
String msg = t100Util.userResigned(employeeNo,"X",json);
SysEventLogDto eventDto = new SysEventLogDto()
.setEventName("T100 user status")
.setEventGroup("T100 user")
.setRequestMsg(JSONObject.toJSONString(json))
.setResponseMsg(msg);
sysEventLogDao.insert(eventDto);
}catch (Exception e){
log.error("T100接口禁用用户异常,详情:{}",e.getMessage());
}
}
@Override
......
......@@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
......@@ -72,7 +73,6 @@ public class T100Util {
String msg = body.replaceAll("\n", "");
log.info("T100-AU-USER结果:{}",msg);
return msg;
}
private JSONObject getHost(){
......@@ -84,4 +84,35 @@ public class T100Util {
host.put("timestamp",DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MS_PATTERN));
return host;
}
public String userResigned(String employeeNo, String userStatus,JSONObject json) {
json.put("host",getHost());
json.putObject("service").put("name","upd_azzi800");
JSONObject datakey = new JSONObject();
datakey.put("CompanyId","BJHQ");
datakey.put("EntId",entId);
json.put("datakey",datakey);
JSONObject userJson = new JSONObject();
userJson.put("gzxa001",employeeNo);
userJson.put("gzxastus",userStatus);
json.putObject("payload").putObject("std_data").putObject("parameter").put("detail", Arrays.asList(userJson));
log.info("T100-USE-STATUS参数:{}",json);
String body = HttpUtil.createPost(url).addHeaders(getHeader()).body(json.toString()).execute().body();
String msg = body.replaceAll("\n", "");
log.info("T100-USE-STATUS结果:{}",msg);
return msg;
}
public HashMap<String,String> getHeader(){
HashMap<String,String> header = new HashMap<>();
header.put("Content-Type","application/json;charset=utf-8");
header.put("digi-protocol","raw");
header.put("digi-srvver","1.0");
header.put("digi-srvcode","000");
header.put("digi-type","sync");
header.put("digi-key","f63b06af224e90ea3f9f08e0226fc91e");
return header;
}
}
package com.sfa.job.util;
import com.alibaba.fastjson2.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import static org.junit.Assert.*;
/**
* @author : liqiulin
* @date : 2026-01-13 18
* @describe :
*/
@RunWith(SpringRunner.class)
@SpringBootTest
public class T100UtilTest {
@Autowired
private T100Util t100Util;
@Test
public void userResigned() {
// JSONObject json = new JSONObject();
// t100Util.userResigned("000043","X",json);
// System.out.println(json.toString());
}
}
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论