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

飞书事件响应延5迟;T100新建部门利润中心,一级部门是他自己,非一级部门统一为所处一级部门

...@@ -47,7 +47,7 @@ public class EventCallbackLuzx { ...@@ -47,7 +47,7 @@ public class EventCallbackLuzx {
private RedisService redisService; private RedisService redisService;
@RequestMapping(method = RequestMethod.POST) @RequestMapping(method = RequestMethod.POST)
public JSONObject handleEvent(@RequestBody JSONObject eventObj) { public JSONObject handleEvent(@RequestBody JSONObject eventObj) throws InterruptedException {
String encrypt = eventObj.getString(Constants.ENCRYPT); String encrypt = eventObj.getString(Constants.ENCRYPT);
try { try {
MessageDigest digest = MessageDigest.getInstance("SHA-256"); MessageDigest digest = MessageDigest.getInstance("SHA-256");
...@@ -71,7 +71,10 @@ public class EventCallbackLuzx { ...@@ -71,7 +71,10 @@ public class EventCallbackLuzx {
} }
return req; return req;
} catch (Exception e) { } catch (Exception e) {
throw new ServiceException(ECode.DB_TABLE_UPDATE_ERROR.getMsg(),ECode.DB_TABLE_UPDATE_ERROR.getCode()); log.info("飞书事件异常:{}:{}",ECode.DB_TABLE_UPDATE_ERROR.getMsg(),ECode.DB_TABLE_UPDATE_ERROR.getCode());
Thread.sleep(5000L);
log.info("飞书事件响应延5迟");
return null;
} }
} }
...@@ -86,8 +89,8 @@ public class EventCallbackLuzx { ...@@ -86,8 +89,8 @@ public class EventCallbackLuzx {
// 部门新建 // 部门新建
if (Constants.FEISHU_EVENT_DEPT_CREATE.equals(eventType) && !redisService.hasKey(rk)){ if (Constants.FEISHU_EVENT_DEPT_CREATE.equals(eventType) && !redisService.hasKey(rk)){
redisService.setCacheObject(rk,departmentId,1L, TimeUnit.HOURS);
eventCallbackService.deptCreate(departmentId); eventCallbackService.deptCreate(departmentId);
redisService.setCacheObject(rk,departmentId,24L, TimeUnit.HOURS);
} }
// 部门更新/停用 // 部门更新/停用
if (Constants.FEISHU_EVENT_DEPT_PUT.equals(eventType)){ if (Constants.FEISHU_EVENT_DEPT_PUT.equals(eventType)){
......
...@@ -12,6 +12,7 @@ import com.sfa.job.domain.system.dao.ISysUserDao; ...@@ -12,6 +12,7 @@ import com.sfa.job.domain.system.dao.ISysUserDao;
import com.sfa.job.pojo.feishu.event.EventCallBackDto; import com.sfa.job.pojo.feishu.event.EventCallBackDto;
import com.sfa.job.pojo.promotion.response.ActivityPlanApprovalDto; import com.sfa.job.pojo.promotion.response.ActivityPlanApprovalDto;
import com.sfa.job.util.T100Util; import com.sfa.job.util.T100Util;
import io.swagger.v3.core.util.Json;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -62,19 +63,29 @@ public class EventCallbackServiceImpl implements IEventCallbackService{ ...@@ -62,19 +63,29 @@ public class EventCallbackServiceImpl implements IEventCallbackService{
JSONObject deptT100 = new JSONObject(); JSONObject deptT100 = new JSONObject();
Department dept = feiShuUtil.getDepartmentCorehr(departmentId); Department dept = feiShuUtil.getDepartmentCorehr(departmentId);
String deptCode = dept.getCode(); String deptCode = dept.getCode();
I18n[] departmentName = dept.getDepartmentName(); String deptName = dept.getDepartmentName()[0].getValue();
String deptName = departmentName[0].getValue();
customFields(dept.getCustomFields(),deptT100); customFields(dept.getCustomFields(),deptT100);
String parentDepartmentId = dept.getParentDepartmentId(); String parentDepartmentId = dept.getParentDepartmentId();
Department parentdept = feiShuUtil.getDepartmentCorehr(parentDepartmentId); Department parentdept = feiShuUtil.getDepartmentCorehr(parentDepartmentId);
deptT100.put("top_level_department_no", deptCode.startsWith("ZX") ? "BJHQ" : parentdept.getCode());
deptT100.put("data_status","A"); if (deptCode.startsWith("ZX")){
deptT100.put("ooeg004",deptCode);
}else {
// 获取上级部门树、从而获取1级部门
DepartmentParentInfo[] parentsDept = feiShuUtil.getParentsDepartmentReq(dept.getId());
DepartmentParentInfo deptL1 = parentsDept[parentsDept.length - 2];
// 获取1级部门编码
Department deptInfoL1 = feiShuUtil.getDepartmentCorehr(deptL1.getDepartmentId());
String deptCodeL1 = deptInfoL1.getCode();
deptT100.put("ooeg004",deptCodeL1);
}
deptT100.put("data_status","A");
deptT100.put("status","Y"); deptT100.put("status","Y");
deptT100.put("department_no",deptCode); deptT100.put("department_no",deptCode);
deptT100.put("top_level_department_no", Objects.nonNull(parentdept.getIsRoot()) && parentdept.getIsRoot() ? "BJHQ" : parentdept.getCode());
deptT100.put("effective_date", "2024/05/01"); deptT100.put("effective_date", "2024/05/01");
deptT100.put("expiration_date",null); deptT100.put("expiration_date",null);
deptT100.put("corporation","ALL"); deptT100.put("corporation","ALL");
...@@ -115,7 +126,8 @@ public class EventCallbackServiceImpl implements IEventCallbackService{ ...@@ -115,7 +126,8 @@ public class EventCallbackServiceImpl implements IEventCallbackService{
deptT100.put("top_organization_no","ALL"); deptT100.put("top_organization_no","ALL");
deptT100.put("department_heads_employee_no",""); deptT100.put("department_heads_employee_no","");
deptT100.put("ooeg005","Y"); deptT100.put("ooeg005","Y");
// todo ooeg004
// deptT100.put("ooeg004",);
createOrUpdateDept(deptT100); createOrUpdateDept(deptT100);
// 部门停用时,删除链路中心部门 // 部门停用时,删除链路中心部门
if (!active) { if (!active) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论