Merge branch 'dev' into test

This commit is contained in:
chenbowen
2025-12-22 13:47:37 +08:00
15 changed files with 538 additions and 22 deletions

View File

@@ -3560,7 +3560,7 @@ COMMENT ON TABLE system_users IS '用户信息表';
-- ---------------------------- -- ----------------------------
-- @formatter:off -- @formatter:off
-- SET IDENTITY_INSERT system_users ON; -- SET IDENTITY_INSERT system_users ON;
INSERT INTO system_users (id, username, password, nickname, workcode, remark, post_ids, email, mobile, sex, user_source, avatar, status, login_ip, login_date, creator, create_time, updater, update_time, deleted, tenant_id) VALUES (1, 'admin', '$2a$04$KljJDa/LK7QfDm0lF5OhuePhlPfjRH3tB2Wu351Uidz.oQGJXevPi', '后台管理', NULL, '管理员', '[1,2]', '11aoteman@126.com', '18818260277', 2, 1, 'http://test.zt.iocoder.cn/test/20250502/avatar_1746154660449.png', 0, '0:0:0:0:0:0:0:1', '2025-05-10 18:03:15', 'admin', '2021-01-05 17:03:47', NULL, '2025-05-10 18:03:15', '0', 1); INSERT INTO system_users (id, username, password, nickname, workcode, remark, post_ids, email, mobile, sex, user_source, avatar, status, login_ip, login_date, creator, create_time, updater, update_time, deleted, tenant_id) VALUES (1, 'admin', '$2a$04$KljJDa/LK7QfDm0lF5OhuePhlPfjRH3tB2Wu351Uidz.oQGJXevPi', '后台管理', NULL, '管理员', '[1,2]', '11aoteman@126.com', '18818260277', 2, 1, NULL, 0, '0:0:0:0:0:0:0:1', '2025-05-10 18:03:15', 'admin', '2021-01-05 17:03:47', NULL, '2025-05-10 18:03:15', '0', 1);
INSERT INTO system_users (id, username, password, nickname, workcode, remark, post_ids, email, mobile, sex, user_source, avatar, status, login_ip, login_date, creator, create_time, updater, update_time, deleted, tenant_id) VALUES (100, 'zt', '$2a$04$h.aaPKgO.odHepnk5PCsWeEwKdojFWdTItxGKfx1r0e1CSeBzsTJ6', 'ZT', NULL, '不要吓我', '[1]', 'zt@iocoder.cn', '15601691300', 1, 1, NULL, 0, '0:0:0:0:0:0:0:1', '2025-04-08 09:36:40', '', '2021-01-07 09:07:17', NULL, '2025-04-21 14:23:08', '0', 1); INSERT INTO system_users (id, username, password, nickname, workcode, remark, post_ids, email, mobile, sex, user_source, avatar, status, login_ip, login_date, creator, create_time, updater, update_time, deleted, tenant_id) VALUES (100, 'zt', '$2a$04$h.aaPKgO.odHepnk5PCsWeEwKdojFWdTItxGKfx1r0e1CSeBzsTJ6', 'ZT', NULL, '不要吓我', '[1]', 'zt@iocoder.cn', '15601691300', 1, 1, NULL, 0, '0:0:0:0:0:0:0:1', '2025-04-08 09:36:40', '', '2021-01-07 09:07:17', NULL, '2025-04-21 14:23:08', '0', 1);
INSERT INTO system_users (id, username, password, nickname, workcode, remark, post_ids, email, mobile, sex, user_source, avatar, status, login_ip, login_date, creator, create_time, updater, update_time, deleted, tenant_id) VALUES (103, 'yuanma', '$2a$04$fUBSmjKCPYAUmnMzOb6qE.eZCGPhHi1JmAKclODbfS/O7fHOl2bH6', '源码', NULL, NULL, NULL, 'yuanma@iocoder.cn', '15601701300', 0, 1, NULL, 0, '0:0:0:0:0:0:0:1', '2024-08-11 17:48:12', '', '2021-01-13 23:50:35', NULL, '2025-04-21 14:23:08', '0', 1); INSERT INTO system_users (id, username, password, nickname, workcode, remark, post_ids, email, mobile, sex, user_source, avatar, status, login_ip, login_date, creator, create_time, updater, update_time, deleted, tenant_id) VALUES (103, 'yuanma', '$2a$04$fUBSmjKCPYAUmnMzOb6qE.eZCGPhHi1JmAKclODbfS/O7fHOl2bH6', '源码', NULL, NULL, NULL, 'yuanma@iocoder.cn', '15601701300', 0, 1, NULL, 0, '0:0:0:0:0:0:0:1', '2024-08-11 17:48:12', '', '2021-01-13 23:50:35', NULL, '2025-04-21 14:23:08', '0', 1);
INSERT INTO system_users (id, username, password, nickname, workcode, remark, post_ids, email, mobile, sex, user_source, avatar, status, login_ip, login_date, creator, create_time, updater, update_time, deleted, tenant_id) VALUES (104, 'test', '$2a$04$BrwaYn303hjA/6TnXqdGoOLhyHOAA0bVrAFu6.1dJKycqKUnIoRz2', '测试号', NULL, NULL, '[1,2]', '111@qq.com', '15601691200', 1, 1, NULL, 0, '0:0:0:0:0:0:0:1', '2025-03-28 20:01:16', '', '2021-01-21 02:13:53', NULL, '2025-04-21 14:23:08', '0', 1); INSERT INTO system_users (id, username, password, nickname, workcode, remark, post_ids, email, mobile, sex, user_source, avatar, status, login_ip, login_date, creator, create_time, updater, update_time, deleted, tenant_id) VALUES (104, 'test', '$2a$04$BrwaYn303hjA/6TnXqdGoOLhyHOAA0bVrAFu6.1dJKycqKUnIoRz2', '测试号', NULL, NULL, '[1,2]', '111@qq.com', '15601691200', 1, 1, NULL, 0, '0:0:0:0:0:0:0:1', '2025-03-28 20:01:16', '', '2021-01-21 02:13:53', NULL, '2025-04-21 14:23:08', '0', 1);

