Merge branch 'dev' into 'test'
feat(system): 新增外部系统推送配置功能 See merge request jygk/dsc!21
This commit is contained in:
@@ -59,13 +59,15 @@ public class BusinessDeptHandleUtil {
|
|||||||
}
|
}
|
||||||
// 如果有 deptId,校验其是否属于该 companyId
|
// 如果有 deptId,校验其是否属于该 companyId
|
||||||
if (deptIdHeader != null) {
|
if (deptIdHeader != null) {
|
||||||
boolean valid = companyDeptSetByCompanyId.stream().anyMatch(info -> String.valueOf(info.getDeptId()).equals(deptIdHeader));
|
Optional<CompanyDeptInfo> matched = companyDeptSetByCompanyId.stream()
|
||||||
if (!valid) {
|
.filter(info -> String.valueOf(info.getDeptId()).equals(deptIdHeader))
|
||||||
|
.findFirst();
|
||||||
|
if (matched.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
|
||||||
// 部门存在,放行
|
|
||||||
return new HashSet<>();
|
|
||||||
}
|
}
|
||||||
|
// 部门存在,先设置登录信息再放行
|
||||||
|
applyAutoSelection(currentLoginUser, request, matched.get());
|
||||||
|
return Collections.emptySet();
|
||||||
}
|
}
|
||||||
if (companyDeptSetByCompanyId.size() == 1) {
|
if (companyDeptSetByCompanyId.size() == 1) {
|
||||||
CompanyDeptInfo singleCompanyDept = companyDeptSetByCompanyId.iterator().next();
|
CompanyDeptInfo singleCompanyDept = companyDeptSetByCompanyId.iterator().next();
|
||||||
@@ -183,10 +185,10 @@ public class BusinessDeptHandleUtil {
|
|||||||
if (loginUser != null) {
|
if (loginUser != null) {
|
||||||
loginUser.setVisitCompanyId(Long.valueOf(info.getCompanyId()));
|
loginUser.setVisitCompanyId(Long.valueOf(info.getCompanyId()));
|
||||||
loginUser.setVisitCompanyName(info.getCompanyName());
|
loginUser.setVisitCompanyName(info.getCompanyName());
|
||||||
loginUser.setVisitCompanyCode(info.getCompanyName());
|
loginUser.setVisitCompanyCode(info.getCompanyCode());
|
||||||
loginUser.setVisitDeptId(Long.valueOf(info.getDeptId()));
|
loginUser.setVisitDeptId(Long.valueOf(info.getDeptId()));
|
||||||
loginUser.setVisitDeptName(info.getDeptName());
|
loginUser.setVisitDeptName(info.getDeptName());
|
||||||
loginUser.setVisitDeptCode(info.getDeptName());
|
loginUser.setVisitDeptCode(info.getDeptCode());
|
||||||
}
|
}
|
||||||
request.setAttribute(WebFrameworkUtils.HEADER_VISIT_COMPANY_ID, info.getCompanyId());
|
request.setAttribute(WebFrameworkUtils.HEADER_VISIT_COMPANY_ID, info.getCompanyId());
|
||||||
if (info.getCompanyName() != null) {
|
if (info.getCompanyName() != null) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.zt.plat.module.system.controller.admin.integration.iwork.vo;
|
package com.zt.plat.module.system.controller.admin.integration.iwork.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.zt.plat.module.system.enums.integration.IWorkSyncEntityTypeEnum;
|
import com.zt.plat.module.system.enums.integration.IWorkSyncEntityTypeEnum;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.Max;
|
import jakarta.validation.constraints.Max;
|
||||||
@@ -42,6 +43,66 @@ public class IWorkFullSyncReqVO {
|
|||||||
@Schema(description = "是否允许更新已存在的本地实体", example = "false")
|
@Schema(description = "是否允许更新已存在的本地实体", example = "false")
|
||||||
private Boolean allowUpdate = Boolean.FALSE;
|
private Boolean allowUpdate = Boolean.FALSE;
|
||||||
|
|
||||||
|
@JsonProperty("departmentcode")
|
||||||
|
@Schema(description = "部门编号")
|
||||||
|
private String departmentCode;
|
||||||
|
|
||||||
|
@JsonProperty("departmentname")
|
||||||
|
@Schema(description = "部门名称")
|
||||||
|
private String departmentName;
|
||||||
|
|
||||||
|
@JsonProperty("subcompanycode")
|
||||||
|
@Schema(description = "分部编号")
|
||||||
|
private String subcompanyCode;
|
||||||
|
|
||||||
|
@JsonProperty("subcompanyname")
|
||||||
|
@Schema(description = "分部名称")
|
||||||
|
private String subcompanyName;
|
||||||
|
|
||||||
|
@JsonProperty("subcompanyid1")
|
||||||
|
@Schema(description = "分部 ID")
|
||||||
|
private String subcompanyId1;
|
||||||
|
|
||||||
|
@JsonProperty("jobtitlename")
|
||||||
|
@Schema(description = "岗位名称")
|
||||||
|
private String jobTitleName;
|
||||||
|
|
||||||
|
@JsonProperty("workcode")
|
||||||
|
@Schema(description = "人员编号")
|
||||||
|
private String workCode;
|
||||||
|
|
||||||
|
@JsonProperty("loginid")
|
||||||
|
@Schema(description = "登录名")
|
||||||
|
private String loginId;
|
||||||
|
|
||||||
|
@JsonProperty("created")
|
||||||
|
@Schema(description = "创建时间戳(>=)")
|
||||||
|
private String created;
|
||||||
|
|
||||||
|
@JsonProperty("modified")
|
||||||
|
@Schema(description = "修改时间戳(>=)")
|
||||||
|
private String modified;
|
||||||
|
|
||||||
|
@JsonProperty("canceled")
|
||||||
|
@Schema(description = "封存标志,默认查询非封存数据。1:封存")
|
||||||
|
private String canceled;
|
||||||
|
|
||||||
|
@JsonProperty("custom_data")
|
||||||
|
@Schema(description = "自定义字段列表(逗号分隔)")
|
||||||
|
private String customData;
|
||||||
|
|
||||||
|
@JsonProperty("base_custom_data")
|
||||||
|
@Schema(description = "基本信息自定义字段列表(逗号分隔)")
|
||||||
|
private String baseCustomData;
|
||||||
|
|
||||||
|
@JsonProperty("person_custom_data")
|
||||||
|
@Schema(description = "个人信息自定义字段列表(逗号分隔)")
|
||||||
|
private String personCustomData;
|
||||||
|
|
||||||
|
@JsonProperty("work_custom_data")
|
||||||
|
@Schema(description = "工作信息自定义字段列表(逗号分隔)")
|
||||||
|
private String workCustomData;
|
||||||
|
|
||||||
public Set<IWorkSyncEntityTypeEnum> resolveScopes() {
|
public Set<IWorkSyncEntityTypeEnum> resolveScopes() {
|
||||||
EnumSet<IWorkSyncEntityTypeEnum> defaults = EnumSet.allOf(IWorkSyncEntityTypeEnum.class);
|
EnumSet<IWorkSyncEntityTypeEnum> defaults = EnumSet.allOf(IWorkSyncEntityTypeEnum.class);
|
||||||
if (scopes == null || scopes.isEmpty()) {
|
if (scopes == null || scopes.isEmpty()) {
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.zt.plat.module.system.job.sync;
|
||||||
|
|
||||||
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||||
|
import com.zt.plat.framework.tenant.core.job.TenantJob;
|
||||||
|
import com.zt.plat.module.system.service.sync.SyncIWorkUserChangeService;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于定时同步iWork当日修改的用户数据
|
||||||
|
* 同步时间:每日23:00
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class SyncIWorkUserChangeJob {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SyncIWorkUserChangeService syncIWorkUserChangeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行批量重跑任务
|
||||||
|
* 配置执行频率:每日23:00时执行一次
|
||||||
|
* cron表达式:0 0 23 * * ?
|
||||||
|
*/
|
||||||
|
@XxlJob("syncIWorkUserChangeJob")
|
||||||
|
@TenantJob
|
||||||
|
public void execute() {
|
||||||
|
log.info("[syncLogBatchRerunJob][开始执行同步iWork当日变更用户任务]");
|
||||||
|
try{
|
||||||
|
int processedCount = syncIWorkUserChangeService.process();
|
||||||
|
if (processedCount > 0) {
|
||||||
|
log.info("[syncLogBatchRerunJob][同步任务执行完成,处理了 {} 条记录]", processedCount);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("[syncLogBatchRerunJob][同步iWork当日变更用户任务执行异常]", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.zt.plat.module.system.service.sync;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步iWork当日修改的用户数据
|
||||||
|
*/
|
||||||
|
public interface SyncIWorkUserChangeService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步入口
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int process();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.zt.plat.module.system.service.sync;
|
||||||
|
|
||||||
|
import com.zt.plat.module.system.controller.admin.integration.iwork.vo.IWorkFullSyncReqVO;
|
||||||
|
import com.zt.plat.module.system.controller.admin.integration.iwork.vo.IWorkFullSyncRespVO;
|
||||||
|
import com.zt.plat.module.system.service.integration.iwork.IWorkSyncService;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class SyncIWorkUserChangeServiceImpl implements SyncIWorkUserChangeService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IWorkSyncService iWorkSyncService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int process() {
|
||||||
|
IWorkFullSyncReqVO reqVO = new IWorkFullSyncReqVO();
|
||||||
|
reqVO.setPageSize(10);
|
||||||
|
// 设置修改日期的查询条件为当日0时起
|
||||||
|
ZoneId zone = ZoneId.of("Asia/Shanghai");
|
||||||
|
String startOfToday = LocalDate.now(zone)
|
||||||
|
.atStartOfDay(zone)
|
||||||
|
.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||||
|
reqVO.setModified(startOfToday);
|
||||||
|
IWorkFullSyncRespVO respVO = iWorkSyncService.fullSyncUsers(reqVO);
|
||||||
|
if(respVO!=null && respVO.getProcessedPages()!=null && respVO.getPageSize()!=null)
|
||||||
|
return respVO.getProcessedPages() * respVO.getPageSize();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user