View File

@@ -7,6 +7,8 @@ import org.springframework.boot.autoconfigure.AutoConfigurationPackages;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.util.StringUtils;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.Set; import java.util.Set;
@@ -18,14 +20,12 @@ import java.util.Set;
public class BusinessDataPermissionConfiguration { public class BusinessDataPermissionConfiguration {
@Bean @Bean
public BusinessDataPermissionEntityScanner businessDataPermissionEntityScanner(BeanFactory beanFactory, ApplicationContext applicationContext) { public BusinessDataPermissionEntityScanner businessDataPermissionEntityScanner(BeanFactory beanFactory, ApplicationContext applicationContext, Environment environment) {
Set<String> basePackages = new LinkedHashSet<>(); Set<String> basePackages = new LinkedHashSet<>();
addConfiguredBasePackages(environment, basePackages);
if (AutoConfigurationPackages.has(beanFactory)) { if (AutoConfigurationPackages.has(beanFactory)) {
basePackages.addAll(AutoConfigurationPackages.get(beanFactory)); basePackages.addAll(AutoConfigurationPackages.get(beanFactory));
} }
if (basePackages.isEmpty()) {
basePackages.add("com.zt");
}
ClassLoader classLoader = applicationContext != null ClassLoader classLoader = applicationContext != null
? applicationContext.getClassLoader() ? applicationContext.getClassLoader()
: Thread.currentThread().getContextClassLoader(); : Thread.currentThread().getContextClassLoader();
@@ -35,6 +35,21 @@ public class BusinessDataPermissionConfiguration {
return new BusinessDataPermissionEntityScanner(basePackages, classLoader); return new BusinessDataPermissionEntityScanner(basePackages, classLoader);
} }
private void addConfiguredBasePackages(Environment environment, Set<String> basePackages) {
if (environment == null) {
return;
}
String configured = environment.getProperty("zt.info.base-package");
if (!StringUtils.hasText(configured)) {
return;
}
for (String pkg : configured.split("[,;\\s]+")) {
if (StringUtils.hasText(pkg)) {
basePackages.add(pkg.trim());
}
}
}
@Bean @Bean
public CompanyDataPermissionRuleCustomizer autoCompanyDataPermissionRuleCustomizer(BusinessDataPermissionEntityScanner scanner) { public CompanyDataPermissionRuleCustomizer autoCompanyDataPermissionRuleCustomizer(BusinessDataPermissionEntityScanner scanner) {
return rule -> scanner.getEntityMetadata().forEach(metadata -> { return rule -> scanner.getEntityMetadata().forEach(metadata -> {

View File

@@ -4,6 +4,7 @@ import com.zt.plat.framework.common.biz.system.permission.PermissionCommonApi;
import com.zt.plat.framework.common.pojo.CommonResult; import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.module.system.api.permission.dto.*; import com.zt.plat.module.system.api.permission.dto.*;
import com.zt.plat.module.system.enums.ApiConstants; import com.zt.plat.module.system.enums.ApiConstants;
import com.zt.plat.module.system.enums.permission.DataScopeEnum;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
@@ -50,4 +51,9 @@ public interface PermissionApi extends PermissionCommonApi {
@Parameter(name = "userId", description = "用户编号", example = "1", required = true) @Parameter(name = "userId", description = "用户编号", example = "1", required = true)
CommonResult<Set<Long>> getUserRoleIdListByUserId(@RequestParam("userId") Long userId); CommonResult<Set<Long>> getUserRoleIdListByUserId(@RequestParam("userId") Long userId);
@GetMapping(PREFIX + "/user-data-permission-level")
@Operation(summary = "获得用户的数据权限级别")
@Parameter(name = "userId", description = "用户编号", example = "1", required = true)
CommonResult<DataScopeEnum> getUserDataPermissionLevel(@RequestParam("userId") Long userId);
} }

View File

@@ -1,10 +1,12 @@
package com.zt.plat.module.system.enums.permission; package com.zt.plat.module.system.enums.permission;
import com.fasterxml.jackson.annotation.JsonValue;
import com.zt.plat.framework.common.core.ArrayValuable; import com.zt.plat.framework.common.core.ArrayValuable;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;
import java.util.Arrays; import java.util.Arrays;
import java.util.Objects;
/** /**
* 数据范围枚举类 * 数据范围枚举类
@@ -33,6 +35,26 @@ public enum DataScopeEnum implements ArrayValuable<Integer> {
public static final Integer[] ARRAYS = Arrays.stream(values()).map(DataScopeEnum::getScope).toArray(Integer[]::new); public static final Integer[] ARRAYS = Arrays.stream(values()).map(DataScopeEnum::getScope).toArray(Integer[]::new);
/**
* Jackson 序列化时输出整数 code兼容旧客户端
*/
@JsonValue
public Integer getScope() {
return scope;
}
public static DataScopeEnum findByScope(Integer scope) {
if (scope == null) {
return null;
}
for (DataScopeEnum value : values()) {
if (Objects.equals(value.scope, scope)) {
return value;
}
}
return null;
}
@Override @Override
public Integer[] array() { public Integer[] array() {
return ARRAYS; return ARRAYS;

View File

@@ -6,6 +6,7 @@ import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.module.system.api.permission.dto.*; import com.zt.plat.module.system.api.permission.dto.*;
import com.zt.plat.module.system.controller.admin.permission.vo.permission.PermissionAssignRoleDataScopeReqVO; import com.zt.plat.module.system.controller.admin.permission.vo.permission.PermissionAssignRoleDataScopeReqVO;
import com.zt.plat.module.system.controller.admin.permission.vo.permission.PermissionAssignUserRoleReqVO; import com.zt.plat.module.system.controller.admin.permission.vo.permission.PermissionAssignUserRoleReqVO;
import com.zt.plat.module.system.enums.permission.DataScopeEnum;
import com.zt.plat.module.system.service.permission.PermissionService; import com.zt.plat.module.system.service.permission.PermissionService;
import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Primary;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@@ -65,6 +66,11 @@ public class PermissionApiImpl implements PermissionApi {
return success(permissionService.getUserRoleIdListByUserIdFromCache(userId)); return success(permissionService.getUserRoleIdListByUserIdFromCache(userId));
} }
@Override
public CommonResult<DataScopeEnum> getUserDataPermissionLevel(Long userId) {
return success(permissionService.getUserDataPermissionLevel(userId));
}
@Override @Override
public CommonResult<Boolean> hasAnyPermissions(Long userId, String... permissions) { public CommonResult<Boolean> hasAnyPermissions(Long userId, String... permissions) {
return success(permissionService.hasAnyPermissions(userId, permissions)); return success(permissionService.hasAnyPermissions(userId, permissions));

View File

@@ -174,4 +174,11 @@ public interface DeptService {
* @return 部门列表 * @return 部门列表
*/ */
List<DeptDO> searchDeptTree(String keyword); List<DeptDO> searchDeptTree(String keyword);
/**
* 回填缺失的部门编码(不触发事件)。
*
* @param deptIds 需要回填的部门 ID 列表
*/
void backfillMissingCodesWithoutEvent(Collection<Long> deptIds);
} }

View File

@@ -900,4 +900,27 @@ public class DeptServiceImpl implements DeptService {
} }
} }
@Override
@Transactional(rollbackFor = Exception.class)
@DataPermission(enable = false)
public void backfillMissingCodesWithoutEvent(Collection<Long> deptIds) {
if (CollUtil.isEmpty(deptIds)) {
return;
}
List<DeptDO> targets = deptMapper.selectBatchIds(deptIds);
for (DeptDO dept : targets) {
if (dept == null || StrUtil.isNotBlank(dept.getCode())) {
continue;
}
Integer source = ObjectUtil.defaultIfNull(dept.getDeptSource(), DeptSourceEnum.EXTERNAL.getSource());
try {
String code = generateDeptCode(dept.getParentId(), source);
validateDeptCodeUnique(dept.getId(), code);
updateDeptCode(dept.getId(), code);
} catch (Exception ex) {
log.warn("[iWork] 回填部门编码失败 id={} name={} msg={}", dept.getId(), dept.getName(), ex.getMessage());
}
}
}
} }

View File

@@ -5,23 +5,42 @@ import com.zt.plat.module.system.controller.admin.integration.iwork.vo.IWorkHrJo
import com.zt.plat.module.system.controller.admin.integration.iwork.vo.IWorkHrSubcompanyPageRespVO; import com.zt.plat.module.system.controller.admin.integration.iwork.vo.IWorkHrSubcompanyPageRespVO;
import com.zt.plat.module.system.controller.admin.integration.iwork.vo.IWorkHrUserPageRespVO; import com.zt.plat.module.system.controller.admin.integration.iwork.vo.IWorkHrUserPageRespVO;
import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.Set;
/** /**
* Abstraction for applying iWork entities into local persistence. * Abstraction for applying iWork entities into local persistence.
*/ */
public interface IWorkSyncProcessor { public interface IWorkSyncProcessor {
BatchResult syncSubcompanies(List<IWorkHrSubcompanyPageRespVO.Subcompany> data, SyncOptions options); BatchResult syncSubcompanies(List<IWorkHrSubcompanyPageRespVO.Subcompany> data,
SyncOptions options);
BatchResult syncSubcompanies(List<IWorkHrSubcompanyPageRespVO.Subcompany> data,
SyncOptions options,
DeptSyncContext context);
BatchResult syncDepartments(List<IWorkHrDepartmentPageRespVO.Department> data, SyncOptions options); BatchResult syncDepartments(List<IWorkHrDepartmentPageRespVO.Department> data, SyncOptions options);
BatchResult syncDepartments(List<IWorkHrDepartmentPageRespVO.Department> data,
SyncOptions options,
DeptSyncContext context);
BatchResult syncJobTitles(List<IWorkHrJobTitlePageRespVO.JobTitle> data, SyncOptions options); BatchResult syncJobTitles(List<IWorkHrJobTitlePageRespVO.JobTitle> data, SyncOptions options);
BatchResult syncUsers(List<IWorkHrUserPageRespVO.User> data, SyncOptions options); BatchResult syncUsers(List<IWorkHrUserPageRespVO.User> data, SyncOptions options);
/**
* 对当次同步累计的待处理/占位部门做最终补偿(跨页父子依赖)。
*/
default BatchResult flushDeptPending(DeptSyncContext context, SyncOptions options) {
return BatchResult.empty();
}
/** /**
* Execution options shared by batch and single sync flows. * Execution options shared by batch and single sync flows.
*/ */
@@ -53,6 +72,32 @@ public interface IWorkSyncProcessor {
} }
} }
/**
* 部门/分部跨页同步上下文,用于累计待处理记录与已就绪父级。
*/
final class DeptSyncContext {
private final Set<Long> readyParentIds = new HashSet<>();
private final List<IWorkHrSubcompanyPageRespVO.Subcompany> pendingSubcompanies = new ArrayList<>();
private final List<IWorkHrDepartmentPageRespVO.Department> pendingDepartments = new ArrayList<>();
private final Set<Long> placeholderDeptIds = new HashSet<>();
public Set<Long> getReadyParentIds() {
return readyParentIds;
}
public List<IWorkHrSubcompanyPageRespVO.Subcompany> getPendingSubcompanies() {
return pendingSubcompanies;
}
public List<IWorkHrDepartmentPageRespVO.Department> getPendingDepartments() {
return pendingDepartments;
}
public Set<Long> getPlaceholderDeptIds() {
return placeholderDeptIds;
}
}
/** /**
* Aggregated result for a sync batch. * Aggregated result for a sync batch.
*/ */
@@ -170,11 +215,11 @@ public interface IWorkSyncProcessor {
} }
default BatchResult syncSubcompany(IWorkHrSubcompanyPageRespVO.Subcompany data, SyncOptions options) { default BatchResult syncSubcompany(IWorkHrSubcompanyPageRespVO.Subcompany data, SyncOptions options) {
return syncSubcompanies(Collections.singletonList(data), options); return syncSubcompanies(Collections.singletonList(data), options, null);
} }
default BatchResult syncDepartment(IWorkHrDepartmentPageRespVO.Department data, SyncOptions options) { default BatchResult syncDepartment(IWorkHrDepartmentPageRespVO.Department data, SyncOptions options) {
return syncDepartments(Collections.singletonList(data), options); return syncDepartments(Collections.singletonList(data), options, null);
} }
default BatchResult syncJobTitle(IWorkHrJobTitlePageRespVO.JobTitle data, SyncOptions options) { default BatchResult syncJobTitle(IWorkHrJobTitlePageRespVO.JobTitle data, SyncOptions options) {

View File

@@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
import com.zt.plat.framework.common.exception.util.ServiceExceptionUtil; import com.zt.plat.framework.common.exception.util.ServiceExceptionUtil;
import com.zt.plat.module.system.controller.admin.integration.iwork.vo.*; import com.zt.plat.module.system.controller.admin.integration.iwork.vo.*;
import com.zt.plat.module.system.enums.integration.IWorkSyncEntityTypeEnum; import com.zt.plat.module.system.enums.integration.IWorkSyncEntityTypeEnum;
import com.zt.plat.module.system.service.dept.DeptService;
import com.zt.plat.module.system.service.integration.iwork.IWorkOrgRestService; import com.zt.plat.module.system.service.integration.iwork.IWorkOrgRestService;
import com.zt.plat.module.system.service.integration.iwork.IWorkSyncProcessor; import com.zt.plat.module.system.service.integration.iwork.IWorkSyncProcessor;
import com.zt.plat.module.system.service.integration.iwork.IWorkSyncService; import com.zt.plat.module.system.service.integration.iwork.IWorkSyncService;
@@ -31,6 +32,7 @@ public class IWorkSyncServiceImpl implements IWorkSyncService {
private final IWorkOrgRestService orgRestService; private final IWorkOrgRestService orgRestService;
private final IWorkSyncProcessor syncProcessor; private final IWorkSyncProcessor syncProcessor;
private final DeptService deptService;
@Override @Override
public IWorkFullSyncRespVO fullSyncDepartments(IWorkFullSyncReqVO reqVO) { public IWorkFullSyncRespVO fullSyncDepartments(IWorkFullSyncReqVO reqVO) {
@@ -64,11 +66,14 @@ public class IWorkSyncServiceImpl implements IWorkSyncService {
boolean syncJobTitle = scopes.contains(IWorkSyncEntityTypeEnum.JOB_TITLE); boolean syncJobTitle = scopes.contains(IWorkSyncEntityTypeEnum.JOB_TITLE);
int processedPages = 0; int processedPages = 0;
IWorkSyncProcessor.SyncOptions options = buildFullSyncOptions(reqVO); IWorkSyncProcessor.SyncOptions options = buildFullSyncOptions(reqVO);
IWorkSyncProcessor.DeptSyncContext deptSyncContext = (syncDepartments || syncSubcompanies)
? new IWorkSyncProcessor.DeptSyncContext()
: null;
if (syncSubcompanies) { if (syncSubcompanies) {
processedPages += executeSubcompanyFullSync(reqVO, options, respVO.getSubcompanyStat(), batchStats); processedPages += executeSubcompanyFullSync(reqVO, options, respVO.getSubcompanyStat(), batchStats, deptSyncContext);
} }
if (syncDepartments) { if (syncDepartments) {
processedPages += executeDepartmentFullSync(reqVO, options, respVO.getDepartmentStat(), batchStats); processedPages += executeDepartmentFullSync(reqVO, options, respVO.getDepartmentStat(), batchStats, deptSyncContext);
} }
if (syncJobTitle) { if (syncJobTitle) {
processedPages += executeJobTitleFullSync(reqVO, options, respVO.getJobTitleStat(), batchStats); processedPages += executeJobTitleFullSync(reqVO, options, respVO.getJobTitleStat(), batchStats);
@@ -76,6 +81,13 @@ public class IWorkSyncServiceImpl implements IWorkSyncService {
if (syncUsers) { if (syncUsers) {
processedPages += executeUserFullSync(reqVO, options, respVO.getUserStat(), batchStats); processedPages += executeUserFullSync(reqVO, options, respVO.getUserStat(), batchStats);
} }
if (deptSyncContext != null) {
IWorkSyncProcessor.BatchResult flushResult = syncProcessor.flushDeptPending(deptSyncContext, options);
updateStat(respVO.getDepartmentStat(), flushResult, 0);
if (CollUtil.isNotEmpty(deptSyncContext.getPlaceholderDeptIds())) {
deptService.backfillMissingCodesWithoutEvent(deptSyncContext.getPlaceholderDeptIds());
}
}
respVO.setProcessedPages(processedPages); respVO.setProcessedPages(processedPages);
return respVO; return respVO;
} }
@@ -83,7 +95,8 @@ public class IWorkSyncServiceImpl implements IWorkSyncService {
private int executeSubcompanyFullSync(IWorkFullSyncReqVO reqVO, private int executeSubcompanyFullSync(IWorkFullSyncReqVO reqVO,
IWorkSyncProcessor.SyncOptions options, IWorkSyncProcessor.SyncOptions options,
IWorkSyncEntityStatVO stat, IWorkSyncEntityStatVO stat,
List<IWorkSyncBatchStatVO> batches) { List<IWorkSyncBatchStatVO> batches,
IWorkSyncProcessor.DeptSyncContext context) {
return executePaged(reqVO, IWorkSyncEntityTypeEnum.SUBCOMPANY, batches, (page, pageSize) -> { return executePaged(reqVO, IWorkSyncEntityTypeEnum.SUBCOMPANY, batches, (page, pageSize) -> {
IWorkSubcompanyQueryReqVO query = new IWorkSubcompanyQueryReqVO(); IWorkSubcompanyQueryReqVO query = new IWorkSubcompanyQueryReqVO();
query.setCurpage(page); query.setCurpage(page);
@@ -92,7 +105,7 @@ public class IWorkSyncServiceImpl implements IWorkSyncService {
IWorkHrSubcompanyPageRespVO pageResp = orgRestService.listSubcompanies(query); IWorkHrSubcompanyPageRespVO pageResp = orgRestService.listSubcompanies(query);
ensureIWorkSuccess("拉取分部", pageResp.isSuccess(), pageResp.getMessage()); ensureIWorkSuccess("拉取分部", pageResp.isSuccess(), pageResp.getMessage());
List<IWorkHrSubcompanyPageRespVO.Subcompany> dataList = CollUtil.emptyIfNull(pageResp.getDataList()); List<IWorkHrSubcompanyPageRespVO.Subcompany> dataList = CollUtil.emptyIfNull(pageResp.getDataList());
IWorkSyncProcessor.BatchResult result = syncProcessor.syncSubcompanies(dataList, options); IWorkSyncProcessor.BatchResult result = syncProcessor.syncSubcompanies(dataList, options, context);
updateStat(stat, result, dataList.size()); updateStat(stat, result, dataList.size());
return new BatchExecution(result, dataList.size()); return new BatchExecution(result, dataList.size());
}); });
@@ -101,7 +114,8 @@ public class IWorkSyncServiceImpl implements IWorkSyncService {
private int executeDepartmentFullSync(IWorkFullSyncReqVO reqVO, private int executeDepartmentFullSync(IWorkFullSyncReqVO reqVO,
IWorkSyncProcessor.SyncOptions options, IWorkSyncProcessor.SyncOptions options,
IWorkSyncEntityStatVO stat, IWorkSyncEntityStatVO stat,
List<IWorkSyncBatchStatVO> batches) { List<IWorkSyncBatchStatVO> batches,
IWorkSyncProcessor.DeptSyncContext context) {
return executePaged(reqVO, IWorkSyncEntityTypeEnum.DEPARTMENT, batches, (page, pageSize) -> { return executePaged(reqVO, IWorkSyncEntityTypeEnum.DEPARTMENT, batches, (page, pageSize) -> {
IWorkDepartmentQueryReqVO query = new IWorkDepartmentQueryReqVO(); IWorkDepartmentQueryReqVO query = new IWorkDepartmentQueryReqVO();
query.setCurpage(page); query.setCurpage(page);
@@ -110,7 +124,7 @@ public class IWorkSyncServiceImpl implements IWorkSyncService {
IWorkHrDepartmentPageRespVO pageResp = orgRestService.listDepartments(query); IWorkHrDepartmentPageRespVO pageResp = orgRestService.listDepartments(query);
ensureIWorkSuccess("拉取部门", pageResp.isSuccess(), pageResp.getMessage()); ensureIWorkSuccess("拉取部门", pageResp.isSuccess(), pageResp.getMessage());
List<IWorkHrDepartmentPageRespVO.Department> dataList = CollUtil.emptyIfNull(pageResp.getDataList()); List<IWorkHrDepartmentPageRespVO.Department> dataList = CollUtil.emptyIfNull(pageResp.getDataList());
IWorkSyncProcessor.BatchResult result = syncProcessor.syncDepartments(dataList, options); IWorkSyncProcessor.BatchResult result = syncProcessor.syncDepartments(dataList, options, context);
updateStat(stat, result, dataList.size()); updateStat(stat, result, dataList.size());
return new BatchExecution(result, dataList.size()); return new BatchExecution(result, dataList.size());
}); });

Some files were not shown because too many files have changed in this diff Show More